aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/preprocessor
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-03-27 13:41:39 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-03-27 15:20:21 +0200
commit4fae9be00c8860a293d12500020adcffd598b15f (patch)
treeffa7f93ca1cd74337e4dd4908c80aad8b308ca75 /validation/preprocessor
parent70d85a2b68efa8f3456ec2a9808605c512405aa0 (diff)
downloadsparse-dev-4fae9be00c8860a293d12500020adcffd598b15f.tar.gz
predefine __INT_MAX__ and friends
Some tests or some code depends on these macros being predefined by the compiler. Predefine them. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/preprocessor')
-rw-r--r--validation/preprocessor/predef-max.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/validation/preprocessor/predef-max.c b/validation/preprocessor/predef-max.c
new file mode 100644
index 00000000..ad4b7eaf
--- /dev/null
+++ b/validation/preprocessor/predef-max.c
@@ -0,0 +1,18 @@
+#define TEST_MAX(X, Z) if (X != ((~ Z) >> 1)) return 1
+
+int test_max(void)
+{
+ TEST_MAX(__INT_MAX__, 0U);
+ TEST_MAX(__LONG_MAX__, 0UL);
+ TEST_MAX(__LONG_LONG_MAX__, 0ULL);
+
+ return 0;
+}
+
+/*
+ * check-name: predefined __<type>_MAX__
+ * check-command: test-linearize -Wno-decl $file
+ * check-output-ignore
+ *
+ * check-output-contains: ret\\..*\\$0
+ */