[PATCH] libc++: Add option to disable access to the global filesystem namespace

Jonathan Roelofs jonathan at codesourcery.com
Tue Mar 10 07:12:56 PDT 2015


Seems reasonable to me. I think you ought to fix a few of the tests that this "breaks", and add a few *.fail.cpp ones to verify that the functions you expect to be removed have actually been removed. For example ./test/std/input.output/file.streams/c.files/cstdio.pass.cpp should have:

  static_assert((std::is_same<decltype(std::fflush(fp)), int>::value), "");
  #if defined(_LIBCPP_HAS_GLOBAL_FILESYSTEM_NAMESPACE)
  static_assert((std::is_same<decltype(std::fopen("", "")), std::FILE*>::value), "");
  static_assert((std::is_same<decltype(std::freopen("", "", fp)), std::FILE*>::value), "");
  #endif
  static_assert((std::is_same<decltype(std::setbuf(fp,cp)), void>::value), "");

And then I'd add a ./test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp with:

  // REQUIRES: CloudABI
  
  #include <cstdio>
  
  int main() {
      // fopen is not allowed on systems without the global filesystem namespace
      std::fopen("", "");
  }


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8194

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list