[cfe-dev] Warning, possible error, in name mangling

Anders Carlsson andersca at mac.com
Sat Jun 13 14:30:28 PDT 2009


13 jun 2009 kl. 14.23 skrev Chris Lattner:

>
> On Jun 13, 2009, at 4:33 AM, AlisdairM(public) wrote:
>
>> As I'm compiling with MSVC I am possibly seeing a different set of  
>> warning
>> to the majority.
>>
>> As a starter, the following if-test gets the warning:
>>
>> warning C4806: '==' : unsafe operation: no value of type 'bool'  
>> promoted to
>> type 'clang::SrcMgr::CharacteristicKind' can equal the given  
>> constant	
>
> This definitely looks like a bug.  Anders, this was introduced in  
> r72671, what do you think?
>
> -Chris
>

Yup, looks like a bug to me!

Anders

>>
>> ...\llvm\tools\clang\lib\CodeGen\Mangle.cpp line 99
>>
>>
>> The code in question:
>>
>> } else if (// C functions are not mangled
>>            !Context.getLangOptions().CPlusPlus ||
>>            // "main" is not mangled in C++
>>            FD->isMain() ||
>>            // No mangling in an "implicit extern C" header.
>>            (FD->getLocation().isValid() &&
>>
>> Context.getSourceManager().getFileCharacteristic(FD->getLocation()))
>>              == SrcMgr::C_ExternCSystem ||
>>            // No name mangling in a C linkage specification.
>>            isInCLinkageSpecification(FD))
>>   return false;
>>
>>
>>
>> It looks to my untrained eye that the following extract has a  
>> misplaced
>> close-paren:
>>
>>            (FD->getLocation().isValid() &&
>>
>> Context.getSourceManager().getFileCharacteristic(FD->getLocation()))
>>              == SrcMgr::C_ExternCSystem ||
>>
>> Which I *think* should be
>>
>>            (FD->getLocation().isValid() &&
>>
>> Context.getSourceManager().getFileCharacteristic(FD->getLocation())
>>              == SrcMgr::C_ExternCSystem) ||
>>
>> but that is reading between the lineds of what identifiers are  
>> likely to
>> mean without understanding the code.
>>
>> Should I open a bug report, or is this simply noise?
>>
>> Note that I'm not in a position to produce a test case as I'm  
>> acting purely
>> on source code warnings without understanding the actual  
>> functionality -
>> hence the danger of a false positive.
>>
>> [Note this warning is actually the least of my worries but easiest  
>> to report
>> - most of the noise is ~5000 operator-new overloaded without matching
>> operator delete overload, which I am hope to investigate properly]
>>
>> AlisdairM
>>
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list