Feature test C11 generics, since GCC lies about compliance
o9000 mrovi9000@gmail.com
4 files changed,
20 insertions(+),
1 deletions(-)
M
CMakeLists.txt
→
CMakeLists.txt
@@ -62,6 +62,14 @@ set(EXECINFO_LIBRARIES "")
set(BACKTRACE_L_FLAGS "") endif() +check_c_source_compiles( + "#define print(x) _Generic((x), default : print_unknown)(x) \n void print_unknown(){} \n int main () { print(0); }" + HAS_GENERIC) + +if(HAS_GENERIC) + add_definitions(-DHAS_GENERIC) +endif(HAS_GENERIC) + if( ENABLE_RSVG ) pkg_check_modules( RSVG librsvg-2.0>=2.14.0 ) endif( ENABLE_RSVG )
M
README.md
→
README.md
@@ -64,7 +64,6 @@
* Graphical glitches on Intel graphics cards can be avoided by changing the acceleration method to UXA ([issue 595](https://gitlab.com/o9000/tint2/issues/595)) * Window managers that do not follow exactly the EWMH specification might not interact well with tint2 ([issue 627](https://gitlab.com/o9000/tint2/issues/627)). * Full transparency requires a compositor such as Compton (if not provided already by the window manager, as in Compiz/Unity, KDE or XFCE). - * As of version 16.0, tint2 requires a C11 compiler (such as GCC version 4.9 or newer). # How can I help out?
M
src/util/print.h
→
src/util/print.h
@@ -1,6 +1,8 @@
#ifndef PRINT_H #define PRINT_H +#ifdef HAS_GENERIC + int print_uchar(unsigned char v); int print_char(char v);@@ -51,5 +53,9 @@ long double: print_long_double, \
char *: print_string, \ void *: print_pointer, \ default : print_unknown)(x) + +#else +#define print(...) printf("Omitted, the compiler does not support C11 generics.\n") +#endif #endif
M
src/util/test.c
→
src/util/test.c
@@ -151,3 +151,9 @@ int x = 2;
int y = 2; ASSERT_EQUAL(x, y); } + +TEST(dummyBad) { + int x = 2; + int y = 3; + ASSERT_EQUAL(x, y); +}