Skip to content

Commit 505c2d1

Browse files
byrootnobu
authored andcommitted
Don't use _Atomic in C99 mode
``` /github/workspace/src/ext/digest/blake3/blake3_dispatch.c:108:5: error: '_Atomic' is a C11 extension [-Werror,-Wc11-extensions] 108 | ATOMIC_INT g_cpu_features = UNDEFINED; | ^ /github/workspace/src/ext/digest/blake3/blake3_dispatch.c:34:20: note: expanded from macro 'ATOMIC_INT' 34 | #define ATOMIC_INT _Atomic int | ^ 1 error generated. ```
1 parent 49e1637 commit 505c2d1

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

ext/digest/blake3/extconf.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ def blake3_have_isa?(name, flag, snippet)
7878

7979
have_header("sys/cdefs.h")
8080

81+
checking_for("C11 atomics") do
82+
ok = try_compile(<<~C)
83+
static _Atomic int atomic_int = 0;
84+
static int t(void) {return atomic_int;}
85+
#{MAIN_DOES_NOTHING 't'}
86+
C
87+
unless ok
88+
$defs << "-DBLAKE3_ATOMICS=0"
89+
end
90+
ok
91+
end
92+
8193
$preload = %w[digest]
8294

8395
create_makefile("digest/blake3")

0 commit comments

Comments
 (0)