Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/45759 )

Change subject: Example of how to check if code is legal with scons.
......................................................................

Example of how to check if code is legal with scons.

Change-Id: I7d69f364b72859a6f00c29deda95c53f80089c4d
---
M src/base/SConsopts
M src/base/compiler.hh
2 files changed, 14 insertions(+), 1 deletion(-)



diff --git a/src/base/SConsopts b/src/base/SConsopts
index 9b301c3..2fd2113 100644
--- a/src/base/SConsopts
+++ b/src/base/SConsopts
@@ -56,10 +56,16 @@
     # alternative stacks.
     conf.env['HAVE_VALGRIND'] = conf.CheckCHeader('valgrind/valgrind.h')

+    conf.env['HAVE_DEPRECATED_NAMESPACE'] = conf.TryCompile('''
+        int main() {return 0;}
+        namespace [[deprecated]] test_namespace {}
+    ''', '.cc')
+

 sticky_vars.Add(BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks',
                              have_posix_clock))


 export_vars.extend([
-        'HAVE_FENV', 'HAVE_PNG', 'USE_POSIX_CLOCK', 'HAVE_VALGRIND'])
+        'HAVE_FENV', 'HAVE_PNG', 'USE_POSIX_CLOCK', 'HAVE_VALGRIND',
+        'HAVE_DEPRECATED_NAMESPACE'])
diff --git a/src/base/compiler.hh b/src/base/compiler.hh
index 4ea0dbb..76829a0 100644
--- a/src/base/compiler.hh
+++ b/src/base/compiler.hh
@@ -43,8 +43,15 @@

 #include <memory>

+#include "config/have_deprecated_namespace.hh"
+
 // http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

+#if HAVE_DEPRECATED_NAMESPACE
+#error "Has deprecated namespaces"
+#else
+#error "Doesn't have deprecated namespaces"
+#endif

 /*
  * Attributes that become standard in later versions of c++.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45759
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: I7d69f364b72859a6f00c29deda95c53f80089c4d
Gerrit-Change-Number: 45759
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[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