Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/41596 )

Change subject: scons: Use SCons' built in CXXVERSION instead of detecting our own.
......................................................................

scons: Use SCons' built in CXXVERSION instead of detecting our own.

It's not guaranteed that every compiler will set CXXVERSION, but both
gcc and clang do, and for any check of CXXVERSION to be meaningful, we
have to first check which compiler we're talking about.

Change-Id: Icd15e12832920fec6fa8634bc0fde16cc48e3f41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41596
Tested-by: kokoro <[email protected]>
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M SConstruct
M src/systemc/dt/int/SConscript
2 files changed, 6 insertions(+), 18 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/SConstruct b/SConstruct
index c5dac00..ed27e58 100755
--- a/SConstruct
+++ b/SConstruct
@@ -79,9 +79,6 @@
 import atexit
 import itertools
 import os
-import re
-import shutil
-import subprocess
 import sys

 from os import mkdir, environ
@@ -353,14 +350,11 @@
           "src/SConscript to support that compiler.")))

 if main['GCC']:
- gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
-    if compareVersions(gcc_version, "5") < 0:
+    if compareVersions(main['CXXVERSION'], "5") < 0:
         error('gcc version 5 or newer required.\n'
-              'Installed version:', gcc_version)
+              'Installed version:', main['CXXVERSION'])
         Exit(1)

-    main['GCC_VERSION'] = gcc_version
-
     # Add the appropriate Link-Time Optimization (LTO) flags
     # unless LTO is explicitly turned off.
     if not GetOption('no_lto'):
@@ -387,15 +381,9 @@
                                   '-fno-builtin-realloc', '-fno-builtin-free'])

 elif main['CLANG']:
-    clang_version_re = re.compile(".* version (\d+\.\d+)")
-    clang_version_match = clang_version_re.search(CXX_version)
-    if (clang_version_match):
-        clang_version = clang_version_match.groups()[0]
-        if compareVersions(clang_version, "3.9") < 0:
-            error('clang version 3.9 or newer required.\n'
-                  'Installed version:', clang_version)
-    else:
-        error('Unable to determine clang version.')
+    if compareVersions(main['CXXVERSION'], "3.9") < 0:
+        error('clang version 3.9 or newer required.\n'
+              'Installed version:', main['CXXVERSION'])

     # clang has a few additional warnings that we disable, extraneous
     # parantheses are allowed due to Ruby's printing of the AST,
diff --git a/src/systemc/dt/int/SConscript b/src/systemc/dt/int/SConscript
index 92c0f07..b052f04 100644
--- a/src/systemc/dt/int/SConscript
+++ b/src/systemc/dt/int/SConscript
@@ -28,7 +28,7 @@
 from m5.util import compareVersions

 if env['USE_SYSTEMC']:
-    if main['GCC'] and compareVersions(main['GCC_VERSION'], '10.0') >= 0:
+    if main['GCC'] and compareVersions(main['CXXVERSION'], '10.0') >= 0:
         disable_false_positives = {
             "CCFLAGS": [ "-Wno-array-bounds",
                          "-Wno-stringop-overflow" ]



5 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41596
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Icd15e12832920fec6fa8634bc0fde16cc48e3f41
Gerrit-Change-Number: 41596
Gerrit-PatchSet: 7
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to