[PATCHv2 wayland 0/8] wayland-scanner: produce code with c99 initializers

Emil Velikov emil.l.velikov at gmail.com
Wed Jun 20 10:56:22 UTC 2018


On 20 June 2018 at 11:23, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Tue, 19 Jun 2018 17:43:47 +0100
> Emil Velikov <emil.l.velikov at gmail.com> wrote:
>
>> On 18 June 2018 at 11:36, Pekka Paalanen <ppaalanen at gmail.com> wrote:
>> > On Thu, 14 Jun 2018 16:49:37 +0100
>> > Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> >
>> >> Hi all,
>> >>
>> >> Here's a take v2 of the series, with the following changes:
>> >>  - don't trim trailing NULL entries from the wl_interfaces* array
>> >>  - updated tests - separate patches to ease review, to be squashed
>> >>
>> >> On the question of why, despite the aesthetics these patches make the
>> >> generated files actually understandable by a human being...
>> >
>> > Hi Emil,
>> >
>> > on the previous round, this concern was raised:
>> >
>> Thanks, did not spot that one.
>>
>>
>> > On Tue, 13 Feb 2018 13:36:06 +0000
>> > Daniel Stone <daniel at fooishbar.org> wrote:
>> >
>> >> But that being said, my worry is that we don't actually control the
>> >> compilation environment for the scanner output. Scanner output
>> >> currently compiles with '-pedantic -ansi -Wall -Wextra' (at least,
>> >> when inline is defined). This patch changes that requirement, and I
>> >> worry that - like previous discussions on changing scanner output -
>> >> that upgrading Wayland would lead to people hitting compilation
>> >> failures.
>> >
>> > What is your rationale for that being a non-issue?
>> >
>> According to [1] GCC has supported designated initializers since v3.0,
>> released some 17 years ago [2].
>> Clang has supported them from a very early age. On the Windows front
>> MSVC 2013 introduced support and it EOL.
>>
>> Other less common compilers (say the Sun/Oracle or Intel ones) are
>> fine as well - although I cannot give you exact details.
>>
>> In other words unless someone does one of the following two they're
>> perfectly fine.
>>  - uses unsupported (ancient?) compiler, or
>>  - explicitly sets -pedantic -ansi _and_ -Werror
>>
>> In the case they do, they should seriously reconsider what they're
>> inflicting on themselves.
>> Both from functionality and security POV.
>
> Ok. So '-pedantic -ansi' will still compile, even if with warnings?
> Ansi being equivalent to -std=c90 it seems.
>
You can easily check that with something like the following.

cd $wayland-repo
apply patches
cd tests/data
echo "#include "small-server.h" >> ff.c
echo "int main(void) { return 0; }" >> ff.c
gcc -pedantic -ansi -Dinline="" -I. example-code.c ff.c
-lwayland-server -o foobar


-Emil


More information about the wayland-devel mailing list