[gem5-dev] Change in gem5/gem5[develop]: scons: Work around a scons bug when calling TryCompile.

2021-02-13 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41213 )


Change subject: scons: Work around a scons bug when calling TryCompile.
..

scons: Work around a scons bug when calling TryCompile.

When calling TryCompile with an empty string for the source, useful
when just testing a build flag, some versions of SCons will apparently
create some sort of equivalence between Value('') and Value(0). That
shows itself when creating config file headers, where Value(0) is
switched with Value(''), and the header defines a macro with which
expands to nothing rather than a macro which expands to 0. Later uses
of the macro of the form:

 #if CONFIG_VARIABLE

fail because CONFIG_VARIABLE expands to nothing. If it expanded to 0
like it's supposed to, then the guarded block of code would be excluded
correctly.

Change-Id: Ie324ec5f8dd307c65745b9326a11230e10caa0bd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41213
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
Reviewed-by: Gabe Black 
---
M site_scons/gem5_scons/configure.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/site_scons/gem5_scons/configure.py  
b/site_scons/gem5_scons/configure.py

index 7bf97b2..35aa1a9 100644
--- a/site_scons/gem5_scons/configure.py
+++ b/site_scons/gem5_scons/configure.py
@@ -47,7 +47,7 @@
 context.Message("Checking for compiler %s support... " % flag)
 last_cxxflags = context.env['CXXFLAGS']
 context.env.Append(CXXFLAGS=[flag])
-ret = context.TryCompile('', '.cc')
+ret = context.TryCompile('// CheckCxxFlag DO NOTHING', '.cc')
 if not (ret and autoadd):
 context.env['CXXFLAGS'] = last_cxxflags
 context.Result(ret)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41213
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: Ie324ec5f8dd307c65745b9326a11230e10caa0bd
Gerrit-Change-Number: 41213
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: scons: Work around a scons bug when calling TryCompile.

2021-02-11 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41213 )



Change subject: scons: Work around a scons bug when calling TryCompile.
..

scons: Work around a scons bug when calling TryCompile.

When calling TryCompile with an empty string for the source, useful
when just testing a build flag, some versions of SCons will apparently
create some sort of equivalence between Value('') and Value(0). That
shows itself when creating config file headers, where Value(0) is
switched with Value(''), and the header defines a macro with which
expands to nothing rather than a macro which expands to 0. Later uses
of the macro of the form:

 #if CONFIG_VARIABLE

fail because CONFIG_VARIABLE expands to nothing. If it expanded to 0
like it's supposed to, then the guarded block of code would be excluded
correctly.

Change-Id: Ie324ec5f8dd307c65745b9326a11230e10caa0bd
---
M site_scons/gem5_scons/configure.py
1 file changed, 1 insertion(+), 1 deletion(-)



diff --git a/site_scons/gem5_scons/configure.py  
b/site_scons/gem5_scons/configure.py

index 7bf97b2..35aa1a9 100644
--- a/site_scons/gem5_scons/configure.py
+++ b/site_scons/gem5_scons/configure.py
@@ -47,7 +47,7 @@
 context.Message("Checking for compiler %s support... " % flag)
 last_cxxflags = context.env['CXXFLAGS']
 context.env.Append(CXXFLAGS=[flag])
-ret = context.TryCompile('', '.cc')
+ret = context.TryCompile('// CheckCxxFlag DO NOTHING', '.cc')
 if not (ret and autoadd):
 context.env['CXXFLAGS'] = last_cxxflags
 context.Result(ret)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41213
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: Ie324ec5f8dd307c65745b9326a11230e10caa0bd
Gerrit-Change-Number: 41213
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-CC: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s