Skip to content

Commit

Permalink
fix: silence some warnings from some versions of ICX
Browse files Browse the repository at this point in the history
There is a -Wpre-c11-compat warning in 2024.2 (latest version at time
of writing) which is emitted when icx sees a _Noreturn keyword, or
calls _Static_assert.  It's not a default, and really only a problem
because I'm trying to support compiling with -Weverything without any
warnings.

This just tweaks a couple of macros (HEDLEY_NO_RETURN and
HEDLEY_STATIC_ASSERT) to wrap the output in pragmas to temporarily
disable the warning.
  • Loading branch information
nemequ committed Sep 20, 2024
1 parent 5e4f3ae commit e2be75f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions hedley.h
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,15 @@
HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
# define HEDLEY_NO_RETURN __attribute__((__noreturn__))
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
# define HEDLEY_NO_RETURN _Noreturn
# if HEDLEY_HAS_WARNING("-Wpre-c11-compat")
# define HEDLEY_NO_RETURN \
HEDLEY_DIAGNOSTIC_PUSH \
_Pragma("clang diagnostic ignored \"-Wpre-c11-compat\"") \
_Noreturn \
HEDLEY_DIAGNOSTIC_POP
# else
# define HEDLEY_NO_RETURN _Noreturn
# endif
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
# define HEDLEY_NO_RETURN HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]])
#elif \
Expand Down Expand Up @@ -1910,7 +1918,15 @@ HEDLEY_DIAGNOSTIC_POP
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
defined(_Static_assert) \
)
# define HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
# if HEDLEY_HAS_WARNING("-Wpre-c11-compat")
# define HEDLEY_STATIC_ASSERT(expr, message) \
HEDLEY_DIAGNOSTIC_PUSH \
_Pragma("clang diagnostic ignored \"-Wpre-c11-compat\"") \
_Static_assert(expr, message) \
HEDLEY_DIAGNOSTIC_POP
# else
# define HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
# endif
#elif \
(defined(__cplusplus) && (__cplusplus >= 201103L)) || \
HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \
Expand Down

0 comments on commit e2be75f

Please sign in to comment.