summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-25 06:00:30 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-25 06:00:30 +0000
commit6d5a10ca6019f44f25f2c6a182071eeb44dbaf1b (patch)
tree72f86a445f4678c5b6afc75667e751ee6dcaf2a2 /gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c
parent04722d4b482b22863709ad8e675262ed33ac6f6b (diff)
downloadppe42-gcc-6d5a10ca6019f44f25f2c6a182071eeb44dbaf1b.tar.gz
ppe42-gcc-6d5a10ca6019f44f25f2c6a182071eeb44dbaf1b.zip
* cpplib.c (do_include_common): Revert to correct line number
if -traditional. * cpptrad.c (scan_out_logical_line): Treat null directive as white space. Invlidate MI optimization for non-whitespace text outside a directive. testsuite: * gcc.dg/cpp/mi7.c, gcc.dg/cpp/mi7a.h, gcc.dg/cpp/mi7b.h, gcc.dg/cpp/trad/builtins.c, gcc.dg/cpp/trad/builtins.h, gcc.dg/cpp/trad/cmdlne-C.c, gcc.dg/cpp/trad/cmdlne-C2.c, gcc.dg/cpp/trad/maccom1.c, gcc.dg/cpp/trad/maccom2.c, gcc.dg/cpp/trad/maccom3.c, gcc.dg/cpp/trad/maccom4.c, gcc.dg/cpp/trad/maccom6.c, gcc.dg/cpp/trad/mi1.c, gcc.dg/cpp/trad/mi1c.h, gcc.dg/cpp/trad/mi1nd.h, gcc.dg/cpp/trad/mi1ndp.h, gcc.dg/cpp/trad/mi1x.h, gcc.dg/cpp/trad/mi2.c, gcc.dg/cpp/trad/mi2a.h, gcc.dg/cpp/trad/mi2b.h, gcc.dg/cpp/trad/mi2c.h gcc.dg/cpp/trad/mi3.c, gcc.dg/cpp/trad/mi3.def, gcc.dg/cpp/trad/mi3.h, gcc.dg/cpp/trad/mi4.c, gcc.dg/cpp/trad/mi5.c, gcc.dg/cpp/trad/mi6.c, gcc.dg/cpp/trad/mi6a.h, gcc.dg/cpp/trad/mi6b.h, gcc.dg/cpp/trad/mi6c.h, gcc.dg/cpp/trad/mi6d.h, gcc.dg/cpp/trad/mi6e.h, gcc.dg/cpp/trad/mi7.c, gcc.dg/cpp/trad/mi7a.h, gcc.dg/cpp/trad/mi7b.h: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54978 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c')
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c b/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c
new file mode 100644
index 00000000000..ff67ddbdb7b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-C -traditional-cpp" } */
+
+/* Test -C doesn't fail with #define. #define is the tricky case,
+ being the only directive that remembers its comments.
+
+ -C treats comments as tokens in their own right, so e.g. comment at
+ the beginning of a directive turns it into a non-directive. */
+
+#define simple no comments
+
+#define/**/obj_like/**/(some)/**/thing/**/
+#define fun_like(/**/x/**/,/**/y/**/)/**/
+/**/#define not_a_macro
+
+#if !defined simple || !defined obj_like || !defined fun_like
+#error Missed some macros with -C
+#endif
+
+#ifdef not_a_macro
+#error not_a_macro is!
+#endif
+
+/* Check obj_like doesn't expect arguments, and fun_like does. */
+obj_like
+fun_like (foo, bar)
+
+/* Check OK to redefine fun_like without comments in the params. */
+#define fun_like(x, y)/**/
+
+/* Check comments in macros in directives are OK. */
+#define ZERO 0 /* A trailing comment. */
+
+#if ZERO
+#endif
OpenPOWER on IntegriCloud