mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Rework how we avoid clang's -Wunused-function
The previous technique to avoid this was to have explicit (void)(wuffs_foo__bar_baz); no-op lines of code. However, on MSVC, this triggers warning C4551 "function call missing argument list". https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4551 says that "A function call must include the open and close parentheses". But this is not a function call, it is casting the function pointer. This false positive is a bug in MSVC, but we work around it for Wuffs.
This commit is contained in:
1 parent
0e3d691048
commit
ed52fdecb9
11 files changed
+51
-594
No files matched your search
@@ -30,6 +30,12 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
// GCC does not warn for unused *static inline* functions, but clang does.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -40,9 +46,19 @@ extern "C" {
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
// WUFFS C HEADER ENDS HERE.
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
|
||||
// GCC does not warn for unused *static inline* functions, but clang does.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -105,6 +121,10 @@ const uint64_t wuffs_base__low_bits_mask__u64[65] = {
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
// !! WUFFS MONOLITHIC RELEASE DISCARDS EVERYTHING BELOW.
|
||||
|
||||
Reference in new issue
Block a user