[libc++] Fix a few warnings
authorYAMAMOTO Takashi <yamamoto@midokura.com>
Wed, 28 Oct 2020 19:40:16 +0000 (15:40 -0400)
committerLouis Dionne <ldionne@apple.com>
Wed, 28 Oct 2020 19:41:10 +0000 (15:41 -0400)
Found during a NuttX porting effort.
But these changes are not directly relevant to NuttX.

Differential Revision: https://reviews.llvm.org/D90139

libcxx/src/filesystem/operations.cpp
libcxx/src/locale.cpp

index 95d7d0d..788e31b 100644 (file)
@@ -534,7 +534,7 @@ path __canonical(path const& orig_p, error_code* ec) {
   ErrorHandler<path> err("canonical", ec, &orig_p, &cwd);
 
   path p = __do_absolute(orig_p, &cwd, ec);
-#if _POSIX_VERSION >= 200112
+#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112
   std::unique_ptr<char, decltype(&::free)>
     hold(::realpath(p.c_str(), nullptr), &::free);
   if (hold.get() == nullptr)
index b918088..02dbb33 100644 (file)
@@ -1149,7 +1149,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
 {
     return _LIBCPP_GET_C_LOCALE->__ctype_toupper;
 }
-#elif __NetBSD__
+#elif defined(__NetBSD__)
 const short*
 ctype<char>::__classic_lower_table() _NOEXCEPT
 {