Commit c635f464 authored by o9000's avatar o9000

Feature test C11 generics, since GCC lies about compliance

parent 16a359f9
......@@ -62,6 +62,14 @@ else()
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 )
......
......@@ -64,7 +64,6 @@ tint2 is a simple panel/taskbar made for modern X window managers. It was specif
* 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?
......
#ifndef PRINT_H
#define PRINT_H
#ifdef HAS_GENERIC
int print_uchar(unsigned char v);
int print_char(char v);
......@@ -52,4 +54,8 @@ int print_unknown();
void *: print_pointer, \
default : print_unknown)(x)
#else
#define print(...) printf("Omitted, the compiler does not support C11 generics.\n")
#endif
#endif
......@@ -151,3 +151,9 @@ TEST(dummy) {
int y = 2;
ASSERT_EQUAL(x, y);
}
TEST(dummyBad) {
int x = 2;
int y = 3;
ASSERT_EQUAL(x, y);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment