TP 13 exo1: Finish the buildsystem and the directories structure
[TD_C.git] / TP_13 / exo1 / lib / macros.h
diff --git a/TP_13/exo1/lib/macros.h b/TP_13/exo1/lib/macros.h
new file mode 100644 (file)
index 0000000..ab500df
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * =====================================================================================
+ *
+ *       Filename:  macros.h
+ *
+ *    Description:  
+ *
+ *        Version:  1.0
+ *        Created:  09/03/2017 15:28:46
+ *       Revision:  none
+ *       Compiler:  gcc
+ *
+ *         Author:  Jerome Benoit (fraggle), jerome.benoit@piment-noir.org
+ *   Organization:  Piment Noir
+ *
+ * =====================================================================================
+ */
+
+#ifndef MACROS_H
+#define MACROS_H
+
+/* definition to expand macro then apply to pragma message */
+#define VALUE_TO_STRING(x) #x
+#define VALUE(x) VALUE_TO_STRING(x)
+#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
+
+#define ARRAY_SIZE(arr) ({typeof (arr) arr ## _is_a_pointer __attribute__((unused)) = {}; \
+                          sizeof(arr) / sizeof(arr[0]);})
+
+#endif /*  MACROS_H */