[LLVMbugs] [Bug 6681] New: __VERSION__ is missing clang/LLVM version information, __clang__ and __llvm_ have no useful number

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 22 20:44:46 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6681

           Summary: __VERSION__ is missing clang/LLVM version information,
                    __clang__ and __llvm_ have no useful number
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Headers
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: c-d.hailfinger.devel.2006 at gmx.net
                CC: llvmbugs at cs.uiuc.edu


__VERSION__ has no information about the clang/LLVM version at all and contains
a fake GCC version string instead.
#define __VERSION__ "4.2.1 Compatible Clang Compiler"

Besides that, there is no useful __CLANG__ or __CLANG_MINOR__ or __LLVM__ or
__LLVM_MINOR__ #define which could be used to test for a recent clang/LLVM.

This makes it impossible to check for a non-broken LLVM/clang version inside C
code.

I can understand faking some numerical values which are used for GCC
compatibility like
#define __GNUC__ 4
#define __GNUC_MINOR__ 2
#define __GNUC_PATCHLEVEL__ 1

Faking GCC version numbers doesn't eliminate the need for such version number
values for LLVM/clang, though.

Besides that, I'm unaware of any software which would be broken by clang/llvm
version numbers in the __VERSION__ string which isn't usable for any
checks/comparisons by the C preprocessor, and I strongly doubt that someone is
actually parsing the __VERSION__ string instead of testing __GNUC__ and
__GNUC_MINOR__. Having a meaningful __VERSION__ string would be appreciated for
easier printing.


Right now clang miscompiles coreboot, and older clang miscompiled flashrom.
With either software a miscompile means that you probably have to use a
soldering iron to recover your mainboard, and I'd really love to replace
#if __clang__
#error Some versions of clang are broken, no way to test for them
#endif
with something a bit more useful.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list