[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:45:43 PDT 2013


On Mon, Mar 18, 2013 at 3:40 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> On Mar 18, 2013, at 3:30 PM, David Blaikie <dblaikie at gmail.com>  wrote:
>> 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
>
>
>> Strangely enough, this seems to have broken the Linux self hosting 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.
>
> Testing outside of libc++ shows:

Yep, sorry, my simplified experiment was standalone as well/already.
Filed PR15539 & investigating this as a Clang bug now.

>
>         #ifdef FOO
>         #define BAR 1
>         #elif __has_include(<foo>)
>         #define BAR 2
>         #endif
>
>         int main()
>         {
>                 return 0;
>         }
>
> fails to compile, but:
>
>         #if FOO
>         #define BAR 1
>         #elif __has_include(<foo>)
>         #define BAR 2
>         #endif
>
>         int main()
>         {
>                 return 0;
>         }
>
> succeeds.
>
> -- Marshall
>
>
>
> -- Marshall
>
> Marshall Clow     Idio Software   <mailto:mclow.lists at gmail.com>
>
> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
>         -- Yu Suzuki
>



More information about the cfe-commits mailing list