]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - sim/Makefile.in
sim: cris: disable -Wshadow=local in generated mloop files
authorMike Frysinger <vapier@gentoo.org>
Sat, 23 Dec 2023 04:17:45 +0000 (23:17 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 23 Dec 2023 04:29:19 +0000 (23:29 -0500)
commit87271996ea9a36a5235ea7ff0de6eb6be13cc869
tree5034a8d18fad21aeeff986befc4d0ed9b114abed
parentc99faa9291f4193fa96f1fd9a8857b3925165676
sim: cris: disable -Wshadow=local in generated mloop files

The mloop files include CGEN generated switch files which have some
nested assignments that expand into repeated shadowed variables.
Fixing this looks fairly non-trivial as it appears to be interplay
between the common CGEN code and how this particular set of cris
insns are defined.  Disable the warning instead.

In file included from sim/cris/mloop.in:286:
sim/cris/semcrisv10f-switch.c: In function ‘crisv10f_engine_run_full’:
sim/cris/semcrisv10f-switch.c:12383:8: error: declaration of ‘opval’ shadows a previous local [-Werror=shadow=local]
12383 |     SI opval = tmp_addr;
      |        ^~~~~
sim/cris/semcrisv10f-switch.c:12371:9: note: shadowed declaration is here
12371 |     USI opval = ({   SI tmp_addr;
      |         ^~~~~

And the code looks like:
USI opval = ({
...
{
SI opval = tmp_addr;
...
}
...
});

Since the CGEN code treats "opval" as an internal variable that the cpu
definitions don't have direct access to, the likelihood of this being a
real bug is low, so leave it be.  The warning is suppressed for more code
that is hand written (e.g. the mloop logic), but disabling for the entire
file is the easiest way to suppress while keeping it on everywhere else in
the sim.
sim/Makefile.in
sim/cris/local.mk