From fe20f4ada60388ceb65b1a503c132bd0e2326ec5 Mon Sep 17 00:00:00 2001 From: Roger Chang Date: Fri, 20 Oct 2023 11:10:25 +0800 Subject: [PATCH] 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 --- src/base/SConsopts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/base/SConsopts b/src/base/SConsopts index 8e0661203f..68e40587b9 100644 --- a/src/base/SConsopts +++ b/src/base/SConsopts @@ -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"