[libcxx] r177297 - Removed raw references to __APPLE__; now just check to see if it is defined.

David Blaikie dblaikie at gmail.com
Mon Mar 18 15:30:57 PDT 2013


On Mon, Mar 18, 2013 at 10:45 AM, Marshall Clow <mclow at qualcomm.com> wrote:
> Author: marshall
> Date: Mon Mar 18 12:45:34 2013
> New Revision: 177297
>
> URL: http://llvm.org/viewvc/llvm-project?rev=177297&view=rev
> Log:
> Removed raw references to __APPLE__; now just check to see if it is defined.
>
> Modified:
>     libcxx/trunk/include/__locale
>     libcxx/trunk/include/iterator
>     libcxx/trunk/include/locale
>     libcxx/trunk/src/chrono.cpp
>     libcxx/trunk/src/exception.cpp
>     libcxx/trunk/src/new.cpp
>     libcxx/trunk/src/stdexcept.cpp
>     libcxx/trunk/src/typeinfo.cpp
>     libcxx/trunk/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
>     libcxx/trunk/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
>
> Modified: libcxx/trunk/include/__locale
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/include/__locale (original)
> +++ libcxx/trunk/include/__locale Mon Mar 18 12:45:34 2013
> @@ -21,7 +21,7 @@
>  #include <locale.h>
>  #ifdef _WIN32
>  # include <support/win32/locale_win32.h>
> -#elif (__GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__)
> +#elif (__GLIBC__ || defined(__APPLE__) || __FreeBSD__ || __sun__)
>  # include <xlocale.h>
>  #endif  // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
>
>
> Modified: libcxx/trunk/include/iterator
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/include/iterator (original)
> +++ libcxx/trunk/include/iterator Mon Mar 18 12:45:34 2013
> @@ -317,7 +317,7 @@ template <class T, size_t N> T* end(T (&
>  #include <type_traits>
>  #include <cstddef>
>  #include <iosfwd>
> -#if __APPLE__
> +#ifdef __APPLE__
>  #include <Availability.h>
>  #endif
>
>
> Modified: libcxx/trunk/include/locale
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/include/locale (original)
> +++ libcxx/trunk/include/locale Mon Mar 18 12:45:34 2013
> @@ -181,7 +181,7 @@ template <class charT> class messages_by
>  #include <streambuf>
>  #include <iterator>
>  #include <limits>
> -#if !__APPLE__
> +#ifndef __APPLE__
>  #include <cstdarg>
>  #endif
>  #include <cstdlib>
> @@ -192,7 +192,7 @@ template <class charT> class messages_by
>  #include <nl_types.h>
>  #endif  // !_WIN32
>
> -#if __APPLE__
> +#ifdef __APPLE__
>  #include <Availability.h>
>  #endif
>
> @@ -204,7 +204,7 @@ template <class charT> class messages_by
>
>  _LIBCPP_BEGIN_NAMESPACE_STD
>
> -#if __APPLE__ || __FreeBSD__
> +#if defined(__APPLE__) || __FreeBSD__
>  #  define _LIBCPP_GET_C_LOCALE 0
>  #else
>  #  define _LIBCPP_GET_C_LOCALE __cloc()
>
> Modified: libcxx/trunk/src/chrono.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/chrono.cpp?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/src/chrono.cpp (original)
> +++ libcxx/trunk/src/chrono.cpp Mon Mar 18 12:45:34 2013
> @@ -9,7 +9,7 @@
>
>  #include "chrono"
>  #include <sys/time.h>        //for gettimeofday and timeval
> -#if __APPLE__
> +#ifdef __APPLE__
>  #include <mach/mach_time.h>  // mach_absolute_time, mach_timebase_info_data_t
>  #else  /* !__APPLE__ */
>  #include <cerrno>  // errno
> @@ -50,7 +50,7 @@ system_clock::from_time_t(time_t t) _NOE
>
>  const bool steady_clock::is_steady;
>
> -#if __APPLE__
> +#ifdef __APPLE__
>  //   mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of
>  //   nanoseconds since the computer booted up.  MachInfo.numer and MachInfo.denom
>  //   are run time constants supplied by the OS.  This clock has no relationship
>
> Modified: libcxx/trunk/src/exception.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/exception.cpp?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/src/exception.cpp (original)
> +++ libcxx/trunk/src/exception.cpp Mon Mar 18 12:45:34 2013
> @@ -14,7 +14,7 @@
>  #define __has_include(inc) 0
>  #endif
>
> -#if __APPLE__
> +#ifdef __APPLE__
>    #include <cxxabi.h>
>
>    using namespace __cxxabiv1;
> @@ -102,7 +102,7 @@ terminate() _NOEXCEPT
>  #if !defined(LIBCXXRT) && !defined(__GLIBCXX__)
>  bool uncaught_exception() _NOEXCEPT
>  {
> -#if __APPLE__ || defined(_LIBCPPABI_VERSION)
> +#if defined(__APPLE__) || defined(_LIBCPPABI_VERSION)
>      // on Darwin, there is a helper function so __cxa_get_globals is private
>      return __cxa_uncaught_exception();
>  #else  // __APPLE__
>
> Modified: libcxx/trunk/src/new.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/src/new.cpp (original)
> +++ libcxx/trunk/src/new.cpp Mon Mar 18 12:45:34 2013
> @@ -15,7 +15,7 @@
>  #define __has_include(inc) 0
>  #endif
>
> -#if __APPLE__
> +#ifdef __APPLE__
>      #include <cxxabi.h>
>
>      #ifndef _LIBCPPABI_VERSION
>
> Modified: libcxx/trunk/src/stdexcept.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/stdexcept.cpp?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/src/stdexcept.cpp (original)
> +++ libcxx/trunk/src/stdexcept.cpp Mon Mar 18 12:45:34 2013
> @@ -20,7 +20,7 @@
>  #define __has_include(inc) 0
>  #endif
>
> -#if __APPLE__
> +#ifdef __APPLE__
>  #include <cxxabi.h>
>  #elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
>  #include <cxxabi.h>
>
> Modified: libcxx/trunk/src/typeinfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/typeinfo.cpp?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/src/typeinfo.cpp (original)
> +++ libcxx/trunk/src/typeinfo.cpp Mon Mar 18 12:45:34 2013
> @@ -12,7 +12,7 @@
>  #define __has_include(inc) 0
>  #endif
>
> -#if __APPLE__
> +#ifdef __APPLE__

Strangely enough, this seems to have broken the Linux selfhosting
build as follows:

src/projects/libcxx/src/typeinfo.cpp:17:28: error: __has_include must
be used within a preprocessing directive
#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
                           ^
src/projects/libcxx/src/typeinfo.cpp:17:28: error: invalid token at
start of a preprocessor expression
<scratch space>:18:1: note: expanded from here
0
^
2 errors generated.

Experimenting a bit this compiles without error:
#if FOO
#elif __has_include(<foo>)
#endif

But if you change the #if to #ifdef, it fails with the same error as
above... probably a Clang bug, I assume.

>  #include <cxxabi.h>
>  #elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
>  #include <cxxabi.h>
> @@ -50,7 +50,7 @@ std::bad_typeid::what() const _NOEXCEPT
>    return "std::bad_typeid";
>  }
>
> -#if __APPLE__
> +#ifdef __APPLE__
>    // On Darwin, the cxa_bad_* functions cannot be in the lower level library
>    // because bad_cast and bad_typeid are defined in his higher level library
>    void __cxxabiv1::__cxa_bad_typeid() { throw std::bad_typeid(); }
>
> Modified: libcxx/trunk/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp (original)
> +++ libcxx/trunk/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp Mon Mar 18 12:45:34 2013
> @@ -24413,7 +24413,7 @@ void test12()
>      output_iterator<char*> iter;
>      std::locale lc = std::locale::classic();
>      std::locale lg(lc, new my_numpunct);
> -#if __APPLE__
> +#ifdef __APPLE__
>  // This test is failing on FreeBSD, possibly due to different representations
>  // of the floating point numbers.
>      const my_facet f(1);
>
> Modified: libcxx/trunk/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp?rev=177297&r1=177296&r2=177297&view=diff
> ==============================================================================
> --- libcxx/trunk/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp (original)
> +++ libcxx/trunk/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp Mon Mar 18 12:45:34 2013
> @@ -93,7 +93,7 @@ int main()
>          assert(t.tm_hour == 23);
>          assert(err == std::ios_base::eofbit);
>      }
> -#if __APPLE__
> +#ifdef __APPLE__
>      {
>          const my_facet f("ru_RU", 1);
>          const wchar_t in[] = L"\x441\x443\x431\x431\x43E\x442\x430"
> @@ -128,7 +128,7 @@ int main()
>          assert(t.tm_hour == 23);
>          assert(err == std::ios_base::eofbit);
>      }
> -#if __APPLE__
> +#ifdef __APPLE__
>      {
>          const my_facet f("zh_CN", 1);
>          const wchar_t in[] = L"\x516D"
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list