Skip to content

Commit

Permalink
cdefs.h: Don't define fallback for _Static_assert
Browse files Browse the repository at this point in the history
Remove pre 4.6 code to define _Static_assert in terms of _COUNTER.  We
no longer need to support compilers this old (in fact support for all
pre gcc 10 compilers has been removed in -current). This is a partial
MFC of that work because removing this fixes a bug that's oft reported
with -pedantic-errors and C++98 compilations.

PR: 280382, 276738
Sponsored by:		Netflix

This is a direct commit to stable/14.

(cherry picked from commit 22cdafe)
  • Loading branch information
bsdimp committed Jul 20, 2024
1 parent 9fd9ba3 commit d3de5c5
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions sys/sys/cdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,6 @@
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_static_assert)
#define _Static_assert(x, y) static_assert(x, y)
#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
#elif defined(__COUNTER__)
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
#define __Static_assert(x, y) ___Static_assert(x, y)
#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
__unused
#else
#define _Static_assert(x, y) struct __hack
#endif
#endif

Expand Down

0 comments on commit d3de5c5

Please sign in to comment.