[hackers] [scc] Add test for preprocessor corner cases || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 10 Jan 2016 09:45:24 +0100 (CET)

commit 8a1556967443af2e55ef33b3cdab613acbc0ef91
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jan 10 09:44:02 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Jan 10 09:44:02 2016 +0100

    Add test for preprocessor corner cases

diff --git a/cc1/tests/test044.c b/cc1/tests/test044.c
new file mode 100644
index 0000000..dc65d59
--- /dev/null
+++ b/cc1/tests/test044.c
_AT_@ -0,0 +1,31 @@
+/*
+name: TEST044
+description: Test of corner cases in #if
+output:
+test044.c:14: warning: division by 0
+test044.c:18: warning: division by 0
+test044.c:22: warning: division by 0
+test044.c:28: error: parameter of #if is not an integer constant expression
+test044.c:29: error: #error 3 != (1,2,3)
+*/
+
+/* These should be accepted */
+
+ #if 0 != (0 && (0/0))
+ #error 0 != (0 && (0/0))
+ #endif
+
+ #if 1 != (-1 || (0/0))
+ #error 1 != (-1 || (0/0))
+ #endif
+
+ #if 3 != (-1 ? 3 : (0/0))
+ #error 3 != (-1 ? 3 : (0/0))
+ #endif
+
+/* This is invalid code (it is a constraint violation) */
+
+ #if 3 != (1,2,3)
+ #error 3 != (1,2,3)
+ #endif
+
Received on Sun Jan 10 2016 - 09:45:24 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 10 2016 - 09:48:19 CET