aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
Diffstat (limited to 'validation')
-rw-r--r--validation/preprocessor/preprocessor10.c16
-rw-r--r--validation/preprocessor/preprocessor17.c10
-rw-r--r--validation/preprocessor/preprocessor18.c15
-rw-r--r--validation/preprocessor/preprocessor20.c12
-rw-r--r--validation/preprocessor/preprocessor4.c16
-rw-r--r--validation/preprocessor/preprocessor5.c16
-rw-r--r--validation/preprocessor/preprocessor6.c32
-rw-r--r--validation/preprocessor/preprocessor9.c20
8 files changed, 103 insertions, 34 deletions
diff --git a/validation/preprocessor/preprocessor10.c b/validation/preprocessor/preprocessor10.c
index 7fcac360..b6555dca 100644
--- a/validation/preprocessor/preprocessor10.c
+++ b/validation/preprocessor/preprocessor10.c
@@ -1,7 +1,4 @@
-/*
- * result should be
- * defined
- * since concatenation of 'defi' and 'ned' should result in the same token
+/* concatenation of 'defi' and 'ned' should result in the same token
* we would get if we had 'defined' in the input stream.
*/
#define A
@@ -11,3 +8,14 @@ defined
#else
undefined
#endif
+/*
+ * check-name: Preprocessor #10
+ *
+ * check-command: sparse -E $file
+ * check-exit-value: 0
+ *
+ * check-output-start
+
+defined
+ * check-output-end
+ */
diff --git a/validation/preprocessor/preprocessor17.c b/validation/preprocessor/preprocessor17.c
index dfcbee8c..6eba05dd 100644
--- a/validation/preprocessor/preprocessor17.c
+++ b/validation/preprocessor/preprocessor17.c
@@ -5,3 +5,13 @@
#ifndef (
#endif
#endif
+/*
+ * check-name: Preprocessor #17
+ *
+ * check-command: sparse -E $file
+ * check-exit-value: 0
+ * check-output-start
+
+
+ * check-output-end
+ */
diff --git a/validation/preprocessor/preprocessor18.c b/validation/preprocessor/preprocessor18.c
index b5988bf1..94acbad7 100644
--- a/validation/preprocessor/preprocessor18.c
+++ b/validation/preprocessor/preprocessor18.c
@@ -1,3 +1,18 @@
/* one warning for each, please... */
#define 1
#undef 1
+/*
+ * check-name: Preprocessor #18
+ *
+ * check-command: sparse -E $file
+ * check-exit-value: 1
+ *
+ * check-output-start
+
+preprocessor/preprocessor18.c:2:2: error: expected identifier to 'define'
+preprocessor/preprocessor18.c:3:2: error: expected identifier to 'undef'
+
+ * check-output-end
+ *
+ * check-known-to-fail
+ */
diff --git a/validation/preprocessor/preprocessor20.c b/validation/preprocessor/preprocessor20.c
index 68c0ccc1..ead11418 100644
--- a/validation/preprocessor/preprocessor20.c
+++ b/validation/preprocessor/preprocessor20.c
@@ -2,3 +2,15 @@
#define X
#define Y
#include "preprocessor20.h"
+/*
+ * check-name: Preprocessor #20
+ *
+ * check-command: sparse -E $file
+ * check-exit-value: 0
+ *
+ * check-output-start
+
+A
+B
+ * check-output-end
+ */
diff --git a/validation/preprocessor/preprocessor4.c b/validation/preprocessor/preprocessor4.c
index 8b8c4da2..e0fa1d3d 100644
--- a/validation/preprocessor/preprocessor4.c
+++ b/validation/preprocessor/preprocessor4.c
@@ -1,10 +1,16 @@
-/*
- * More examples from the comp.std.c discussion.
- *
- * This should result in bar(bar). We get it right.
- */
#define foo bar
#define mac(x) x(foo)
mac(foo)
+/*
+ * check-name: Preprocessor #4
+ * check-description: More examples from the comp.std.c discussion.
+ * check-command: sparse -E $file
+ * check-exit-value: 0
+ *
+ * check-output-start
+
+bar(bar)
+ * check-output-end
+ */
diff --git a/validation/preprocessor/preprocessor5.c b/validation/preprocessor/preprocessor5.c
index fa389376..f5ddcee7 100644
--- a/validation/preprocessor/preprocessor5.c
+++ b/validation/preprocessor/preprocessor5.c
@@ -1,9 +1,15 @@
-/*
- * Yet more examples from comp.std.c.
- *
- * This should result in "a|". We get it right.
- */
#define a a|
#define b(x) x
b(a)
+/*
+ * check-name: Preprocessor #5
+ * check-description: Yet more examples from comp.std.c.
+ * check-command: sparse -E $file
+ * check-exit-value: 0
+ *
+ * check-output-start
+
+a|
+ * check-output-end
+ */
diff --git a/validation/preprocessor/preprocessor6.c b/validation/preprocessor/preprocessor6.c
index 87b79431..1bd6cb3e 100644
--- a/validation/preprocessor/preprocessor6.c
+++ b/validation/preprocessor/preprocessor6.c
@@ -1,22 +1,15 @@
-/*
- * We get '##' wrong for the kernel.
- *
- * It could possibly be argued that the kernel usage
- * is undefined (since the different sides of the '##'
- * are not proper tokens), but that's probably a load
- * of bull. We should just try to do it right.
+/* We used to get '##' wrong for the kernel.
*
- * This _should_ result in
+ * It could possibly be argued that the kernel usage is undefined (since the
+ * different sides of the '##' are not proper tokens), but we try to do it
+ * right anyway.
*
- * static char __vendorstr_003d[] __devinitdata = "Lockheed Martin-Marietta Corp";
- *
- * but we break up the "003d" into two tokens ('003' and 'd')
- * and then we also put the 'o' marker to mark the token 003
- * as an octal number, so we end up with
+ * We used to break up the "003d" into two tokens ('003' and 'd') and then put
+ * the 'o' marker to mark the token 003 as an octal number, resulting in:
*
* static char __vendorstr_o03 d [ ] __devinitdata = "Lockheed Martin-Marietta Corp";
*
- * which doesn't work, of course.
+ * which didn't work, of course.
*/
#define __devinitdata __attribute__((section(".devinit")))
@@ -25,3 +18,14 @@
static char __vendorstr_##vendor[] __devinitdata = name;
VENDOR(003d,"Lockheed Martin-Marietta Corp")
+/*
+ * check-name: Preprocessor #6
+ *
+ * check-command: sparse -E $file
+ * check-exit-value: 0
+ *
+ * check-output-start
+
+static char __vendorstr_003d[] __attribute__((section(".devinit"))) = "Lockheed Martin-Marietta Corp";
+ * check-output-end
+ */
diff --git a/validation/preprocessor/preprocessor9.c b/validation/preprocessor/preprocessor9.c
index 76d6e414..cc50b211 100644
--- a/validation/preprocessor/preprocessor9.c
+++ b/validation/preprocessor/preprocessor9.c
@@ -1,10 +1,18 @@
-/*
- * Should result in
- * #define X 1
- * X
- * since only # in the input stream marks beginning of preprocessor command
- * and here we get it from macro expansion.
+/* Only # in the input stream marks the beginning of preprocessor command,
+ * and here we get it from macro expansion.
*/
#define A # define X 1
A
X
+/*
+ * check-name: Preprocessor #9
+ *
+ * check-command: sparse -E $file
+ * check-exit-value: 0
+ *
+ * check-output-start
+
+# define X 1
+X
+ * check-output-end
+ */