Bobby R. Bruce has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/50028 )

Change subject: scons: fix hook for 'deprecated' attribute
......................................................................

scons: fix hook for 'deprecated' attribute

On the new release, the compilation is polluted by the same warning:
    > ''deprecated' attribute directive ignored

It seems that the hook added in this patch does not work:
https://gem5-review.googlesource.com/c/public/gem5/+/45246/1..7

The snippet of code compile with TryCompile on g++{8,9}.
It probably comes from the fact that the compilation
only creates a warning and not an error.

By adding temporarily '-Werror' for this compilation test,
it filters the faulty gcc versions.

Change-Id: I2b8b7a1a7e06df437b76e98d212947f4f9452311
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48843
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
(cherry picked from commit a366e66272b7c4b01037d68a7723922b49f506cd)
---
M src/base/SConsopts
1 file changed, 11 insertions(+), 2 deletions(-)



diff --git a/src/base/SConsopts b/src/base/SConsopts
index ea11bd4..9fafd64 100644
--- a/src/base/SConsopts
+++ b/src/base/SConsopts
@@ -56,12 +56,21 @@
     # alternative stacks.
     conf.env['HAVE_VALGRIND'] = conf.CheckCHeader('valgrind/valgrind.h')

-    conf.env['HAVE_DEPRECATED_NAMESPACE'] = conf.TryCompile('''
+
+# Check if the compiler supports the [[gnu::deprecated]] attribute
+# Create a temporary environment with -Werror in CCFLAGS
+werror_env = main.Clone()
+werror_env.Append(CCFLAGS=['-Werror'])
+with gem5_scons.Configure(werror_env) as conf:
+
+    # Store result in the main environment
+    main['HAVE_DEPRECATED_NAMESPACE'] = conf.TryCompile('''
         int main() {return 0;}
         namespace [[gnu::deprecated("Test namespace deprecation")]]
         test_deprecated_namespace {}
     ''', '.cc')
-    if not conf.env['HAVE_DEPRECATED_NAMESPACE']:
+
+    if not main['HAVE_DEPRECATED_NAMESPACE']:
warning("Deprecated namespaces are not supported by this compiler.\n" "Please make sure to check the mailing list for deprecation "
                 "announcements.")

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/50028
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: hotfix-deprecated-namespace
Gerrit-Change-Id: I2b8b7a1a7e06df437b76e98d212947f4f9452311
Gerrit-Change-Number: 50028
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-CC: Tom Rollet <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
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