capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.61k stars 1.56k forks source link

Fix cstool Makefile for non-C99-defaulting compilers #2315

Closed thestr4ng3r closed 7 months ago

thestr4ng3r commented 7 months ago

Your checklist for this pull request

Detailed description

C99 is necessary for some for(unsigned i; ... loops. Just like in the root Makefile, we enforce it using -std=gnu99.

...
  CC      cstool_hppa.o
cstool_hppa.c: In function 'print_insn_detail_hppa':
cstool_hppa.c:20: error: 'for' loop initial declaration used outside C99 mode
cstool_hppa.c:73: error: 'for' loop initial declaration used outside C99 mode
cstool_hppa.c:81: error: 'for' loop initial declaration used outside C99 mode
make[1]: *** [cstool_hppa.o] Error 1
make: *** [all] Error 2
imac:capstone florian$ cc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Test plan

Build with make and a compiler that does not default to >= C99 when passed no arguments.