diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2020-02-18 21:18:55 +0100 |
---|---|---|
committer | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2020-02-19 05:10:00 +0100 |
commit | 6f65d24796a0aaca0c20f4c074aa71e39f38e68d (patch) | |
tree | 8b083dacc9d8e3870c0750d17b7e53ceec0a79a4 /tests/test-pedantic-compilation.cxx | |
parent | b56a50827ffdc43dd3b6a32898f8f184eeea7234 (diff) | |
download | libgphoto2-6f65d24796a0aaca0c20f4c074aa71e39f38e68d.tar.gz |
Make sure both C and C++ programs including gphoto2 headers compile
Check that programs including libgphoto2 headers compile
when compiled for a number of different language standards:
C: ansi c99 c11
C++: ansi c++98 c++11 c++14 c++17
For each of these language standards, if the compiler does not
compile an empty example program, we do not test whether compiling
with the gphoto2/*.h headers included works.
This will work with GCC as the compiler, and also should work with
CLANG as the compiler as CLANG is mostly compatible in these matters.
On other compilers, the test compile of the empty program should
fail, and thus no checks with the gphoto2/*.h headers included will
be performed.
C90/ANSI C apparently does not define __STDC_VERSION__, so the
C source code needed to be changed to become ANSI C compatible.
In C++ pedantic compilation source, we now use actual C++ code
instead of relying on C code working when compiled as C++ code.
In Travis CI, we now actually require both C and C++.
Diffstat (limited to 'tests/test-pedantic-compilation.cxx')
-rw-r--r-- | tests/test-pedantic-compilation.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test-pedantic-compilation.cxx b/tests/test-pedantic-compilation.cxx index 70bac2f2b..5dbe12083 100644 --- a/tests/test-pedantic-compilation.cxx +++ b/tests/test-pedantic-compilation.cxx @@ -15,12 +15,12 @@ #include <gphoto2/gphoto2-port-result.h> #include <gphoto2/gphoto2-port-version.h> -#include <stdio.h> +#include <iostream> unsigned long cxx_version = __cplusplus; int main() { - printf("cxx_version = %lu\n", cxx_version); + std::cout << "cxx_version = " << cxx_version << std::endl; return 0; } |