c++ compiler version issue

camp0

New Member


Messages: 6

Hi All,

I'm working on a tool that checks the version of the compiler, to be more precise c++. This tool is multi platform and works on Linux also. The questions is that in general gcc have a parameter call -dumpversion that shows the version of the compiler and on freebsd12 and freebsd12 do not match.

Here is some output
Code:
root@:~ # c++ --version
FreeBSD clang version 5.0.0 (tags/RELEASE_500/final 312559) (based on LLVM 5.0.0svn)
Target: x86_64-unknown-freebsd11.1
Thread model: posix
InstalledDir: /usr/bin
root@:~ # c++ -dumpversion
4.2.1

Why is 4.2.1? and the other output says 5.0.0?

Regards,
Luis
 

obsigna

Daemon

Reaction score: 830
Messages: 1,236

The -dumpversion flag shows the GCC compatibility version and this flag seems to be heavily used in those built environments which use the devel/autotools. There was a discussion among the Clang developers about bumping up this version number:

http://lists.llvm.org/pipermail/cfe-dev/2012-May/021389.html

They almost where about changing it to a higher compatibility level, but then an inescapable roadblock was identified:

http://lists.llvm.org/pipermail/cfe-dev/2012-May/021492.html

The bottom line is, that 4.2.1 seems to be the least common denominator with respect to the compatibility of Clang with GCC, and if this number would be changed, a lot of old code could not be built using a simple ./configure; make install clean.

Depending on what version you are looking for, you may want to use the Clang macros for version and feature checking:
Builtin Macros
Feature Checking Macros
 
Top