aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>1999-01-22 10:33:38 +0000
committerZack Weinberg <zack@gcc.gnu.org>1999-01-22 10:33:38 +0000
commit2747111309f15faea860f79897ba70bc5c1bef81 (patch)
tree0d910ee17c614fafbb0a3e676b8e72be5aaa4395
parent815cdc524f5f8ff48a35220e7ba5157aa02329d7 (diff)
downloadgcc-2747111309f15faea860f79897ba70bc5c1bef81.zip
gcc-2747111309f15faea860f79897ba70bc5c1bef81.tar.gz
gcc-2747111309f15faea860f79897ba70bc5c1bef81.tar.bz2
cpp-if1.c: New test - torture test of preprocessor's number conversion in #if directives.
* cpp-if1.c: New test - torture test of preprocessor's number conversion in #if directives. * cpp-if2.c: New test - torture test of preprocessor's character constant conversion in #if directives. Both these tests are entirely my own invention. From-SVN: r24822
-rw-r--r--gcc/testsuite/gcc.dg/cpp-if1.c34
-rw-r--r--gcc/testsuite/gcc.dg/cpp-if2.c19
2 files changed, 53 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp-if1.c b/gcc/testsuite/gcc.dg/cpp-if1.c
new file mode 100644
index 0000000..e33c1a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp-if1.c
@@ -0,0 +1,34 @@
+/* { dg-do preprocess } */
+/* { dg-options "-pedantic-errors" } */
+
+#if 0xa == 10
+#error yes /* { dg-error "#error yes" "normal conversion" } */
+#endif
+
+#if 077 == 63
+#error yes /* { dg-error "#error yes" "normal conversion" } */
+#endif
+
+#if 12wrt /* { dg-error "nvalid number" "invalid number" } */
+#endif
+
+#if 0abc /* { dg-error "nvalid number" "invalid number" } */
+#endif
+
+#if 42abc /* { dg-error "nvalid number" "invalid number" } */
+#endif
+
+#if 1.2 /* { dg-error "floating point numbers" "floating point in #if" } */
+#endif
+
+#if 4uu /* { dg-error "too many `u' suffixes" "too many suffixes" } */
+#endif
+
+#if 124123231lll /* { dg-error "too many `l' suffixes" "too many suffixes" } */
+#endif
+
+#if 099 /* { dg-error "digits beyond the radix" "decimal in octal constant" } */
+#endif
+
+#if 0xfffffffffffffffff /* { dg-error "integer constant out of range" "range error" } */
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp-if2.c b/gcc/testsuite/gcc.dg/cpp-if2.c
new file mode 100644
index 0000000..32880e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp-if2.c
@@ -0,0 +1,19 @@
+/* { dg-do preprocess } */
+/* { dg-options -pedantic-errors } */
+
+#if 'a' == 'a' && '\001' == 1 && '\x12' == 0x12
+#error yes /* { dg-error "#error yes" "basic charconst recognition" } */
+#endif
+
+#if 'a' == L'a' && L'\xfeed' == 0xfeed
+#error yes /* { dg-error "#error yes" "wide charconst recognition" } */
+#endif
+
+#if 'abcd' /* { dg-warning "multi-character character constant" "multi-character charconst" } */
+#endif
+
+#if 'abcdefghi' /* { dg-error "character constant (is )?too long" "charconst too long" } */
+#endif
+
+#if '' /* { dg-error "empty character constant" "empty charconst" } */
+#endif