Re: [LTP] [PATCH] config: Explicitly set gnu99

Richard Palethorpe
2022-11-22T08:54:08Z

Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> Hi!
>> > I woder if this would work with different compilers. I suppose clang
>> > does work, but what about icc?
>>
>> Clang is fine. I doubt that icc compiles LTP at present unless it does
>> support GNU extensions.
>
> Fair enough.
>
>> > I supose that we get tons of 'can't do pointer arithmetics on void*
>> > pointers and stuff' with plain c99. Maybe it would be better to clean
>> > these out instead.
>>
>> https://github.com/richiejp/ltp/actions/runs/3515165803/jobs/5890081736
>>
>> Some of this is solved by -D_XOPEN_SOURCE=700 or some other macro (we
>> need multiple). However it doesn't end there:
>>
>> make STDCFLAGS='-std=c2x -D_XOPEN_SOURCE=700'
>> make -C "lib" \
>> -f "/home/rich/qa/ltp/lib/Makefile" all
>> make[1]: Entering directory '/home/rich/qa/ltp/lib'
>> In file included from ../include/old/test.h:37,
>> from get_path.c:41:
>> get_path.c: In function ‘tst_get_path’:
>> ../include/tst_minmax.h:10:9: warning: implicit declaration of function ‘typeof’ [-Wimplicit-function-declaration]
>> 10 | typeof(a) _a = (a); \
>> | ^~~~~~
>
>
> Hmm that's strange, supposedly typeof() is finally standartized in c2x,
> but it would be obviously missing from anything older.
>
>> We probably also use 'x ?: y' and stuff like that.
>>
>> So this opens up a rats nest basically.
>
> Sigh, well LTP was never a nice codebase, at least it compiles most of
> the time these days.

Using whatever language features seem reasonable and adding compilation
targets to the CI seems like the best way to go IMO.

--
Thank you,
Richard.