[LLVMbugs] [Bug 14040] New: Formatting difference between `clang++ --version` and macro, __clang_version__
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Sun Oct  7 20:07:23 PDT 2012
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=14040
             Bug #: 14040
           Summary: Formatting difference between `clang++ --version` and
                    macro, __clang_version__
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: garofgc at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified
The version, as reported by the command `clang++ --version`, is formatted such
that the revision is parenthesized.
   e.g., "clang version 3.2 (trunk 164372)"
The version, as stored in the macro, __clang_version__, according to the
command `clang++ -dM -E -x c /dev/null | grep __clang_version__`, is formatted
such that the revision is double-parenthesized.
   e.g., "3.2 ((trunk 164372))"
They should be defined such that the latter is a substring of the former so the
following pseudocode can be used to identify an exact compiler match:
   if (!!strstr(`clang++ --version`, __clang_version__)) {/* match found */}
Otherwise, one must write special-case code that makes assumptions about the
string format, parses the string, and performs sub-matching. 
It is also inconsistent with the behavior of other compilers, e.g., GCC and
MSVC.  
   `gcc -dM -E -x c /dev/null | grep __VERSION__` is a substring of the output
from `g++ --version`
   The stringized _MSC_FULL_VER macro is a substring of the output from
`cl.exe`
-- 
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