scons: Explicit the config option HAVE_DEPRECATED_NAMESPACE type bool

Currently the type of HAVE_DEPRECATED_NAMESPACE is used to detect
if the compiler support gnu::deprecated feature. The return type
of conf.TryCompile is int, but HAVE_DEPRECATED_NAMESPACE is used
as boolean type. The CL is add bool type caster to ensure the type
of it is boolean.

Change-Id: Ife7d9716e485a8be8722d58776f064e7c2268a30
This commit is contained in:
Roger Chang
2023-10-20 11:10:25 +08:00
parent 531067fffa
commit fe20f4ada6

View File

@@ -69,11 +69,13 @@ werror_env.Append(CCFLAGS=['-Werror'])
with gem5_scons.Configure(werror_env) as conf:
# Store result in the main environment
main['CONF']['HAVE_DEPRECATED_NAMESPACE'] = conf.TryCompile('''
int main() {return 0;}
namespace [[gnu::deprecated("Test namespace deprecation")]]
test_deprecated_namespace {}
''', '.cc')
main['CONF']['HAVE_DEPRECATED_NAMESPACE'] = bool(
conf.TryCompile('''
int main() {return 0;}
namespace [[gnu::deprecated("Test namespace deprecation")]]
test_deprecated_namespace {}
''', '.cc')
)
if not main['CONF']['HAVE_DEPRECATED_NAMESPACE']:
warning("Deprecated namespaces are not supported by this compiler.\n"