[PATCH libevdev 3/3] test: add a build test for -pedantic

David Herrmann dh.herrmann at gmail.com
Fri Nov 22 00:05:09 PST 2013


Hi

On Fri, Nov 22, 2013 at 9:01 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> On 22/11/13 16:51 , David Herrmann wrote:
>>
>> Hi Peter
>>
>> On Fri, Nov 22, 2013 at 3:31 AM, Peter Hutterer
>> <peter.hutterer at who-t.net> wrote:
>>>
>>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
>>> ---
>>>   test/.gitignore              | 1 +
>>>   test/Makefile.am             | 5 ++++-
>>>   test/test-compile-pedantic.c | 6 ++++++
>>>   3 files changed, 11 insertions(+), 1 deletion(-)
>>>   create mode 100644 test/test-compile-pedantic.c
>>>
>>> diff --git a/test/.gitignore b/test/.gitignore
>>> index 3117f82..08a722d 100644
>>> --- a/test/.gitignore
>>> +++ b/test/.gitignore
>>> @@ -1,2 +1,3 @@
>>>   gcov-report.txt
>>>   test-libevdev
>>> +test-compile-pedantic
>>> diff --git a/test/Makefile.am b/test/Makefile.am
>>> index a232f86..8cdd370 100644
>>> --- a/test/Makefile.am
>>> +++ b/test/Makefile.am
>>> @@ -1,5 +1,5 @@
>>>   if BUILD_TESTS
>>> -noinst_PROGRAMS = test-libevdev
>>> +noinst_PROGRAMS = test-libevdev test-compile-pedantic
>>>
>>>   TESTS = $(noinst_PROGRAMS)
>>>
>>> @@ -33,6 +33,9 @@ test_libevdev_SOURCES = \
>>>
>>>   test_libevdev_LDADD =  $(CHECK_LIBS) $(GCOV_LDFLAGS)
>>>
>>> +test_compile_pedantic_SOURCES = test-compile-pedantic.c
>>> +test_compile_pedantic_CFLAGS = $(AM_CPPFLAGS) -Wpedantic -Werror
>>> -std=c90
>>
>>
>> Why not -std=c99 and drop the two earlier patches? Or does -pedantic
>> not work with c99?
>>
>> Anyway, I dislike changing the code just to get -pedantic working with
>> c89. Things like trailing semicolons make patches easier to read as no
>> line needs to be changed but just added. And other stuff like
>> lvalue-struct-initializers and friends will all break once we add
>> this.
>
>
> yep, I agree with all this :)
>
> however, note that this is a build test so that our headers work when
> compiling against a project that uses -pedantic. it doesn't apply the same
> to libevdev itself. I think that's a good compromise, we don't control
> whether someone using libevdev uses -pedantic so we should be good citizens
> and compile fine. I agree about the trailing semicolon but it's a small
> price to pay. there's nothing in our public headers that should require c99.
>
> 2/3 is the only patch that changes libevdev itself but then again it merely
> stops a stray semicolon and doesn't affect any actual code, so it's
> effectively a noop anyway.

Ok, that makes sense. I somehow overlooked that explanation in the commit-msg ;)

Thanks
David


More information about the Input-tools mailing list