diff options
| author | Nicolas Pomarède <npomarede@corp.free.fr> | 2024-04-13 20:53:59 (GMT) |
|---|---|---|
| committer | Nicolas Pomarède <npomarede@corp.free.fr> | 2024-04-13 20:53:59 (GMT) |
| commit | 943006bc662e8ad7a0b364ff3b91907f40523303 (patch) | |
| tree | 1c0c0ee2634ddb02fe3db02ad9009730aad5e568 | |
| parent | f023a931517b1a90fff93d46cb907b72d985d0ce (diff) | |
| download | hatari-943006bc662e8ad7a0b364ff3b91907f40523303.zip hatari-943006bc662e8ad7a0b364ff3b91907f40523303.tar.gz | |
Prevent defining conflicting enum named 'bits' when including readcpu.h outside of cpu/ dir
GCC 14 reports a warning when using a variable named 'bits', for example :
src/hatari.git/src/scc.c: In function 'SCC_Update_RR0_Clear':
src/hatari.git/src/scc.c:1355:58: warning: declaration of 'bits' shadows a previous local [-Wshadow=local]
1355 | static void SCC_Update_RR0_Clear ( int Channel , int bits )
| ~~~~^~~~
In file included from src/hatari.git/src/cpu/newcpu.h:13,
from src/hatari.git/src/includes/m68000.h:25,
from src/hatari.git/src/scc.c:92:
src/hatari.git/src/cpu/readcpu.h:83:5: note: shadowed declaration is here
83 | bits, bitS, bitd, bitD, bitr, bitR, bitz, bitE, bitp, lastbit
This is because readcpu.h is defining some enum's and one of them is 'bits'
As those enum's are only needed in the cpu core part, we disable them when
including readcpu.h (through newcpu.h) outside of cpu/
| -rw-r--r-- | src/cpu/readcpu.h | 2 | ||||
| -rw-r--r-- | src/includes/m68000.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/cpu/readcpu.h b/src/cpu/readcpu.h index 122556b..2b013e6 100644 --- a/src/cpu/readcpu.h +++ b/src/cpu/readcpu.h @@ -78,10 +78,12 @@ ENUMDECL { #endif } ENUMNAME (cflow_t); +#ifndef HATARI_NO_ENUM_BITVALS ENUMDECL { bit0, bit1, bitc, bitC, bitf, biti, bitI, bitj, bitJ, bitk, bitK, bits, bitS, bitd, bitD, bitr, bitR, bitz, bitE, bitp, lastbit } ENUMNAME (bitvals); +#endif struct instr_def { unsigned int bits; diff --git a/src/includes/m68000.h b/src/includes/m68000.h index b26f6ce..09cd749 100644 --- a/src/includes/m68000.h +++ b/src/includes/m68000.h @@ -22,6 +22,7 @@ #include "cycles.h" /* for nCyclesMainCounter */ #include "sysdeps.h" #include "memory.h" +#define HATARI_NO_ENUM_BITVALS /* Don't define 'bitvals' and 'bits' in newcpu.h / readcpu.h */ #include "newcpu.h" /* for regs */ #include "cycInt.h" #include "log.h" |
