diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-06 08:24:22 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-06 08:24:22 +0000 |
commit | ecb68251ec372b2b6971d4875bd1548978dbc058 (patch) | |
tree | b4662b68daf63cc7cf16c2fab569a5dde8daa2ea /gcc/testsuite | |
parent | 08c74ec4b319bc6e5092b9a0385270b87d06d7dd (diff) | |
download | gcc-ecb68251ec372b2b6971d4875bd1548978dbc058.tar.gz |
* cppfiles.c (read_and_prescan) [case SPECCASE_QUESTION]: Bump
input pointer before possibly branching off to the backslash
code.
* cpphash.c (macroexpand): Correctly delete \r escapes when
stringifying parameters.
* cpplib.c (copy_rest_of_line): Go directly to skip_block_comment
if we can; bail out early if we hit a line comment.
(handle_directive): Treat '# 123' in an .S file just like
'# <punctuation>'. Discard the shifted '#' if we hit '#\n'.
Return 1 for '# not_a_directive'.
(get_directive_token): Pop macro buffers here, so that
cpp_get_token can't sneakily move past a newline.
Add sanity checks.
(cpp_get_token): goto randomchar if handle_directive returns 0.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31819 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/gcc.dg/lineno-2.c | 24 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/strpaste.c | 34 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/trigraphs.c | 28 |
3 files changed, 86 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/lineno-2.c b/gcc/testsuite/gcc.dg/lineno-2.c new file mode 100644 index 00000000000..64647e25a8c --- /dev/null +++ b/gcc/testsuite/gcc.dg/lineno-2.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ + +/* Test #line with and without macros for the line number. */ + +#define L 90 + +#line 44 +int i = __LINE__; + +#line L +int j = __LINE__; + +#line 14 /* N.B. the _next_ line is line 14. */ + +int main(void) +{ + if (i != 44) + abort (); + if (j != 90) + abort (); + if (__LINE__ != 21) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/strpaste.c b/gcc/testsuite/gcc.dg/strpaste.c new file mode 100644 index 00000000000..56e148489bc --- /dev/null +++ b/gcc/testsuite/gcc.dg/strpaste.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ + +/* Regression test for stringizing and token pasting. + We got internal escape markers in the strings. */ + +#include <string.h> + +#define S(x) _S(x) +#define _S(x) #x + +#define I 1 +static const char s1[] = S(I.1); +static const char t1[] = "1.1"; + +#define f h +#define h(a) a+f +static const char s2[] = S( f(1)(2) ); +static const char t2[] = "1+h(2)"; + +#undef I +#undef f +#undef h + +int +main(void) +{ + if (strcmp (s1, t1)) + abort (); + + if (strcmp (s2, t2)) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/trigraphs.c b/gcc/testsuite/gcc.dg/trigraphs.c new file mode 100644 index 00000000000..62ac10339af --- /dev/null +++ b/gcc/testsuite/gcc.dg/trigraphs.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-ansi" } */ + +/* Basic tests for trigraph conversion. + All of them are here, but not in all possible contexts. *??/ +/ + +??=include <stdio.h> + +??=define TWELVE 1??/ +2 + +static const char str??(??) = "0123456789??/n"; + +int +main(void) +??< + if (sizeof str != TWELVE) + abort (); + + if ((5 ??' 3) != 6) + abort (); + + if ((5 ??! 3) != 7) + abort (); + + return 0; +??> |