Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a510905 authored by Chris Manton's avatar Chris Manton Committed by Andre Eisenbach
Browse files

Add compile time checks

parent d94a9fc6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -7,4 +7,16 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define INVALID_FD (-1)

#define CONCAT(a, b) a##b

// Use during compile time to check conditional values
// NOTE: The the failures will present as a generic error
// "error: initialization makes pointer from integer without a cast"
// but the file and line number will present the condition that
// failed.
#define DUMMY_COUNTER(c) CONCAT(__osi_dummy_, c)
#define DUMMY_PTR DUMMY_COUNTER(__COUNTER__)

#define COMPILE_ASSERT(x) char * DUMMY_PTR = !(x)

typedef uint32_t timeout_t;