Skip to content

Commit ea8db45

Browse files
authored
Merge pull request #20894 from JuliaLang/yyc/static-assert
Move `static_assert` to `julia_internal.h`
2 parents 97c40ed + f92f6ad commit ea8db45

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

src/codegen.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ PassManager *jl_globalPM;
137137
#define AddrSpaceCastInst BitCastInst
138138
#endif
139139

140-
#if !defined(_COMPILER_MICROSOFT_) && __cplusplus < 201103L && !defined(static_assert)
141-
# define static_assert(...)
142-
#endif
143-
144140
extern "C" {
145141

146142
#include "builtin_proto.h"

src/jl_uv.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,6 @@
2828
#define write _write
2929
#endif
3030

31-
#ifndef static_assert
32-
# ifndef __cplusplus
33-
# define static_assert(...)
34-
// Remove the following gcc special handling when we officially requires
35-
// gcc 4.7 (for c++11) and -std=gnu11
36-
# ifdef __GNUC__
37-
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
38-
# undef static_assert
39-
# define static_assert _Static_assert
40-
# endif
41-
# endif
42-
# endif
43-
#endif
44-
4531
#ifdef __cplusplus
4632
#include <cstring>
4733
extern "C" {

src/julia_internal.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@
2626
#endif
2727
#endif
2828

29+
// Remove when C11 is required for C code.
30+
#ifndef static_assert
31+
# ifndef __cplusplus
32+
// C11 should already have `static_assert` from `<assert.h>` so there's no need
33+
// to check C version.
34+
# ifdef __GNUC__
35+
# define static_assert _Static_assert
36+
# else
37+
# define static_assert(...)
38+
# endif
39+
# endif
40+
// For C++, C++11 or MSVC is required. Both provide `static_assert`.
41+
#endif
42+
2943
#ifdef __cplusplus
3044
extern "C" {
3145
#endif

0 commit comments

Comments
 (0)