Windows-on-ARM-Experiments / mingw-woarm64-build

Workflows and build scripts for Windows on Arm64 GNU cross-compiler for `aarch64-w64-mingw32` target.
GNU General Public License v2.0
33 stars 4 forks source link

MinGW header `error: expected ';' before 'void'` issue with `-std=c89` #200

Open carlo-bramini opened 2 months ago

carlo-bramini commented 2 months ago

Create a simple C file and put something for including _mingw.h, for example:

#include <stdio.h>

Next, save this single-line source file with a name, for example test.c. Finally, try to compile it with the cross compiler with this line:

aarch64-w64-mingw32-gcc -c test.c -o test.o -std=c89

This test will print this error message on the console:

/usr/aarch64-w64-mingw32/sys-root/mingw/include/_mingw.h:610:25: error: expected ';' before 'void'
  610 | __MINGW_FASTFAIL_INLINE void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int code)
      |                         ^~~~

The key of the problem is the -std=c89 option to GCC, which makes the inline keyword to be not recognized. Only aarch64-w64-mingw32 is affected, i686-w64-mingw32 and x86_64-w64-mingw32 compiles without troubles, even when -std=c89 is included. The problem happens when you try to compile libopusfile because its configure script adds this option to the command line.

Blackhex commented 2 months ago

Thank you for the report. So far we've not been focusing on handling/testing all the possible C standard options so it's great that you've tried that. Let me try to reproduce and investigate this issue more...