aboutsummaryrefslogtreecommitdiff
path: root/02-usart/test_harness/test_harness.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2020-11-20 18:41:49 -0700
committerJosh Rahm <joshuarahm@gmail.com>2020-11-20 19:03:01 -0700
commitfd763486d875968941c77386e23936e817856c8e (patch)
treeed85ffe2d6c27b502d06aefa5e63244450bb7028 /02-usart/test_harness/test_harness.h
parent3b6018348d51c77f53adca90e498d7bf268c91c9 (diff)
downloadstm32l4-fd763486d875968941c77386e23936e817856c8e.tar.gz
stm32l4-fd763486d875968941c77386e23936e817856c8e.tar.bz2
stm32l4-fd763486d875968941c77386e23936e817856c8e.zip
Finally got a peripheral interrupt!
Diffstat (limited to '02-usart/test_harness/test_harness.h')
-rw-r--r--02-usart/test_harness/test_harness.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/02-usart/test_harness/test_harness.h b/02-usart/test_harness/test_harness.h
index 0a218f8..74f3faa 100644
--- a/02-usart/test_harness/test_harness.h
+++ b/02-usart/test_harness/test_harness.h
@@ -20,20 +20,18 @@ typedef struct {
fprintf(stderr, fmt "\n", v1, v2)
#define FORMAT_STRING(v1, v2) \
- _Pragma("GCC diagnostic push"); \
- _Pragma("GCC diagnostic ignored \"-Wpointer-to-int-cast\""); \
- _Generic(v1, long: GENPR("%ld == %ld", v1, v2), \
- unsigned long: GENPR("%lu == %lu", v1, v2), \
- int: GENPR("%d == %d", v1, v2), \
- unsigned int: GENPR("%u == %u", v1, v2), \
- short: GENPR("%h == %h", v1, v2), \
- unsigned short: GENPR("%hu == %hu", v1, v2), \
- char: GENPR("%c == %c", v1, v2), \
- double: GENPR("%f == %f", v1, v2), \
- unsigned char: fprintf( \
- stderr, "%02x == %02x\n", (unsigned int) v1, (unsigned int) v2),\
- default: GENPR("%p == %p\n", v1, v2)); \
- _Pragma("GCC diagnostic pop")
+ fprintf( \
+ stderr, \
+ _Generic((v1), long: "%ld == %ld\n", \
+ unsigned long: "%lu == %lu\n", \
+ int: "%d == %d\n", \
+ unsigned int: "%u == %u\n", \
+ short: "%hu == %hu\n", \
+ unsigned short: "%hu == %hu\n", \
+ char: "%c == %c\n", \
+ double: "%f == %f\n", \
+ default: "%p == %p\n"), \
+ (v1), (v2)); \
#define TRY_PRINT_TYPE(v1, v2, type, fmt) \
else if (__builtin_types_compatible_p(typeof (v1), type)) { \