higan-emu / libco

libco is a cooperative multithreading library written in C89.
Other
125 stars 25 forks source link

libco x86_64 currently doesn't build in ANSI C89 mode #22

Closed Screwtapello closed 3 years ago

Screwtapello commented 3 years ago

Using clang++-9.0.1 on Debian:

$ clang++ -x c -std=c89 libco.c
In file included from libco.c:13:
./amd64.c:14:11: error: expected parameter declarator
  alignas(4096)
          ^
./amd64.c:14:11: error: expected ')'
./amd64.c:14:10: note: to match this '('
  alignas(4096)
         ^
./amd64.c:14:3: warning: declaration specifier missing, defaulting to 'int'
  alignas(4096)
  ^
  int
./amd64.c:14:16: error: expected ';' after top level declarator
  alignas(4096)
               ^
               ;
1 warning and 3 errors generated.

g++-10.2.0 works fine.

Building in C99 mode works properly for both clang and gcc.

Screwtapello commented 3 years ago

Weirdly, alignas doesn't actually appear in the pre-processed source:

$ clang++ -E -x c -std=c99 libco.c | grep alignas
$

clang, clang-10 and clang++-10 work identically to clang++.

Screwtapello commented 3 years ago

Should be fixed by #23.