On 2023/06/20 20:14, lijiang wrote:
>>>> +#define for_each_mod_mem_type(type) \
>>>> + for (int (type) = MOD_TEXT; (type) < MOD_MEM_NUM_TYPES;
> (type)++)
>
> I found that this cannot build with an old gcc, e.g. on RHEL7.
> Please note that -std=gnu99 or later is required for such a gcc.
>
> $ gcc --version
> gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
> ...
> $ make -j 16 warn CFLAGS='-std=gnu99'
> ...
> ar: creating crashlib.a
> CXXLD gdb
> $ make clean
> ...
> $ make -j 16 warn
> ...
> In file included from symbols.c:18:0:
> symbols.c: In function 'module_symbol_dump':
> defs.h:3007:2: error: 'for' loop initial declarations are only allowed
> in C99 mode
> for (int (type) = MOD_TEXT; (type) < MOD_MEM_NUM_TYPES; (type)++)
> ^
> symbols.c:1352:3: note: in expansion of macro 'for_each_mod_mem_type'
> for_each_mod_mem_type(t) {
> ^
> defs.h:3007:2: note: use option -std=c99 or -std=gnu99 to compile your code
> for (int (type) = MOD_TEXT; (type) < MOD_MEM_NUM_TYPES; (type)++)
> ^
> symbols.c:1352:3: note: in expansion of macro 'for_each_mod_mem_type'
> for_each_mod_mem_type(t) {
> ^
>
It should be good to define the above macro like this:
hmm, I didn't think we had to fix it, but ok, will fix it..
Thanks,
Kazu