Why is C90 enforced in KDE?

Nicolás Alvarez nicolas.alvarez at gmail.com
Sun Dec 6 16:41:07 GMT 2015


2015-12-06 12:54 GMT-03:00 Thomas Lübking <thomas.luebking at gmail.com>:
> On Sonntag, 6. Dezember 2015 16:08:04 CEST, Antonio Rojas wrote:
>>
>> C90. Adding -std=c99 to the CFLAGS at compile time doesn't have any
>> effect, since it is overriden by kdelibs (and by extra-cmake-modules in
>> KF5). What is the reason for this?
>
>
> I guess because of poor compiler support.
> One needs MSVC 2013 for at least *some* C99 support :-P
> (2015 should be somewhat complete, though)

I guess -std=c90 is used to make sure nobody accidentally introduces
C99 features that will break in older compilers. However, all
compilers we care about support // comments in C code... I didn't find
any way for gcc to allow // but disallow other C99 features.

Maybe we should use -std=gnuc90 -Wpedantic in gcc instead of -std=c90,
so that GNU extensions (including // comments) are allowed but give
warnings. Then we ignore warnings about // comments and pay attention
to others (in case someone accidentally introduces a GNU extension and
breaks the build in other compilers).

Of course, another way to get what we want is to not use -std=c90, but
have proper CI for MSVC. That way we'll know if someone adds
unsupported C99 features :)

-- 
Nicolás




More information about the kde-core-devel mailing list