Feature test C11 generics, since GCC lies about compliance

This commit is contained in:
o9000
2017-12-20 18:55:50 +01:00
parent 16a359f944
commit c635f46439
4 changed files with 20 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
#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

View File

@@ -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);
}