[cfe-commits] r130369 - in /cfe/trunk: include/clang/Basic/TokenKinds.def lib/Frontend/InitPreprocessor.cpp lib/Parse/ParseDecl.cpp lib/Parse/ParseExpr.cpp lib/Parse/ParseExprCXX.cpp lib/Parse/ParseTentative.cpp test/Parser/MicrosoftExtensions.cp

Charles Davis cdavis at mymail.mines.edu
Fri Apr 29 08:52:08 PDT 2011


On 4/29/11 2:50 AM, Abramo Bagnara wrote:
> Il 29/04/2011 10:39, Francois Pichet ha scritto:
>> On Fri, Apr 29, 2011 at 4:14 AM, Abramo Bagnara
>> <abramo.bagnara at gmail.com> wrote:
>>> Il 29/04/2011 01:18, John McCall ha scritto:
>>>>
>>>> On Apr 28, 2011, at 4:17 PM, Francois Pichet wrote:
>>>>
>>>>> On Thu, Apr 28, 2011 at 2:11 AM, Abramo Bagnara
>>>>> <abramo.bagnara at gmail.com> wrote:
>>>>>> Il 28/04/2011 03:59, Francois Pichet ha scritto:
>>>>>>> Author: fpichet
>>>>>>> Date: Wed Apr 27 20:59:37 2011
>>>>>>> New Revision: 130369
>>>>>>>
>>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=130369&view=rev
>>>>>>> Log:
>>>>>>> Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin defines to real types.
>>>>>>>
>>>>>>> Otherwise statements like:
>>>>>>>   __int64 var = __int64(0);
>>>>>>>
>>>>>>> would be expanded to:
>>>>>>>   long long var = long long(0);
>>>>>>>
>>>>>>> and fail to compile.
>>>>>>>
>>>>>>> Modified:
>>>>>>>     cfe/trunk/include/clang/Basic/TokenKinds.def
>>>>>>>     cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>>>>>>>     cfe/trunk/lib/Parse/ParseDecl.cpp
>>>>>>>     cfe/trunk/lib/Parse/ParseExpr.cpp
>>>>>>>     cfe/trunk/lib/Parse/ParseExprCXX.cpp
>>>>>>>     cfe/trunk/lib/Parse/ParseTentative.cpp
>>>>>>>     cfe/trunk/test/Parser/MicrosoftExtensions.cpp
>>>>>>>     cfe/trunk/test/Preprocessor/init.c
>>>>>>>
>>>>>>> Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
>>>>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=130369&r1=130368&r2=130369&view=diff
>>>>>>> ==============================================================================
>>>>>>> --- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
>>>>>>> +++ cfe/trunk/include/clang/Basic/TokenKinds.def Wed Apr 27 20:59:37 2011
>>>>>>> @@ -450,6 +450,10 @@
>>>>>>>  KEYWORD(__except                  , KEYMS | KEYBORLAND)
>>>>>>>  KEYWORD(__finally                 , KEYMS | KEYBORLAND)
>>>>>>>  KEYWORD(__leave                   , KEYMS | KEYBORLAND)
>>>>>>> +KEYWORD(__int64                   , KEYMS)
>>>>>>> +ALIAS("__int8"       , char       , KEYMS)
>>>>>>> +ALIAS("__int16"      , short      , KEYMS)
>>>>>>> +ALIAS("__int32"      , int        , KEYMS)
>>>>>>
>>>>>> IMO it is better to handle this as a target dependent typedef (just like
>>>>>> __builtin_va_list). This would fix also following problem reported by
>>>>>> Charles and name mangling issues:
>>>>>>
>>>>>
>>>>> I think keyword+alias is fine but I am not opposed to changing to
>>>>> built-in typedef. You can make the change if you really care about it.
>>>>
>>>> If you can really write "unsigned __int8", then it has to be a keyword.  Well, unless there's some ludicrous MS extension to modify typedefs.
>>>
>>> If it is indeed possibile to write "long __int32" as we'd permit now, it
>>> is definitely a real mess.
>>
>> Why exactly? I don't see any mess there. __int32 is just an alias for int.
>> so "long __int32" is just equivalent to "long int"
>>
>>
>>> I believe that to have it as a keyword it is a very bad thing...
>>> Francois, what's the effect to write "long long __int32" in MSVC?
>>>
>>
>> "long long __int32" will declare a 8 byte int as in "long long int"
>> how is that bad?
> 
> It is a conceptual mess, but if MSVC accept it I've no problems ;-)
Yep, MSVC takes long __int32 and long long __int32.

Chip



More information about the cfe-commits mailing list