mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
decodetree: Suppress redundant declaration warnings
We can tell that a decodetree input file is "secondary" when it uses an argument set marked "!extern". This indicates that at least one of the insn translation functions will have already been declared by the "primary" input file, but given only the secondary we cannot tell which. Avoid redundant declaration warnings by suppressing them with pragmas. Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
94597b6146
commit
c692079597
@ -33,6 +33,7 @@ arguments = {}
|
|||||||
formats = {}
|
formats = {}
|
||||||
patterns = []
|
patterns = []
|
||||||
allpatterns = []
|
allpatterns = []
|
||||||
|
anyextern = False
|
||||||
|
|
||||||
translate_prefix = 'trans'
|
translate_prefix = 'trans'
|
||||||
translate_scope = 'static '
|
translate_scope = 'static '
|
||||||
@ -482,12 +483,14 @@ def parse_arguments(lineno, name, toks):
|
|||||||
"""Parse one argument set from TOKS at LINENO"""
|
"""Parse one argument set from TOKS at LINENO"""
|
||||||
global arguments
|
global arguments
|
||||||
global re_ident
|
global re_ident
|
||||||
|
global anyextern
|
||||||
|
|
||||||
flds = []
|
flds = []
|
||||||
extern = False
|
extern = False
|
||||||
for t in toks:
|
for t in toks:
|
||||||
if re_fullmatch('!extern', t):
|
if re_fullmatch('!extern', t):
|
||||||
extern = True
|
extern = True
|
||||||
|
anyextern = True
|
||||||
continue
|
continue
|
||||||
if not re_fullmatch(re_ident, t):
|
if not re_fullmatch(re_ident, t):
|
||||||
error(lineno, 'invalid argument set token "{0}"'.format(t))
|
error(lineno, 'invalid argument set token "{0}"'.format(t))
|
||||||
@ -1188,6 +1191,7 @@ def main():
|
|||||||
global insnmask
|
global insnmask
|
||||||
global decode_function
|
global decode_function
|
||||||
global variablewidth
|
global variablewidth
|
||||||
|
global anyextern
|
||||||
|
|
||||||
decode_scope = 'static '
|
decode_scope = 'static '
|
||||||
|
|
||||||
@ -1248,6 +1252,19 @@ def main():
|
|||||||
# A single translate function can be invoked for different patterns.
|
# A single translate function can be invoked for different patterns.
|
||||||
# Make sure that the argument sets are the same, and declare the
|
# Make sure that the argument sets are the same, and declare the
|
||||||
# function only once.
|
# function only once.
|
||||||
|
#
|
||||||
|
# If we're sharing formats, we're likely also sharing trans_* functions,
|
||||||
|
# but we can't tell which ones. Prevent issues from the compiler by
|
||||||
|
# suppressing redundant declaration warnings.
|
||||||
|
if anyextern:
|
||||||
|
output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n",
|
||||||
|
"# pragma GCC diagnostic push\n",
|
||||||
|
"# pragma GCC diagnostic ignored \"-Wredundant-decls\"\n",
|
||||||
|
"# ifdef __clang__\n"
|
||||||
|
"# pragma GCC diagnostic ignored \"-Wtypedef-redefinition\"\n",
|
||||||
|
"# endif\n",
|
||||||
|
"#endif\n\n")
|
||||||
|
|
||||||
out_pats = {}
|
out_pats = {}
|
||||||
for i in allpatterns:
|
for i in allpatterns:
|
||||||
if i.name in out_pats:
|
if i.name in out_pats:
|
||||||
@ -1259,6 +1276,11 @@ def main():
|
|||||||
out_pats[i.name] = i
|
out_pats[i.name] = i
|
||||||
output('\n')
|
output('\n')
|
||||||
|
|
||||||
|
if anyextern:
|
||||||
|
output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n",
|
||||||
|
"# pragma GCC diagnostic pop\n",
|
||||||
|
"#endif\n\n")
|
||||||
|
|
||||||
for n in sorted(formats.keys()):
|
for n in sorted(formats.keys()):
|
||||||
f = formats[n]
|
f = formats[n]
|
||||||
f.output_extract()
|
f.output_extract()
|
||||||
|
Loading…
Reference in New Issue
Block a user