environment: Use GNU defines to get version of c, c++, objc and fortran
According to https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html, the macros used to get the version are always defined for those languages, so use them to get the version.
This commit is contained in:
parent
582e1ede80
commit
1e54a5e73c
|
@ -392,6 +392,7 @@ class Environment():
|
|||
popen_exceptions[compiler] = 'no pre-processor defines'
|
||||
continue
|
||||
gtype = self.get_gnu_compiler_type(defines)
|
||||
version = self.get_gnu_version_from_defines(defines)
|
||||
return GnuCCompiler(ccache + [compiler], version, gtype, is_cross, exe_wrap, defines)
|
||||
if 'clang' in out:
|
||||
if 'Apple' in out:
|
||||
|
@ -450,6 +451,7 @@ class Environment():
|
|||
popen_exceptions[compiler] = 'no pre-processor defines'
|
||||
continue
|
||||
gtype = self.get_gnu_compiler_type(defines)
|
||||
version = self.get_gnu_version_from_defines(defines)
|
||||
return GnuFortranCompiler([compiler], version, gtype, is_cross, exe_wrap, defines)
|
||||
|
||||
if 'G95' in out:
|
||||
|
@ -531,6 +533,7 @@ class Environment():
|
|||
popen_exceptions[compiler] = 'no pre-processor defines'
|
||||
continue
|
||||
gtype = self.get_gnu_compiler_type(defines)
|
||||
version = self.get_gnu_version_from_defines(defines)
|
||||
return GnuCPPCompiler(ccache + [compiler], version, gtype, is_cross, exe_wrap, defines)
|
||||
if 'clang' in out:
|
||||
if 'Apple' in out:
|
||||
|
@ -570,6 +573,7 @@ class Environment():
|
|||
version = search_version(out)
|
||||
if 'Free Software Foundation' in out:
|
||||
defines = self.get_gnu_compiler_defines(exelist)
|
||||
version = self.get_gnu_version_from_defines(defines)
|
||||
return GnuObjCCompiler(exelist, version, is_cross, exe_wrap, defines)
|
||||
if out.startswith('Apple LLVM'):
|
||||
return ClangObjCCompiler(exelist, version, CLANG_OSX, is_cross, exe_wrap)
|
||||
|
|
Loading…
Reference in New Issue