Failure to compile with gcc 4.8

Simon Marchi simon.marchi@polymtl.ca
Thu Apr 29 20:19:42 GMT 2021


Hi,

I tried building the repo with gcc 4.8 and got:

    /home/smarchi/src/binutils-gdb/opcodes/ppc-dis.c: In function ‘print_insn_powerpc’:
    /home/smarchi/src/binutils-gdb/opcodes/ppc-dis.c:1071:8: error: ‘for’ loop initial declarations are only allowed in C99 mode
            for (int i = 0; i < 2; i++)
            ^
    /home/smarchi/src/binutils-gdb/opcodes/ppc-dis.c:1071:8: note: use option -std=c99 or -std=gnu99 to compile your code

gcc 4.8 can compile C99, but we need to give it -std=c99 or -std=gnu99.

Should we add this (and to other sub-directories too)?

diff --git a/opcodes/configure.ac b/opcodes/configure.ac
index 911c9c6f082..3e79d38971f 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -26,6 +26,7 @@ AC_CANONICAL_TARGET
 AM_INIT_AUTOMAKE
 
 AC_PROG_CC
+AC_PROG_CC_C99
 AC_GNU_SOURCE
 AC_USE_SYSTEM_EXTENSIONS

Simon


More information about the Binutils mailing list