scons: More narrowly target -Wno-self-assign.

This flag was necessary because of self assignments in the ISA parser
where self assignments are often hints to the parser itself, and in one
case because a pybind-ism used to attach the -= operator looked like a
self assignment.

This change narrows the scope of the flag that disables this warning to
only files generated by the ISA parser, and the single file in the
systemc code which uses that operator overload.

Change-Id: Ib64fc72e46f894cba9064afcdbdcc5859c30e745
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40952
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-02-07 22:32:08 -08:00
parent 64d71220d1
commit c017caad88
3 changed files with 10 additions and 6 deletions

View File

@@ -375,10 +375,8 @@ elif main['CLANG']:
'Installed version:', main['CXXVERSION'])
# clang has a few additional warnings that we disable, extraneous
# parantheses are allowed due to Ruby's printing of the AST,
# finally self assignments are allowed as the generated CPU code
# is relying on this
main.Append(CCFLAGS=['-Wno-parentheses', '-Wno-self-assign'])
# parantheses are allowed due to Ruby's printing of the AST.
main.Append(CCFLAGS=['-Wno-parentheses'])
conf.CheckCxxFlag('-Wno-c99-designator')
conf.CheckCxxFlag('-Wno-defaulted-function-deleted')

View File

@@ -191,7 +191,10 @@ def ISADesc(desc, decoder_splits=1, exec_splits=1):
# These generated files are also top level sources.
def source_gen(name):
add_gen(name)
Source(gen_file(name))
append = {}
if env['CLANG']:
append['CCFLAGS'] = ['-Wno-self-assign']
Source(gen_file(name), append=append)
source_gen('decoder.cc')

View File

@@ -62,4 +62,7 @@ if env['USE_SYSTEMC']:
if env['USE_PYTHON']:
Source('python.cc')
Source('sc_main_python.cc')
Source('sc_time_python.cc')
append = {}
if env['CLANG']:
append['CCFLAGS'] = '-Wno-self-assign-overloaded'
Source('sc_time_python.cc', append=append)