[PATCH wayland 1/2] tests: C++ compilation test

Marek Chalupa mchqwerty at gmail.com
Fri Dec 19 08:35:25 PST 2014


On 19 December 2014 at 16:23, Mariusz Ceier <mceier+wayland at gmail.com>
wrote:
>
> Hi,
>
> On 19 December 2014 at 15:20, Marek Chalupa <mchqwerty at gmail.com> wrote:
>>
>> Hi,
>>
>> git tells me that this patch adds white space error (new line before EOF)
>>
>
>>
> On 15 December 2014 at 11:33, Mariusz Ceier <mceier+wayland at gmail.com>
>> wrote:
>>>
>>> This test includes one of wayland headers, which produced
>>> error with C++ compiler. C compiler can't be used for this test,
>>> because it issues only a warning[1] and only when wayland headers
>>> are not installed in system headers path (/usr/include).
>>>
>>> [1] wayland-server-protocol.h:201:2: warning: implicit declaration of
>>> function ‘wl_resource_post_event’
>>>
>>> Signed-off-by: Mariusz Ceier <mceier+wayland at gmail.com>
>>> ---
>>>  Makefile.am                | 4 +++-
>>>  configure.ac               | 1 +
>>>  tests/cpp-compile-test.cpp | 5 +++++
>>>  3 files changed, 9 insertions(+), 1 deletion(-)
>>>  create mode 100644 tests/cpp-compile-test.cpp
>>>
>>> diff --git a/Makefile.am b/Makefile.am
>>> index 1551762..ea9ffc1 100644
>>> --- a/Makefile.am
>>> +++ b/Makefile.am
>>> @@ -128,7 +128,8 @@ TESTS =                                             \
>>>         queue-test                              \
>>>         signal-test                             \
>>>         resources-test                          \
>>> -       message-test
>>> +       message-test    \
>>> +       cpp-compile-test
>>>
>>>  check_PROGRAMS =                               \
>>>         $(TESTS)                                \
>>> @@ -180,6 +181,7 @@ resources_test_SOURCES = tests/resources-test.c
>>>  resources_test_LDADD = libtest-runner.la
>>>  message_test_SOURCES = tests/message-test.c
>>>  message_test_LDADD = libtest-runner.la
>>> +cpp_compile_test_SOURCES = tests/cpp-compile-test.cpp
>>>
>>>  fixed_benchmark_SOURCES = tests/fixed-benchmark.c
>>>  fixed_benchmark_LDADD = libtest-runner.la
>>> diff --git a/configure.ac b/configure.ac
>>> index 12dd94c..a5f7e61 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -25,6 +25,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz
>>> subdir-objects])
>>>  AM_SILENT_RULES([yes])
>>>
>>>  # Check for programs
>>> +AC_PROG_CXX
>>>
>>
>> I'm think Wayland should be capable to compile without errors even
>> without C++ compiler.
>> Shouldn't we have some checks here (later in the code) to disable the
>> cpp-test if the C++ compiler is not present in the environment?
>>
>>
> I think that may be tricky, and I'm not sure how to do this properly.
> This thread may be relevant:
> http://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00001.html
>
>

Yeah, it looks like hard one to do it properly. The link helps :)
A little workaround works for me though, I'll send it as a follow-up patch.
Someone please comment on it... or should we just ignore it and hope that
C++ compiler is present (which holds most of the time, but...)


>  AC_PROG_CC
>>>
>>>  # Initialize libtool
>>> diff --git a/tests/cpp-compile-test.cpp b/tests/cpp-compile-test.cpp
>>> new file mode 100644
>>> index 0000000..1e84e63
>>> --- /dev/null
>>> +++ b/tests/cpp-compile-test.cpp
>>> @@ -0,0 +1,5 @@
>>> +/* This source should compile fine with C++ compiler */
>>> +#include "wayland-server-protocol.h"
>>> +
>>> +int main() { return 0; }
>>>
>>
>> This should not be in-lined, but I think in this case it doesn't matter
>> at all, so OK.
>>
>>
>>> +
>>> --
>>> 2.1.3
>>>
>>> _______________________________________________
>>> wayland-devel mailing list
>>> wayland-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>>
>>
>> Thanks,
>> Marek
>>
>
Thanks,
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20141219/dc2c6b08/attachment-0001.html>


More information about the wayland-devel mailing list