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

AlisdairM(public) public at alisdairm.net
Sat Jun 13 04:33:34 PDT 2009


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	

...\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






More information about the cfe-dev mailing list