Add C++ header guards

And a basic build test for C++ to make sure including the headers doesn't
completely fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-09-29 16:53:14 +10:00
parent 27cab50172
commit 631fb3c0af
4 changed files with 36 additions and 0 deletions

View file

@ -276,6 +276,14 @@ executable('test-build-libreis',
c_args : ['-Werror', '-DINCLUDE_LIBREIS=1'],
install : false)
if add_languages('cpp', required: false)
executable('test-build-cxx',
'test/buildtest.cc',
dependencies: [dep_libei, dep_libeis],
include_directories: 'src',
install: false)
endif
configure_file(output: 'config.h', configuration: config_h)
if get_option('documentation')

View file

@ -23,6 +23,10 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@ -881,3 +885,7 @@ ei_event_get_time(struct ei_event *event);
/**
* @}
*/
#ifdef __cplusplus
}
#endif

View file

@ -24,6 +24,10 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
@ -597,3 +601,7 @@ eis_event_touch_get_y(struct eis_event *event);
/**
* @}
*/
#ifdef __cplusplus
}
#endif

12
test/buildtest.cc Normal file
View file

@ -0,0 +1,12 @@
#include <libei.h>
#include <libeis.h>
/* This is a build-test only */
using namespace std;
int
main(void)
{
return 0;
}