Util: Add and use ATTRIBUTE_NONSTRING to fix warnings

This commit is contained in:
Vicki Pfau 2025-05-02 04:30:12 -07:00
parent 1c6514bfb7
commit c4ae9015d9
3 changed files with 8 additions and 2 deletions

View File

@ -265,6 +265,7 @@ typedef intptr_t ssize_t;
#define ATTRIBUTE_UNUSED
#define ATTRIBUTE_FORMAT(X, Y, Z)
#define ATTRIBUTE_NOINLINE
#define ATTRIBUTE_NONSTRING
// Adapted from https://stackoverflow.com/a/2390626
#define _CONSTRUCTOR(FN, PRE) \
static void FN(void); \
@ -279,6 +280,11 @@ typedef intptr_t ssize_t;
#define ATTRIBUTE_UNUSED __attribute__((unused))
#define ATTRIBUTE_FORMAT(X, Y, Z) __attribute__((format(X, Y, Z)))
#define ATTRIBUTE_NOINLINE __attribute__((noinline))
#if defined(__llvm__) || (__GNUC__ < 8)
#define ATTRIBUTE_NONSTRING
#else
#define ATTRIBUTE_NONSTRING __attribute__((nonstring))
#endif
#define CONSTRUCTOR(FN) static __attribute__((constructor)) void FN(void)
#endif

View File

@ -87,7 +87,7 @@ enum {
};
struct GBACartridgeOverride {
char id[4];
char id[4] ATTRIBUTE_NONSTRING;
enum GBASavedataType savetype;
int hardware;
uint32_t idleLoop;

View File

@ -16,7 +16,7 @@
struct GBXParams {
uint32_t major;
uint32_t minor;
char fourcc[4];
char fourcc[4] ATTRIBUTE_NONSTRING;
bool battery;
bool rumble;
bool timer;