mirror of
https://github.com/libretro/virtualjaguar-libretro.git
synced 2026-11-07 04:36:00 -10:00
build(libchdr): guard the pragma with __has_warning
Copilot review on #797: a clang without -Wtypedef-redefinition would warn about the unknown option in the pragma itself. Test __has_warning in its own #if (a preprocessor without it would choke on the call even behind &&). iOS build still 0 warnings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
3cf7c31e2c
commit
896772cf95
1 file changed
+11
-3
Vendored
+11
-3
@@ -35,14 +35,22 @@
|
||||
/* LZMA's 7zTypes.h and miniz.h both `typedef unsigned char Byte;`. The
|
||||
* two are identical (legal C11), but clang warns under -std=c99
|
||||
* (-Wtypedef-redefinition). Silenced here rather than by editing the
|
||||
* vendored headers; GCC does not raise it. */
|
||||
#if defined(__clang__)
|
||||
* vendored headers; GCC does not raise it. `__has_warning` is tested in
|
||||
* its own #if: a preprocessor without it would choke on the call even
|
||||
* behind a short-circuiting `&&`. */
|
||||
#if defined(__clang__) && defined(__has_warning)
|
||||
# if __has_warning("-Wtypedef-redefinition")
|
||||
# define VJ_LIBCHDR_SILENCE_TYPEDEF_REDEF 1
|
||||
# endif
|
||||
#endif
|
||||
#ifdef VJ_LIBCHDR_SILENCE_TYPEDEF_REDEF
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtypedef-redefinition"
|
||||
#endif
|
||||
#include "deps/miniz-3.1.1/miniz.c"
|
||||
#if defined(__clang__)
|
||||
#ifdef VJ_LIBCHDR_SILENCE_TYPEDEF_REDEF
|
||||
#pragma clang diagnostic pop
|
||||
#undef VJ_LIBCHDR_SILENCE_TYPEDEF_REDEF
|
||||
#endif
|
||||
#include "deps/zstd-1.5.7/zstddeclib.c"
|
||||
|
||||
|
||||
Reference in new issue
Block a user