OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-src/gcc-4.2.2/gcc/testsuite/gcc.dg/cpp
    from Rev 149 to Rev 154
    Reverse comparison

Rev 149 → Rev 154

/if-4.c
0,0 → 1,8
/* Regression test for proper error message. The token name isn't
NUL terminated, so we would print garbage after it. */
/* { dg-do compile } */
 
#if 1 += 2 /* { dg-error "is not valid" "+= in if" } */
syntax_error
#endif
int foo;
if-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: separate-1.c =================================================================== --- separate-1.c (nonexistent) +++ separate-1.c (revision 154) @@ -0,0 +1,17 @@ +/* Copyright 2003 Free Software Foundation. */ + +/* { dg-do compile } */ +/* { dg-options "-save-temps" } */ + +/* Make sure we report errors in the right line, even if separate + preprocessing is used. */ + +#define FOO() + +int FOO( /* { dg-error "parse error|syntax error|expected" "error on this line" } */ + ), bar; + +int baz FOO /* { dg-error "parse error|syntax error|expected" "error on this line" } */ +; + +/* { dg-final { cleanup-saved-temps } } */
separate-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro10.c =================================================================== --- macro10.c (nonexistent) +++ macro10.c (revision 154) @@ -0,0 +1,25 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth, 23 Sep 2001. + + A tricky, pathological corner case we used to get wrong. Expansion + should go as follows. The asterisk indicates the token has "blue + paint" can no longer be macro expanded. We used to lose that + information when parsing arguments and dropping to the lexer to get + the ')'. + + foo ) + bar foo* ) + func (foo* ) + foo* + + If we try and expand the final foo, we get an "unterminated + argument list invoking macro " error. If we do the right + thing and leave it as is, no diagnostics are emitted. */ + +#define func(x) x +#define bar func( +#define foo bar foo +foo )
macro10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gnuc99-pedantic.c =================================================================== --- gnuc99-pedantic.c (nonexistent) +++ gnuc99-pedantic.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=gnu99 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif
gnuc99-pedantic.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-C2.c =================================================================== --- cmdlne-C2.c (nonexistent) +++ cmdlne-C2.c (revision 154) @@ -0,0 +1,17 @@ +/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-C" } */ + +/* This tests that C++ comments are either dropped, or converted to C + comments in macro expansions. The + in the regexp stops it from + matching itself 8-) + + Neil Booth, 9 Oct 2001. */ + +#define ZERO 0 // A comment + +ZERO: + +/* { dg-final { scan-file-not cmdlne-C2.i "c+omment:" } } */ +
cmdlne-C2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: fpreprocessed.c =================================================================== --- fpreprocessed.c (nonexistent) +++ fpreprocessed.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -fpreprocessed } */ + +/* Source: Jason Merrill, 19 Nov 2001. We'd try and back up a token + and move to a non-existent token run with -fpreprocessed on a file + without a leading # line. */ + +foo
fpreprocessed.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lexstrng.c =================================================================== --- lexstrng.c (nonexistent) +++ lexstrng.c (revision 154) @@ -0,0 +1,67 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-trigraphs" } */ + +/* Test lexing of strings and character constants. */ + +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +typedef __WCHAR_TYPE__ wchar_t; + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +/* Escaped newlines. */ +const char *str1 = "s\ +t\ +\ +r??/ + 1"; + +const char x = '\ +??/ +b'; + +/* Test escaped terminators. */ +const char *term = "\"\\\"\\"; +const char termc = '\''; +const char *terms = "'"; + +/* Test wide strings and chars are lexed. */ +const wchar_t wchar = L'w'; +const wchar_t* wstring = L"wide string"; + +/* Test all 9 trigraphs embedded in a string. Test trigraphs do not + survive an embedded backslash newline. Test trigraphs preceded by + a '?' are still noticed. */ +const char *t = "??/\????=??)??\ +(??(??!??'??-???=???/ +?-"; + +int main (int argc, char *argv[]) +{ + if (strcmp (str1, "str 1")) + err ("str1"); + + if (x != 'b') + err ("b"); + + /* We have to split the string up to avoid trigraph replacement + here. Split the 2 trigraphs after both 1 and 2 ?s; just doing + this exposed a bug in the initial release of the tokenized lexer. */ + if (strcmp (t, "\\{}#]?" "?([|^~?#??" "-")) + err ("Embedded trigraphs"); + + if (term[0] != '"' || term[1] != '\\' || term[2] != '"' + || term[3] != '\\' || term[4] != '\0') + err ("Escaped string terminators"); + + if (termc != terms[0]) + err ("Escaped character constant terminator"); + + return 0; +}
lexstrng.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: redef3.c =================================================================== --- redef3.c (nonexistent) +++ redef3.c (revision 154) @@ -0,0 +1,21 @@ +/* Test for redefining macros with mismatch token count (and the oddity). */ + +/* { dg-do preprocess } */ +/* { dg-options "-DC -DD=1 -DE" } */ + +#define A +#define A 1 +#define B 2 3 +#define B 2 +#define C 1 +#define D 1 2 +#define E + +/* { dg-warning "redefined" "redef A" { target *-*-* } 7 } + { dg-warning "redefined" "redef B" { target *-*-* } 9 } + { dg-warning "redefined" "redef D" { target *-*-* } 11 } + { dg-warning "redefined" "redef E" { target *-*-* } 12 } + { dg-warning "previous" "prev def A" { target *-*-* } 6 } + { dg-warning "previous" "prev def B" { target *-*-* } 8 } + { dg-warning "previous" "prev def D/E" { target *-*-* } 0 } +*/
redef3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unc4.c =================================================================== --- unc4.c (nonexistent) +++ unc4.c (revision 154) @@ -0,0 +1,40 @@ +/* { dg-do preprocess } */ +/* { dg-options "-fno-show-column" } */ + +/* Tests for un-terminated conditional diagnostics. + Copyright (c) 1999 Free Software Foundation. + Contributed by Zack Weinberg, who made it up all by himself. */ + +#endif /* { dg-error "#endif" "#endif without #if" } */ + +#else /* { dg-error "#else" "#else without #if" } */ +#endif /* { dg-error "#endif" "#endif after #else without #if" } */ + +#elif 0 /* { dg-error "#elif" "#elif without #if" } */ +#endif /* { dg-error "#endif" "#endif after #else without #if" } */ + +#if 1 /* { dg-bogus "unterminated" "terminated true conditional" } */ +blah +#endif + +#if 0 /* { dg-bogus "unterminated" "terminated false conditional" } */ +ignored +#endif + +/* We shouldn't see unbalanced conditionals inside #if'ed out #includes. */ +#if 0 +#include "unc1.c" +#endif + +/* The ifdef below should not get an error just because there's a bad if + inside the included file. + The odd dg-error tag on the include matches the "In file included from" + message. */ +#define FOO +#ifdef FOO /* { dg-bogus "unterminated" "nested unterm" } */ +#include "unc1.c" /* { dg-error "" } */ +#endif + +/* dg.exp doesn't read the included files for tags, so we have to + do them explicitly here. */ +/* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */
unc4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mac-dir-2.c =================================================================== --- mac-dir-2.c (nonexistent) +++ mac-dir-2.c (revision 154) @@ -0,0 +1,16 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth, 26 Feb 2002. + + Test that we allow directives in macro arguments. */ + +/* { dg-do preprocess } */ + +#define f(x) x + +f ( +#if 1 /* { dg-warning "not portable" } */ +1) +#endif
mac-dir-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tr-warn3.c =================================================================== --- tr-warn3.c (nonexistent) +++ tr-warn3.c (revision 154) @@ -0,0 +1,61 @@ +/* Test for warnings about nontraditional directives inside the unused + clauses of #if statements. Extensions do _not_ receive pedantic + warnings inside unused clauses because they are often hidden this + way on purpose. However they do still require indentation for K&R. */ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -Wtraditional -fno-show-column" } */ + +#if 1 + +/* Block 1: K+R directives should have the # indented to warn. */ + +#define foo bar /* { dg-bogus "indented" "^#kandr" } */ +# define foo bar /* { dg-bogus "indented" "^# kandr" } */ + #define foo bar /* { dg-warning "indented" "^ #kandr" } */ + # define foo bar /* { dg-warning "indented" "^ # kandr" } */ + +/* Block 2: C89 directives should not have the # indented to warn. */ + +#pragma whatever /* { dg-warning "indented" "^#c89" } */ +# pragma whatever /* { dg-warning "indented" "^# c89" } */ + #pragma whatever /* { dg-bogus "indented" "^ #c89" } */ + # pragma whatever /* { dg-bogus "indented" "^ # c89" } */ + +/* Block 3: Extensions should not have the # indented to warn, _and_ + they should get a -pedantic warning. */ + +#assert foo(bar) /* { dg-warning "indented" "^#ext" } */ +# assert bar(baz) /* { dg-warning "indented" "^# ext" } */ + #assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */ + # assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */ + +#else + +/* Block 1: K+R directives should have the # indented to warn. */ + +#undef foo bar /* { dg-bogus "indented" "^#kandr" } */ +# undef foo bar /* { dg-bogus "indented" "^# kandr" } */ + #undef foo bar /* { dg-warning "indented" "^ #kandr" } */ + # undef foo bar /* { dg-warning "indented" "^ # kandr" } */ + +/* Block 2: C89 directives should not have the # indented to warn. */ + +#error whatever /* { dg-warning "indented" "^#c89" } */ +# error whatever /* { dg-warning "indented" "^# c89" } */ + #error whatever /* { dg-bogus "indented" "^ #c89" } */ + # error whatever /* { dg-bogus "indented" "^ # c89" } */ + +/* Block 3: Extensions should not have the # indented to warn, and + they should _not_ get a -pedantic warning. */ + +#unassert foo(bar) /* { dg-warning "indented" "^#ext" } */ +# unassert bar(baz) /* { dg-warning "indented" "^# ext" } */ + #unassert baz(quux) /* { dg-bogus "indented" "^ #ext" } */ + # unassert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */ + +#endif + +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 27 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 28 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 29 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 30 } */
tr-warn3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste13.c =================================================================== --- paste13.c (nonexistent) +++ paste13.c (revision 154) @@ -0,0 +1,9 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* This used to be recognized as a comment when lexing after pasting + spellings. Neil Booth, 9 Oct 2002. */ + +#define a /##/= +a /* { dg-warning "valid preprocessing tok" } */
paste13.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: avoidpaste1.c =================================================================== --- avoidpaste1.c (nonexistent) +++ avoidpaste1.c (revision 154) @@ -0,0 +1,28 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* This tests that we avoid accidental pasting only before and after + macros and arguments, and not when the tokens are already pasted + in the souce file (e.g. "::" in a C source file). + + Neil Booth, 28 Jan 2001. */ + +#define f(x) x +#define g +#define tricky 1.0e ## -1 + +/* This should preprocess as + +:: : : : : :^: 1.0e- 1 +: : : .. . 0 0 . + +It relies on the fact that even when preprocessing C we bother to separate +the colons of C++'s :: operator. If we confine this behavior to C++ +in future, this test needs to change. */ + +:: :g: :f(): :f(^): tricky +:f(:): .. .__INCLUDE_LEVEL__ __INCLUDE_LEVEL__. /* Check builtins, too. */ + +/* { dg-final { scan-file avoidpaste1.i ":: : : : : :\\^: 1.0e- 1" } } + { dg-final { scan-file avoidpaste1.i ": : : \\\.\\\. \\\. 0 0 \\\." } } */
avoidpaste1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: maccom3.c =================================================================== --- maccom3.c (nonexistent) +++ maccom3.c (revision 154) @@ -0,0 +1,13 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that comments in the definition of a macro + parameter list are ignored when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def(x /**/, y) passed + +def(x,y) + +/* { dg-final { scan-file maccom3.i "(^|\n)passed" } } */
maccom3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: _Pragma1.c =================================================================== --- _Pragma1.c (nonexistent) +++ _Pragma1.c (revision 154) @@ -0,0 +1,39 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests the _Pragma operator. Contributed by Neil Booth 1 Nov 2000. */ + +/* Within the preprocessor, the easy pragma to test is "poison". */ + +#pragma GCC poison p1 +p1 /* { dg-error "poisoned" } */ + +/* Standard use of _Pragma. */ +_Pragma ("GCC poison p2") +p2 /* { dg-error "poisoned" } */ + +/* Don't interpret _Pragmas in directives. The standard is not clear + on this, but I think this makes most sense. */ +#if 1 _Pragma (L"GCC poison p3") /* { dg-error "missing binary operator" } */ +p3 +#endif + +#define M1 _Pragma ("GCC poison p4") +p4 /* No problem; not yet poisoned. */ +#define M2(x) _Pragma (#x) + +/* Now test macro expansion with embedded _Pragmas. */ +M1 p4 /* { dg-error "poisoned" } */ +M2 (GCC poison p5) p5 /* { dg-error "poisoned" } */ + +/* Not interpreting _Pragma in directives means they don't nest. */ +_Pragma ("_Pragma (\"GCC poison p6\") GCC poison p7") +p6 +p7 + +/* Check we ignore them in false conditionals. */ +#if 0 +_Pragma ("GCC poison p8") +#endif +p8 /* No problem. */
_Pragma1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000209-1.c =================================================================== --- 20000209-1.c (nonexistent) +++ 20000209-1.c (revision 154) @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ + +/* Tests for line numbering around function-like macro calls. + Bug found by Mark Mitchell. */ + +#define f(x) x +#define g f + +f (3); +#error here /* { dg-error "here" "case 0" } */ + +f + (3); +#error here /* { dg-error "here" "case 1" } */ + +(f + )(3); +#error here /* { dg-error "here" "case 2" } */ + +g + (3); +#error here /* { dg-error "here" "case 3" } */ + +(g + )(3); +#error here /* { dg-error "here" "case 4" } */ + +f /* some + text */ (3); +#error here /* { dg-error "here" "case 5" } */ + +(g /* some + text */ )(3); +#error here /* { dg-error "here" "case 6" } */
20000209-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: endif-pedantic1.c =================================================================== --- endif-pedantic1.c (nonexistent) +++ endif-pedantic1.c (revision 154) @@ -0,0 +1,17 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -Wno-endif-labels" } */ + +/* Tests combinations of -pedantic and -Wno-endif-labels; see extratokens2.c + for more general tests. */ + +/* Source: Phil Edwards, 25 Mar 2002. Copied from extratokens2.c and + modified. */ + +#if 1 +#if 0 +#else foo /* { dg-bogus "extra tokens" "bad warning" } */ +#endif / /* { dg-bogus "extra tokens" "bad warning" } */ +#endif +
endif-pedantic1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste4.c =================================================================== --- paste4.c (nonexistent) +++ paste4.c (revision 154) @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ +/* { dg-do compile } */ +/* { dg-options -save-temps } */ + +/* Since 1.0e and + form the pasted token, 1 is a separate token and + so should be output with a preceding space. The old preprocessor + gets this wrong. We use -save-temps to avoid direct use of the + integrated preprocessor. */ + +#define glue(x, y) x ## y + +int main () +{ + double d = glue (1.0e, +1); /* { dg-error "exponent|parse error|syntax error|expected" } */ + return 0; +} + +/* { dg-final { cleanup-saved-temps } } */
paste4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: normalize-4.c =================================================================== --- normalize-4.c (nonexistent) +++ normalize-4.c (revision 154) @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=none" } */ + +\u00AA +\u00B7 +\u0F43 +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b +\u09CB +\u09C7\u09BE +\u0B4B +\u0B47\u0B3E +\u0BCA +\u0BC6\u0BBE +\u0BCB +\u0BC7\u0BBE +\u0CCA +\u0CC6\u0CC2 +\u0D4A +\u0D46\u0D3E +\u0D4B +\u0D47\u0D3E + +K +\u212A + +\u03AC +\u1F71 + +\uAC00 +\u1100\u1161 +\uAC01 +\u1100\u1161\u11A8 +\uAC00\u11A8
normalize-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucnid-3.c =================================================================== --- ucnid-3.c (nonexistent) +++ ucnid-3.c (revision 154) @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ + +#define paste(x, y) x ## y + +int paste(\u00aa, \u0531) = 3; +
ucnid-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi3.def =================================================================== --- mi3.def (nonexistent) +++ mi3.def (revision 154) @@ -0,0 +1,10 @@ +/* Another test case for over-eager multiple include optimization. + This one distilled from glibc's setlocale.c and categories.def. + The #ifdef block doesn't cover the entire file, so it must not be + taken for a reinclude guard. */ + +#ifndef NO_POSTLOAD +#define NO_POSTLOAD NULL +#endif + +int X; Index: vararg2.c =================================================================== --- vararg2.c (nonexistent) +++ vararg2.c (revision 154) @@ -0,0 +1,131 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99" } */ + +/* Jamie's varargs macros from hell. Not for the faint of heart. + Great tests that C99 and GNU varargs give identical results. + Adapted to the testsuite by Neil Booth, 1 Nov 2000. */ + +/* Permission is granted to use, copy, modify and distribute this file + freely for any purpose whatsoever. This file is free software, and + there's no warranty. + + -- Jamie Lokier , 25/Sep/2000. */ + +#define dup3(x) x,x,x + +/* Count elements in a list (0 to 10 max). */ +#define gnu_count(y...) _gnu_count1 ( , ##y) +#define _gnu_count1(y...) _gnu_count2 (y,10,9,8,7,6,5,4,3,2,1,0) +#define _gnu_count2(_,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,n,ys...) n + +/* Tail of a list. */ +#define gnu_tail(y...) _gnu_tail (y) +#define _gnu_tail(x,y...) y + +/* Repeat N times. */ +#define gnu_repeat(n, x) gnu_tail (_gnu_repeat (n, x)) +#define _gnu_repeat(n, x) _gnu_repeat_##n (x) +#define _gnu_repeat_0(x) +#define _gnu_repeat_1(x) ,x +#define _gnu_repeat_2(x) ,x,x +#define _gnu_repeat_3(x) ,x,x,x +#define _gnu_repeat_4(x) ,x,x,x,x +#define _gnu_repeat_5(x) ,x,x,x,x,x + +#define _gnu_keep(xs...) xs +#define _gnu_discard(xs...) +#define _gnu_split_r(n,xs...) _gnu_split_rd (n,_gnu_keep,_gnu_discard xs) +#define _gnu_split_d(n,xs...) _gnu_split_rd (n,_gnu_discard,_gnu_keep xs) +#define _gnu_split_rd(n,xs...) _gnu_split_##n (xs) +#define _gnu_split_0(a,b,xs...) a() b(xs) +#define _gnu_split_1(a,b,x0,xs...) a(x0) b(xs) +#define _gnu_split_2(a,b,x0,x1,xs...) a(x0,x1) b(xs) +#define _gnu_split_3(a,b,x0,x1,x2,xs...) a(x0,x1,x2) b(xs) +#define _gnu_split_4(a,b,x0,x1,x2,x3,xs...) a(x0,x1,x2,x3) b(xs) +#define _gnu_split_5(a,b,x0,x1,x2,x3,x4,xs...) a(x0,x1,x2,x3,x4) b(xs) + +/* List manipulations. Surprise: index zero is the rightmost element. */ +#define gnu_take(n, xs...) \ + _gnu_split_d (_gnu_count1 ( , ## xs), _gnu_repeat (n, _gnu_error) , ## xs) +#define gnu_drop(n, xs...) \ + _gnu_split_d (n,,_gnu_split_r (_gnu_count1 ( , ## xs), _gnu_repeat (n, _gnu_error) , ## xs)) +#define gnu_index(pos, xs...) gnu_take (1, gnu_drop (pos , ## xs)) + +/* C99 __VA_ARGS__ versions */ +#define c99_count(...) _c99_count1 ( , ##__VA_ARGS__)/* If only ## worked.*/ +#define _c99_count1(...) _c99_count2 (__VA_ARGS__,10,9,8,7,6,5,4,3,2,1,0) +#define _c99_count2(_,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,n,...) n + +#define c99_tail(...) _c99_tail (__VA_ARGS__) +#define _c99_tail(x,...) __VA_ARGS__ + +/* Repeat N times. */ +#define c99_repeat(n, x) c99_tail (_c99_repeat (n, x)) +#define _c99_repeat(n, x) _c99_repeat_##n (x) +#define _c99_repeat_0(x) +#define _c99_repeat_1(x) ,x +#define _c99_repeat_2(x) ,x,x +#define _c99_repeat_3(x) ,x,x,x +#define _c99_repeat_4(x) ,x,x,x,x +#define _c99_repeat_5(x) ,x,x,x,x,x + +#define _c99_keep(...) __VA_ARGS__ +#define _c99_discard(...) +#define _c99_split_r(n,...) _c99_split_rd(n,_c99_keep,_c99_discard __VA_ARGS__) +#define _c99_split_d(n,...) _c99_split_rd(n,_c99_discard,_c99_keep __VA_ARGS__) +#define _c99_split_rd(n,...) _c99_split_##n (__VA_ARGS__) +#define _c99_split_0(a,b,...) a() b(__VA_ARGS__) +#define _c99_split_1(a,b,x0,...) a(x0) b(__VA_ARGS__) +#define _c99_split_2(a,b,x0,x1,...) a(x0,x1) b(__VA_ARGS__) +#define _c99_split_3(a,b,x0,x1,x2,...) a(x0,x1,x2) b(__VA_ARGS__) +#define _c99_split_4(a,b,x0,x1,x2,x3,...) a(x0,x1,x2,x3) b(__VA_ARGS__) +#define _c99_split_5(a,b,x0,x1,x2,x3,x4,...) a(x0,x1,x2,x3,x4) b(__VA_ARGS__) + +/* List manipulations. Surprise: index zero is the rightmost element. */ +#define c99_take(n, ...) \ + _c99_split_d (_c99_count1 ( , ## __VA_ARGS__), _c99_repeat (n, _c99_error) , ## __VA_ARGS__) +#define c99_drop(n, ...) \ + _c99_split_d (n,,_c99_split_r (_c99_count1 ( , ## __VA_ARGS__), _c99_repeat (n, _c99_error) , ## __VA_ARGS__)) +#define c99_index(pos, ...) c99_take (1, c99_drop (pos , ## __VA_ARGS__)) + +/************** Expansions **************/ + +/* Correct answers are 0, 0, 1, 2, 10. */ +#if _gnu_count1 () != 0 || gnu_count () != 0 || gnu_count (A) != 1 \ + || gnu_count (,) != 2 || gnu_count (A, B, C, D, E, F, G, H, I, J) != 10 +#error gnu_count +#endif + +/* Correct answers are empty, 'x'. */ +#if gnu_repeat (0, 'x') gnu_repeat (1, 'x') != 'x' +#error gnu_repeat +#endif + +/* Correct answers are "e", "b", "a", empty. */ +#if gnu_index (0, 'a', 'b', 'c', 'd', 'e') != 'e' \ + || gnu_index (3, 'a', 'b', 'c', 'd', 'e') != 'b' \ + || gnu_index (4, 'a', 'b', 'c', 'd', 'e') != 'a' \ + gnu_index (5, 'a', 'b', 'c', 'd', 'e') +#error gnu_index +#endif + +/************* C99 tests *************/ + +/* The answers are 0, 0, 1, 2, 10 as for the non-C99 version. */ +#if _c99_count1 () != 0 || c99_count () != 0 || c99_count (A) != 1 \ + || c99_count (,) != 2 || c99_count (A, B, C, D, E, F, G, H, I, J) != 10 +#error c99_count +#endif + +/* Correct answers are empty, 'x'. */ +#if c99_repeat (0, 'x') c99_repeat (1, 'x') != 'x' +#error c99_repeat +#endif + +/* Correct answers are "e", "b", "a", empty. */ +#if c99_index (0, 'a', 'b', 'c', 'd', 'e') != 'e' \ + || c99_index (3, 'a', 'b', 'c', 'd', 'e') != 'b' \ + || c99_index (4, 'a', 'b', 'c', 'd', 'e') != 'a' \ + c99_index (5, 'a', 'b', 'c', 'd', 'e') +#error gnu_index +#endif
vararg2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: strify4.c =================================================================== --- strify4.c (nonexistent) +++ strify4.c (revision 154) @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* Tests we stringify without changing unprintable characts. + + Andrew Pinski */ + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + + +#define S(X) S2(X) +#define S2(X) #X +#define TAB " " /* Note there is a tab character here. */ + +int main (int argc, char *argv[]) +{ + /* The space before "bar" here is vital. */ + char a[] = S(S(TAB)); + + if (strcmp (a, "\"\\\" \\\"\"")) + err ("stringification caused octal"); + + return 0; +}
strify4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wvariadic-3.c =================================================================== --- Wvariadic-3.c (nonexistent) +++ Wvariadic-3.c (revision 154) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic -Werror" } */ + +#define f(x,...) +#define g(x,y...) /* { dg-error "variadic" } */ +int not_empty;
Wvariadic-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: line2.c =================================================================== --- line2.c (nonexistent) +++ line2.c (revision 154) @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Alexandre Oliva */ + +/* { dg-do preprocess } */ + +#line 1 +#line 0 +#line 2 +#line 32768 + +/* { dg-error "out of range" "line # too low" { target *-*-* } 1 } */ +/* { dg-error "out of range" "line # too high" { target *-*-* } 2 } */
line2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: syshdr.c =================================================================== --- syshdr.c (nonexistent) +++ syshdr.c (revision 154) @@ -0,0 +1,12 @@ +/* Test for proper suppression of warnings in system headers, + and only in system headers. */ +/* FRAGILITY WARNING: The only way we have to distinguish the good error + from the bad error is that the good error is on line 4 and the bad is + on line 5 (of their respective files). dg.exp doesn't have any way to + condition error matchers on the file they're in. */ + +/* { dg-do preprocess } */ +/* { dg-error "include_next" "good error" { target *-*-* } 4 } */ + +#include "syshdr1.h" /* { dg-error "" "In file included from:" } */ +#include "syshdr2.h"
syshdr.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sysmac1.c =================================================================== --- sysmac1.c (nonexistent) +++ sysmac1.c (revision 154) @@ -0,0 +1,26 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99 -pedantic -Wtraditional" } */ + +/* Tests diagnostics are suppressed for some macros defined in system + headers. */ + +/* Source: Neil Booth, 15 Jan 2001. */ + +#include "syshdr.h" + +#define uint 1U +#define str(x) x +#define foo(x, y...) bar(x, ##y) /* { dg-warning "named variadic macros" } */ + +#if uint /* { dg-warning "traditional C rejects" } */ +#endif +#if sys_uint /* { dg-bogus "traditional C rejects" } */ +#endif + +(str); /* { dg-warning "used with arguments" } */ +(sys_str); /* { dg-bogus "used with arguments" } */ + +foo (one_arg); /* { dg-warning "requires rest arguments" } */ +sys_foo (one_arg); /* { dg-bogus "requires rest arguments" } */
sysmac1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: syshdr.h =================================================================== --- syshdr.h (nonexistent) +++ syshdr.h (revision 154) @@ -0,0 +1,10 @@ +/* Indented to avoid "suggest hiding ..." warnings. */ + #pragma GCC system_header + +#define sys_uint 1U +#define sys_str(x) x +#define sys_foo(x, y...) bar (x, ##y) + +#define sys_uint 1U +#define sys_fl 1.0f +#define sys_ld 1.0L
syshdr.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: very-long-comment.c =================================================================== --- very-long-comment.c (nonexistent) +++ very-long-comment.c (revision 154) @@ -0,0 +1,14 @@ +/* +This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. + */ +/* This testcase for PR 20907 is a bit finicky about the placement of + comment so avoid editing the text above here. */ +/* { dg-options "-Wall" } */ +/* { dg-do compile } */ +#warning test warning /* { dg-warning "test warning" } */ +#include +int main() +{ + printf("This is line %d\n", __LINE__); + return 0; +}
very-long-comment.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr29612-2.c =================================================================== --- pr29612-2.c (nonexistent) +++ pr29612-2.c (revision 154) @@ -0,0 +1,18 @@ +/* PR preprocessor/29612 */ +/* { dg-do preprocess } */ +/* { dg-options "-Wtraditional -fno-show-column" } */ + +# 6 "pr29612-2.c" + +#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ +#endif + +# 1 "foo.h" 1 3 + +#if 1U +#endif /* No warning in system header. */ + +# 16 "pr29612-2.c" 2 + +#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ +#endif
pr29612-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro4.c =================================================================== --- macro4.c (nonexistent) +++ macro4.c (revision 154) @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test source Neil Booth. */ + +#define glue(x, y) x ## y +#define xglue(x, y) glue (x, y) + +/* Should expand to glue (1, 2), then 12. */ +#if glue (xgl, ue) (1, 2) != 12 +#error glue macro +#endif
macro4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dD-dM.c =================================================================== --- cmdlne-dD-dM.c (nonexistent) +++ cmdlne-dD-dM.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dD -dM" } */ + +/* Test -dD -dM does not fail. It should give the same output + as plain -dM. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file cmdlne-dD-dM.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file-not cmdlne-dD-dM.i "variable" } } */
cmdlne-dD-dM.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dI-M.c =================================================================== --- cmdlne-dI-M.c (nonexistent) +++ cmdlne-dI-M.c (revision 154) @@ -0,0 +1,16 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dI -M" } */ + +/* Test -dI -M does not fail. It should print just + the Makefile rule with dependencies. */ + +#define foo bar +#include "cmdlne-dI-M.h" +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file-not cmdlne-dI-M.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file-not cmdlne-dI-M.i "variable" } } + { dg-final { scan-file cmdlne-dI-M.i "(^|\\n)cmdlne-dI-M.*:\[^\\n\]*cmdlne-dI-M.c" { xfail *-*-* } } } */
cmdlne-dI-M.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c89-pedantic.c =================================================================== --- c89-pedantic.c (nonexistent) +++ c89-pedantic.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c89 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=c89 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL /* { dg-warning "long long" } */ +#endif
c89-pedantic.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi4.c =================================================================== --- mi4.c (nonexistent) +++ mi4.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Undefining a macro guard and re-including the file used to confuse + file caching in cppfiles.c, and attempt to open a bad fd. */ + +#include "mi1c.h" +#undef CPP_MIC_H +#include "mi1c.h"
mi4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dM-M.c =================================================================== --- cmdlne-dM-M.c (nonexistent) +++ cmdlne-dM-M.c (revision 154) @@ -0,0 +1,15 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dM -M" } */ + +/* Test -dM -M does not fail. It should print both the + #define lines and a Makefile rule with dependencies. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file cmdlne-dM-M.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file-not cmdlne-dM-M.i "variable" } } + { dg-final { scan-file cmdlne-dM-M.i "(^|\\n)cmdlne-dM-M\[^\\n\]*:\[^\\n\]*cmdlne-dM-M.c" { xfail *-*-* } } } */
cmdlne-dM-M.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dI-M.h =================================================================== --- cmdlne-dI-M.h (nonexistent) +++ cmdlne-dI-M.h (revision 154) @@ -0,0 +1,2 @@ +#define baz baz +int othervar;
cmdlne-dI-M.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000419-1.c =================================================================== --- 20000419-1.c (nonexistent) +++ 20000419-1.c (revision 154) @@ -0,0 +1,15 @@ +/* Test for erroneous deletion of the entire macro expansion when pruning + \r escapes. Problem noted by DJ Delorie ; test case + distilled from GNU libc header files. */ +/* { dg-do preprocess } */ + +#define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) +#define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define __ASMNAME2(prefix, cname) __STRING (prefix) cname +#define __STRING(x) #x + +__REDIRECT (a, b, c) +__ASMNAME2 (__USER_LABEL_PREFIX__, harumph) + +/* { dg-bogus "used without args" "no args, 1" { target *-*-* } 11 } */ +/* { dg-bogus "used without args" "no args, 1" { target *-*-* } 12 } */
20000419-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-P.c =================================================================== --- cmdlne-P.c (nonexistent) +++ cmdlne-P.c (revision 154) @@ -0,0 +1,11 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-P" } */ + +/* Test that we don't stair-step output with -P. Source: Neil Booth, + 18 Dec 2000. */ + +int x = 1; + +/* { dg-final { scan-file cmdlne-P.i "(^|\n)int x = 1;($|\n)" } } */
cmdlne-P.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tr-paste.c =================================================================== --- tr-paste.c (nonexistent) +++ tr-paste.c (revision 154) @@ -0,0 +1,19 @@ +/* Test for proper comment elimination semantics from cpplib's -traditional. + This should compile and link with compiled with `gcc -traditional-cpp'. + Test case by Jason R. Thorpe . */ + +/* { dg-do compile } */ +/* { dg-options "-traditional-cpp" } */ + +extern int printf (const char *, ...); + +#define A(name) X/**/name + +#define B(name) \ +void A(Y/**/name)() { A(name)(); } + +void Xhello() { printf("hello world\n"); } + +B(hello) + +int main() { XYhello(); return (0); }
tr-paste.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-5.c =================================================================== --- if-5.c (nonexistent) +++ if-5.c (revision 154) @@ -0,0 +1,9 @@ +/* Regression test: #ifdef 0 should not crash. Problem noted by + Jakub Jelinek . */ +/* { dg-do preprocess } */ + +#ifdef 0 /* { dg-error "macro names" } */ +#endif + +#ifndef 0 /* { dg-error "macro names" } */ +#endif
if-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: syshdr1.h =================================================================== --- syshdr1.h (nonexistent) +++ syshdr1.h (revision 154) @@ -0,0 +1,4 @@ +/* This file should generate an error because #include_next is not a + standard directive. */ + +#include_next
syshdr1.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro11.c =================================================================== --- macro11.c (nonexistent) +++ macro11.c (revision 154) @@ -0,0 +1,16 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth, 2 Oct 2001. + + Tests that we clear the disabled flag that is set by the + macro-defined-to-itself optimization (the optimization might not be + worth it). */ + +#define foo foo +#undef foo +#define foo 1 +#if !foo +#error foo still disabled! +#endif
macro11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c99.c =================================================================== --- c99.c (nonexistent) +++ c99.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99" } */ + +/* This file is for testing the preprocessor in -std=c99 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif
c99.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lexnum.c =================================================================== --- lexnum.c (nonexistent) +++ lexnum.c (revision 154) @@ -0,0 +1,50 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-trigraphs" } */ + +/* Test lexing of numbers. */ + +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +/* Escaped newlines. */ +#define foo 12\ +3\ +\ +4??/ +5 + +#if foo != 12345 +#error foo +#endif + +int main (int argc, char *argv[]) +{ + double a = 5.; + double x = .5; + +/* Decimal points, including initially and immediately before and + after an escaped newline. */ + if (a != 5) + err ("a"); + if (x != .\ +5) + err ("x != .5"); + x = 25\ +.\ +6; + if (x != 25.6) + err ("x != 25.6"); + + /* Test exponentials and their signs. A buggy lexer is more likely + to fail the compile, but never mind. */ + if (250 != 25e+1 || 250 != 25e1 || 250 != 2500e-1) + err ("exponentials"); + + /* Todo: p exponentials, and how to test preprocessing number + tokenisation? */ + + return 0; +}
lexnum.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: strp1.c =================================================================== --- strp1.c (nonexistent) +++ strp1.c (revision 154) @@ -0,0 +1,35 @@ +/* { dg-do run } */ + +/* Regression test for stringizing and token pasting. + We got internal escape markers in the strings. */ + +#include +#include + +#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; +}
strp1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi1nd.h =================================================================== --- mi1nd.h (nonexistent) +++ mi1nd.h (revision 154) @@ -0,0 +1,8 @@ +/* Redundant include check with #if !defined. */ + +#if !defined CPP_MIND_H +#define CPP_MIND_H + +int c; + +#endif
mi1nd.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tr-warn4.c =================================================================== --- tr-warn4.c (nonexistent) +++ tr-warn4.c (revision 154) @@ -0,0 +1,26 @@ +/* Test for -Wtraditional warnings on integer constant suffixes. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do preprocess } */ +/* { dg-options "-Wtraditional -fno-show-column" } */ + +#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ +#endif +#if 1u /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ +#endif +#if 1L +#endif +#if 1l +#endif + +# 17 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +#if 1U +#endif +#if 1u +#endif +#if 1L +#endif +#if 1l +#endif
tr-warn4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste14.c =================================================================== --- paste14.c (nonexistent) +++ paste14.c (revision 154) @@ -0,0 +1,7 @@ +/* PR preprocessor/28709 */ +/* { dg-do preprocess } */ + +#define foo - ## >> +foo /* { dg-error "pasting \"-\" and \">>\"" } */ +#define bar = ## == +bar /* { dg-error "pasting \"=\" and \"==\"" } */
paste14.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: avoidpaste2.c =================================================================== --- avoidpaste2.c (nonexistent) +++ avoidpaste2.c (revision 154) @@ -0,0 +1,30 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* This tests that we avoid accidental pasting, as well as gratuitous + space insertion, in various nasty places _inside_ a macro's + replacement list: on either side of a paste, and on either side of + an argument. It also tests that we don't pass empty macro leading + whitespace to the next line - this problem use to break Emacs + preprocessor abuse. + + Neil Booth, 1 Feb 2001. */ + +#define EMPTY_WITH_LEADING_SPACE +#define f(x, y) :x: -y##> -##y> +#define g(x, y) :x: :y##2 2##y: + +/* This should preprocess as + +: : : - > - > +:2: :22 22: + +We used to get a space at the start of the line. */ + + EMPTY_WITH_LEADING_SPACE +f(:,) +g(2, 2) + +/* { dg-final { scan-file avoidpaste2.i "(^|\\n): : : - > - >" } } + { dg-final { scan-file avoidpaste2.i "(^|\\n):2: :22 22:" } } */
avoidpaste2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19990413-1.c =================================================================== --- 19990413-1.c (nonexistent) +++ 19990413-1.c (revision 154) @@ -0,0 +1,13 @@ +/* Verify that cpp doesn't screw up the line numbering when a macro argument + extends over multiple lines. */ +/* { dg-do compile } */ + +#define FOO(x) /* nothing */ + +void +func(void) +{ + FOO(i + = 4) + else; /* { dg-error "parse error|syntax error|expected" "error on this line" { target *-*-* } { 12 } } */ +}
19990413-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19951227-1.c =================================================================== --- 19951227-1.c (nonexistent) +++ 19951227-1.c (revision 154) @@ -0,0 +1,3 @@ +/* { dg-do preprocess } */ +#if 0xe-1 /* { dg-error "invalid suffix" } */ +#endif
19951227-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20356.c =================================================================== --- pr20356.c (nonexistent) +++ pr20356.c (revision 154) @@ -0,0 +1,14 @@ +/* PR preprocessor/20356 */ +/* { dg-do compile } */ +/* { dg-options "-I$srcdir/gcc.dg/cpp -I$srcdir/gcc.dg/cpp/inc" } */ + +#include + +#ifndef PR20356_H +# error PR20356_H not defined +#endif +#ifndef INC_PR20356_H +# error INC_PR20356_H not defined +#endif + +int i;
pr20356.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: maccom4.c =================================================================== --- maccom4.c (nonexistent) +++ maccom4.c (revision 154) @@ -0,0 +1,17 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure the comment is saved in the macro and copied + to the output file when the macro is expanded when the -CC option is + used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def /* passed */ + +def + +/* + /* The + in the regexp prevents it from matching itself. */ + { dg-final { scan-file maccom4.i "p+assed" } } +*/
maccom4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: charconst.c =================================================================== --- charconst.c (nonexistent) +++ charconst.c (revision 154) @@ -0,0 +1,36 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* This tests various diagnostics about character constants, for both + the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '' /* { dg-warning "empty" "empty charconst" } */ +#endif +#if L'' /* { dg-warning "empty" "empty wide charconst" } */ +#endif +#if 'very long' /* { dg-warning "too long" "long charconst" } */ +#endif +#if L'very long' /* { dg-warning "too long" "long wide charconst" } */ +#endif +/* Don't do this test for L'ab'; it depends upon sizeof (wchar_t). */ +#if 'ab' /* { dg-warning "multi-char" "multi-character" } */ +#endif + +void foo () +{ + int c; + __WCHAR_TYPE__ w; + + c = ''; /* { dg-warning "empty" "empty charconst" } */ + w = L''; /* { dg-warning "empty" "empty wide charconst" } */ + + c = 'very long'; /* { dg-warning "too long" "long charconst" } */ + w = L'very long'; /* { dg-warning "too long" "long wide charconst" } */ + + c = 'ab'; /* { dg-warning "multi-char" "multi-char" } */ + /* Wide charconsts cannot contain more than one wide character. */ + w = L'ab'; /* { dg-warning "too long" "multi-char wide" } */ +}
charconst.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20356.h =================================================================== --- pr20356.h (nonexistent) +++ pr20356.h (revision 154) @@ -0,0 +1,5 @@ +#ifndef PR20356_H +# define PR20356_H +#else +# include_next +#endif
pr20356.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c99-if-comma-1.c =================================================================== --- c99-if-comma-1.c (nonexistent) +++ c99-if-comma-1.c (revision 154) @@ -0,0 +1,11 @@ +/* Test for commas in constant expressions in #if: not permitted in C90 + but permitted in unevaluated subexpressions in C99. */ +/* Origin: Joseph Myers */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +#if (1, 2) /* { dg-error "comma" "evaluated comma" } */ +#endif + +#if 1 || (1, 2) +#endif
c99-if-comma-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: _Pragma2.c =================================================================== --- _Pragma2.c (nonexistent) +++ _Pragma2.c (revision 154) @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Don't allow directives in a _Pragma string. */ + +/* Contributed by Neil Booth 14 Nov 2000. */ + +_Pragma("#define test") + +#ifdef test +#error Do not allow directives in _Pragma strings +#endif
_Pragma2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wtrigraphs.c =================================================================== --- Wtrigraphs.c (nonexistent) +++ Wtrigraphs.c (revision 154) @@ -0,0 +1,27 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99 -Wtrigraphs -fno-show-column" } */ + +/* Test we don't double warn for trigraphs immediately after preceding + text. Source Neil Booth. 22 Nov 2000. */ + +abcdef??< /* { dg-warning "ignored" } */ +123456??> /* { dg-warning "ignored" } */ ++??= /* { dg-warning "ignored" } */ + +/* Test we warn of escaped newlines only in comments. Source Neil + Booth. 4 May 2003. */ + +/* { dg-bogus "ignored" } Test ??< ??= a few ??/ random things in + { dg-warning "ignored" } some ??/ + { dg-bogus "ignored" } ??< comments. */ + +// { dg-bogus "ignored" } More ??/ comment ??> tests. + +// { dg-warning "ignored" } Another ??/ + Test + +// { dg-warning "ignored" } And another with space after ??/ + the escape + +// { dg-bogus "ignored" } A tricky one ??/\ +
Wtrigraphs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-cexp.c =================================================================== --- if-cexp.c (nonexistent) +++ if-cexp.c (revision 154) @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ + +/* Test the ? : opearator, for precedence and both true and false. */ + +#if 1 ? 1 ? 2 : 0 : 0 +#error OK /* { dg-error "OK" "nested ? :" } */ +#endif + +#if ((0) ? (1) ? (2) : (3) : (4) ? (5): (6)) == 5 +#error OK /* { dg-error "OK" "nested ? : with parens" } */ +#endif + +#if 2: /* { dg-error "':' without" "immediate :" } */ +#endif
if-cexp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000209-2.c =================================================================== --- 20000209-2.c (nonexistent) +++ 20000209-2.c (revision 154) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ +/* Distilled from glibc sources. Tests preprocessor corner cases. + Since it uses rest args, we must turn off -pedantic-errors. */ + +#define NO_PAREN(rest...) rest +#define DEFINE_CATEGORY(category, items) \ +const int _nl_value_type_##category[] = { NO_PAREN items } + +DEFINE_CATEGORY +( + LC_COLLATE, + ( + 1, + 2, + 3, + )); + +DEFINE_CATEGORY(LC_CTYPE, (1, 2, 3));
20000209-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: endif-pedantic2.c =================================================================== --- endif-pedantic2.c (nonexistent) +++ endif-pedantic2.c (revision 154) @@ -0,0 +1,17 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-Wno-endif-labels -pedantic" } */ + +/* Tests combinations of -pedantic and -Wno-endif-labels; see extratokens2.c + for more general tests. */ + +/* Source: Phil Edwards, 25 Mar 2002. Copied from endif-pedantic1.c and + modified. */ + +#if 1 +#if 0 +#else foo /* { dg-error "extra tokens" "tokens after #else" } */ +#endif / /* { dg-error "extra tokens" "tokens after #endif" } */ +#endif +
endif-pedantic2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000625-1.c =================================================================== --- 20000625-1.c (nonexistent) +++ 20000625-1.c (revision 154) @@ -0,0 +1,16 @@ +/* Regression test for paste corner cases. Distilled from + syscall stub logic in glibc. */ + +/* { dg-do compile } */ + +#define ENTRY(name) name##: +#define socket bind + +int +main(void) +{ + goto socket; + + ENTRY(socket) /* { dg-warning "valid preprocessing token" "" } */ + return 0; +}
20000625-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: digraph1.c =================================================================== --- digraph1.c (nonexistent) +++ digraph1.c (revision 154) @@ -0,0 +1,17 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:199409" } */ + +/* Just simple check that digraphs are on under c94, for both + preprocessor and compiler. digraphs.c is the general test. */ + +%:define glue +#ifndef glue +#error glue not defined! +#endif + +int main (int argc, char *argv<::>) +<% + return 0; +%>
digraph1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste5.c =================================================================== --- paste5.c (nonexistent) +++ paste5.c (revision 154) @@ -0,0 +1,24 @@ +/* Regression test for bug in convoluted situation involving token paste + plus function-like macros used outside function context. It may be + easier to understand if you mentally replace 'struct' with 'A' + throughout this file; 'struct' is used only to get the code to compile + when preprocessed correctly. + + The original problem was seen in the Linux kernel and reported by + Jakub Jelinek ; this test is synthetic. */ + +/* { dg-do compile } */ + +#define glue(a,b) a##b +#define struct(x) B(x) +#define E(x) struct x +#define FG (22) + +extern void B(int); + +void foo(void) +{ + E(glue(F,*)) dummy; /* { dg-warning "valid preprocessing token" } */ + + E(glue(F,G)) ; +}
paste5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucnid-4.c =================================================================== --- ucnid-4.c (nonexistent) +++ ucnid-4.c (revision 154) @@ -0,0 +1,17 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ + +\u00AA +\u00AB /* { dg-error "not valid in an identifier" } */ +\u00B6 /* { dg-error "not valid in an identifier" } */ +\u00BA +\u00C0 +\u00D6 +\u0384 + +\u0669 /* { dg-error "not valid at the start of an identifier" } */ +A\u0669 +0\u00BA +0\u0669 +\u0E59 /* { dg-error "not valid at the start of an identifier" } */ +A\u0E59
ucnid-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trigraphs.c =================================================================== --- trigraphs.c (nonexistent) +++ trigraphs.c (revision 154) @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-ansi" } */ + +extern void abort (void); + +/* Basic tests for trigraph conversion. + All of them are here, but not in all possible contexts. *??/ +/ + +??=include + +??=define TWELVE 1??/ +2 + +static const char str??(??) = "0123456789??/n"; + +int +main(void) +??< + unsigned char x = 5; + + if (sizeof str != TWELVE) + abort (); + + /* Test ^=, the only multi-character token to come from trigraphs. */ + x ??'= 3; + if (x != 6) + abort (); + + if ((5 ??! 3) != 7) + abort (); + + return 0; +??>
trigraphs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ident.c =================================================================== --- ident.c (nonexistent) +++ ident.c (revision 154) @@ -0,0 +1,7 @@ +/* Test #ident. */ +/* { dg-do compile } */ +/* { dg-options "" } */ /* shut off -pedantic */ + +#ident "this is an ident" + +int dummy(void) { return 12; }
ident.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: include1.c =================================================================== --- include1.c (nonexistent) +++ include1.c (revision 154) @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests that "#include MACRO" works. */ + +/* Source: Neil Booth, 29 Oct 2000. */ + +#define MACRO "mi1c.h" +#include MACRO +#ifndef CPP_MIC_H +#error #include MACRO does not work +#endif
include1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vararg3.c =================================================================== --- vararg3.c (nonexistent) +++ vararg3.c (revision 154) @@ -0,0 +1,17 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99" } */ + +/* Source: Neil Booth, 6 Aug 2002. + + Tests that we DTRT with varargs commas for a single-parameter macro + when in standards-conforming mode. */ + +#define f(...) , ## __VA_ARGS__ + +/* The comma from f's expansion should be retained (standards + conforming mode only). Tests that it isn't in non-standards mode + include macro8.c and vararg1.c. */ +#if 2 f() 3 /* { dg-bogus "missing binary operator" } */ +#endif
vararg3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macsyntx.c =================================================================== --- macsyntx.c (nonexistent) +++ macsyntx.c (revision 154) @@ -0,0 +1,72 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -std=gnu99" } */ + +/* Tests macro syntax, for both definition and invocation, including:- + + o Full range of macro definition semantics. + o No. of arguments supplied to function-like macros. + o Odd GNU rest args behavior. + o Macro arguments do not flow into the rest of the file. */ + + +/* Test basic macro definition syntax. The macros are all called + "foo" deliberately to provoke an (excess) redefinition warning in + case the macros succeed in being entered in the macro hash table + despite being an error. + + Split a couple of the lines to check that the errors appear on the + right line (i.e. are associated with the correct token). */ + +#define ; /* { dg-error "identifier" } */ +#define SEMI; /* { dg-warning "space" } */ +#define foo(X /* { dg-error "missing" } */ +#define foo\ +(X,) /* { dg-error "parameter name" } */ +#define foo(, X) /* { dg-error "parameter name" } */ +#define foo(X, X) /* { dg-error "duplicate" } */ +#define foo(X Y) /* { dg-error "comma" } */ +#define foo(() /* { dg-error "may not appear" } */ +#define foo(..., X) /* { dg-error "missing" } */ +#define foo \ +__VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */ +#define goo(__VA_ARGS__) /* { dg-warning "__VA_ARGS__" } */ +#define hoo(...) __VA_ARGS__ /* OK. */ +#define __VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */ +__VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */ + +/* test # of supplied arguments. */ +#define none() +#define one(x) +#define two(x, y) +#define var0(...) +#define var1(x, ...) +none() /* OK. */ +none(ichi) /* { dg-error "passed 1" } */ +one() /* OK. */ +one(ichi) /* OK. */ +one(ichi\ +, ni) /* { dg-error "passed 2" } */ +two(ichi) /* { dg-error "requires 2" } */ +var0() /* OK. */ +var0(ichi) /* OK. */ +var1() /* { dg-warning "rest arguments to be used" } */ +var1(ichi) /* { dg-warning "rest arguments to be used" } */ +var1(ichi, ni) /* OK. */ + +/* This tests two oddities of GNU rest args - omitting a comma is OK, + and backtracking a token on pasting an empty rest args. */ +#define rest(x, y...) x ## y /* { dg-warning "ISO C" } */ +rest(ichi,) /* OK. */ +rest(ichi) /* { dg-warning "rest arguments to be used" } */ +#if 23 != rest(2, 3) /* OK, no warning. */ +#error 23 != 23 !! +#endif + +/* Test that we don't allow arguments to flow into the rest of the + file. */ +#define half_invocation do_nowt(2 +#define do_nowt(x) x +half_invocation ) /* OK. */ +do_nowt (half_invocation)) /* { dg-error "unterminated argument" } */
macsyntx.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: poison.c =================================================================== --- poison.c (nonexistent) +++ poison.c (revision 154) @@ -0,0 +1,25 @@ +/* { dg-do preprocess } + { dg-options "-fno-show-column" } */ + +#pragma GCC poison foo +foo /* { dg-error "foo" "use of foo" } */ +#pragma GCC poison foo2 foo3 +foo2 /* { dg-error "foo2" "use of foo2" } */ +foo3 /* { dg-error "foo3" "use of foo3" } */ +#pragma GCC poison foo4 foo5 +foo4 /* { dg-error "foo4" "use of foo4" } */ +foo5 /* { dg-error "foo5" "use of foo5" } */ +#pragma GCC poison +++ /* { dg-error "invalid" "poison non-identifier" } */ +#define foo6 123 +#pragma GCC poison foo6 /* { dg-warning "foo6" "poison defined macro" } */ +#define foo6 345 /* { dg-error "foo6" "def of foo6" } */ +#define foo6 456 /* { dg-error "foo6" "redef of foo6" } */ +#ifdef foo6 /* { dg-error "foo6" "#ifdef foo6" } */ +#error hey! foo6 defined! +#endif +#if defined(foo6) /* { dg-error "foo6" "#if defined foo6" } */ +#error foo6 still defined! +#else +foo6 /* { dg-error "foo6" "use of foo6" } */ +#endif +#pragma GCC poison
poison.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: arith-3.c =================================================================== --- arith-3.c (nonexistent) +++ arith-3.c (revision 154) @@ -0,0 +1,447 @@ +/* Preprocessor arithmetic semantic tests. */ + +/* Copyright (C) 2002 Free Software Foundation, Inc. */ +/* Source: Neil Booth, 26 May 2002. */ + +/* The file tests overflow warnings for, and values of, preprocessor + arithmetic that are dependent on target precision. + + Please keep changes to arith-2.c and arith-3.c in sync. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fno-show-column" } */ + +#include + +#define APPEND2(NUM, SUFF) NUM ## SUFF +#define APPEND(NUM, SUFF) APPEND2(NUM, SUFF) + +#define TARGET_UTYPE_MAX ULLONG_MAX + +/* The tests in this file depend only on the macros defined in this + #if block. Note that it is no good calculating these values, as + the intent is to test both the preprocessor's number parser and + arithmetic. */ +#if TARGET_UTYPE_MAX == 65535ULL + +# define TARG_PRECISION 16 +# define MAX_INT 32767 +# define MAX_UINT 65535 + +# define TARG_MAX_HEX 0x7fff +# define TARG_MAX_OCT 077777 +# define TARG_MAX_PLUS_1 32768L +# define TARG_MAX_PLUS_1_U 32768UL +# define TARG_MAX_PLUS_1_HEX 0x8000 +# define TARG_MAX_PLUS_1_OCT 0100000 +# define UTARG_MAX_HEX 0xffff +# define UTARG_MAX_OCT 0177777 +# define UTARG_MAX_PLUS_1 65536L +# define UTARG_MAX_PLUS_1_HEX 0x10000 +# define UTARG_MAX_PLUS_1_OCT 0200000 + +# define TARG_LOWPART_PLUS_1 256L +# define TARG_LOWPART_PLUS_1_U 256UL + + /* Division and modulo; anything that uses the high half in both + dividend and divisor. */ +# define LONG_UDIVISION 61234UL / 260L +# define LONG_UDIVISION_ANSWER 235 +# define LONG_SDIVISION -15000L / 299L +# define LONG_SDIVISION_ANSWER -50 +# define LONG_UMODULO 61234UL % 260L +# define LONG_UMODULO_ANSWER 134 +# define LONG_SMODULO -15000L % 299L +# define LONG_SMODULO_ANSWER -50 + +#elif TARGET_UTYPE_MAX == 4294967295ULL + +# define TARG_PRECISION 32 +# define MAX_INT 2147483647 +# define MAX_UINT 4294967295 + +# define TARG_MAX_HEX 0x7fffffff +# define TARG_MAX_OCT 017777777777 +# define TARG_MAX_PLUS_1 2147483648L +# define TARG_MAX_PLUS_1_U 2147483648UL +# define TARG_MAX_PLUS_1_HEX 0x80000000 +# define TARG_MAX_PLUS_1_OCT 020000000000 +# define UTARG_MAX_HEX 0xffffffff +# define UTARG_MAX_OCT 037777777777 +# define UTARG_MAX_PLUS_1 4294967296L +# define UTARG_MAX_PLUS_1_HEX 0x100000000 +# define UTARG_MAX_PLUS_1_OCT 040000000000 + +# define TARG_LOWPART_PLUS_1 65536 +# define TARG_LOWPART_PLUS_1_U 65536UL + + /* Division and modulo; anything that uses the high half in both + dividend and divisor. */ +# define LONG_UDIVISION 268335456UL / 70000L +# define LONG_UDIVISION_ANSWER 3833 +# define LONG_SDIVISION -368335456L / 123456L +# define LONG_SDIVISION_ANSWER -2983 +# define LONG_UMODULO 268335456UL % 70000L +# define LONG_UMODULO_ANSWER 25456 +# define LONG_SMODULO -368335456L % 123456L +# define LONG_SMODULO_ANSWER -66208 + +#elif TARGET_UTYPE_MAX == 18446744073709551615ULL + +# define TARG_PRECISION 64 +# define MAX_INT 9223372036854775807 +# define MAX_UINT 18446744073709551615 + +# define TARG_MAX_HEX 0x7fffffffffffffff +# define TARG_MAX_OCT 0777777777777777777777 +# define TARG_MAX_PLUS_1 9223372036854775808L +# define TARG_MAX_PLUS_1_U 9223372036854775808UL +# define TARG_MAX_PLUS_1_HEX 0x8000000000000000 +# define TARG_MAX_PLUS_1_OCT 01000000000000000000000 +# define UTARG_MAX_HEX 0xffffffffffffffff +# define UTARG_MAX_OCT 01777777777777777777777 +# define UTARG_MAX_PLUS_1 18446744073709551616L +# define UTARG_MAX_PLUS_1_HEX 0x10000000000000000 +# define UTARG_MAX_PLUS_1_OCT 02000000000000000000000 + +# define TARG_LOWPART_PLUS_1 4294967296 +# define TARG_LOWPART_PLUS_1_U 4294967296U + + /* Division and modulo; anything that uses the high half in both + dividend and divisor. */ +# define LONG_UDIVISION 235184372088832UL / 17279869184L +# define LONG_UDIVISION_ANSWER 13610 +# define LONG_SDIVISION -234582345927345L / 12345678901L +# define LONG_SDIVISION_ANSWER -19001 +# define LONG_UMODULO 235184372088832UL % 17279869184L +# define LONG_UMODULO_ANSWER 5352494592L +# define LONG_SMODULO -234582345927345L % 12345678901L +# define LONG_SMODULO_ANSWER -2101129444L + +#else + +# error Please extend the macros here so that this file tests your target + +#endif + +/* Create more macros based on the above. */ +#define TARG_PART_BITS (TARG_PRECISION / 2) +#define TARG_MIN (-TARG_MAX - 1) +#define TARG_MAX APPEND (MAX_INT, L) +#define TARG_MAX_U APPEND (MAX_INT, UL) +#define UTARG_MAX APPEND (MAX_UINT, L) +#define UTARG_MAX_U APPEND (MAX_UINT, UL) + +/* And now the tests. */ + +#if TARG_MAX /* { dg-bogus "so large" } */ +#endif +#if TARG_MAX_PLUS_1_HEX /* { dg-bogus "so large" } */ +#endif +#if TARG_MAX_PLUS_1_OCT /* { dg-bogus "so large" } */ +#endif + +#if UTARG_MAX /* { dg-warning "so large" } */ +#endif +#if UTARG_MAX_PLUS_1 /* { dg-error "too large" } */ +#endif +#if UTARG_MAX_PLUS_1_HEX /* { dg-error "too large" } */ +#endif +#if UTARG_MAX_HEX /* { dg-bogus "too large" } */ +#endif +#if UTARG_MAX_PLUS_1_OCT /* { dg-error "too large" } */ +#endif +#if UTARG_MAX_OCT /* { dg-bogus "too large" } */ +#endif + +#if TARG_MAX < 0 || TARG_MAX_PLUS_1 < 0 /* { dg-warning "so large" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if UTARG_MAX_HEX < 0 || TARG_MAX_HEX < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if UTARG_MAX_OCT < 0 || TARG_MAX_OCT < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if -1 != UTARG_MAX_U +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Test each operator correctly warns of overflow conditions, and + gives the right answer. */ + +/* Binary +. */ +#if TARG_MAX + 1 != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX + -2 != TARG_MAX /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX + -1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX_U + 1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX_U + -2 != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Binary -. */ +#if TARG_MAX - -1 != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX - 2 != TARG_MAX /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX - 1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX_U - -1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX_U - 2 != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + + +/* Binary *. */ +#if TARG_LOWPART_PLUS_1 * (TARG_LOWPART_PLUS_1 >> 1) != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_LOWPART_PLUS_1 >> 1) * TARG_LOWPART_PLUS_1 != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_LOWPART_PLUS_1 << 1) * (TARG_LOWPART_PLUS_1 + 1) != (TARG_LOWPART_PLUS_1 << 1) /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX * 1 != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_MAX >> 1) * 2 != TARG_MAX - 1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_LOWPART_PLUS_1_U + 61) * (TARG_LOWPART_PLUS_1 << 1) != 61 * (TARG_LOWPART_PLUS_1 << 1) /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_LOWPART_PLUS_1 >> 1) * TARG_LOWPART_PLUS_1_U != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 1 * TARG_MIN != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Binary /. */ +#if TARG_MIN / -1 != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MIN / 1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX_PLUS_1_U / -1 != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -5 / (2 - 2) /* { dg-error "division by zero" } */ +#endif + +#if LONG_UDIVISION != LONG_UDIVISION_ANSWER +# error /* { dg-bogus "error" } */ +#endif + +#if LONG_SDIVISION != LONG_SDIVISION_ANSWER +# error /* { dg-bogus "error" } */ +#endif + +/* Binary %. Cannot overflow. */ +#if -5 % (2 - 2) /* { dg-error "division by zero" } */ +#endif + +#if TARG_MIN % 1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if LONG_UMODULO != LONG_UMODULO_ANSWER +# error /* { dg-bogus "error" } */ +#endif + +#if LONG_SMODULO != LONG_SMODULO_ANSWER +# error /* { dg-bogus "error" } */ +#endif + +#if 234 % -1U != 234 +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MIN % -1U != TARG_MIN +# error /* { dg-bogus "error" } */ +#endif + +/* Binary << and Binary >>, the latter cannot overflow. */ +#if -1 >> 3 != -1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX >> 3 != TARG_MAX / 8 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 0 << 256 != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 1 << 256 != 0 /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 1U << 256 != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX << 1 != -2 /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX_U << 1 != -2 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_LOWPART_PLUS_1 << TARG_PART_BITS != 0 /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_LOWPART_PLUS_1 << (TARG_PART_BITS - 1) != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_LOWPART_PLUS_1_U << (TARG_PART_BITS - 1) != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_LOWPART_PLUS_1 << (TARG_PART_BITS - 2) != (TARG_MAX_PLUS_1_U >> 1) /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +/* Test how the sign bit is handled. */ +#if (TARG_MIN << 1) != 0 /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_MAX_PLUS_1_U << 1) != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_MIN >> 1) != 3U << (TARG_PRECISION - 2) /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_MAX_PLUS_1_U >> 1) != 1 << (TARG_PRECISION - 2) /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + +/* Unary -. It can overflow in just one case. */ +#if -TARG_MIN != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if - -TARG_MAX != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Unary +, ~, and !. They cannot overflow. */ +#if +TARG_MAX != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if !TARG_MAX + !TARG_MIN != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if ~TARG_MAX , ~TARG_MIN != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Bitwise &, ^, |. They cannot overflow. */ +#if (TARG_MAX & -1), (TARG_MIN & -1) != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX | -1, (TARG_MIN | -1) != -1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX ^ -1, (TARG_MIN ^ -1) != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Comparison operators. They cannot overflow. */ +#if -1 <= TARG_MAX, (TARG_MIN <= 1) != 1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -1 >= TARG_MAX, (TARG_MIN >= 1) != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -1 < TARG_MAX, (TARG_MIN < 1) != 1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -1 > TARG_MAX, (TARG_MIN > 1) != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Comma and ? : operators. They cannot overflow. */ +#if -1, TARG_MAX, TARG_MIN != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -1 ? TARG_MAX: TARG_MAX, 0 ? 1: TARG_MIN != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif
arith-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wvariadic-4.c =================================================================== --- Wvariadic-4.c (nonexistent) +++ Wvariadic-4.c (revision 154) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic -Werror -Wno-variadic-macros" } */ + +#define f(x,...) +#define g(x,y...) +int not_empty;
Wvariadic-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: line3.c =================================================================== --- line3.c (nonexistent) +++ line3.c (revision 154) @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-Wwrite-strings" } */ +/* The purpose of this test is to ensure that line numbers in diagnostics + are accurate after macros whose arguments contain newlines and are + substituted multiple times. The semicolons are on separate lines because + #line can only correct numbering on line boundaries. */ +#define one(x) x +#define two(x) x x +#define four(x) two(x) two(x) + +int +main(void) +{ + char *A; + + A = "text"; /* { dg-warning "discards qualifiers" "case zero" } */ + A = one("text" + "text") + ; /* { dg-warning "discards qualifiers" "case one" } */ + A = two("text" + "text") + ; /* { dg-warning "discards qualifiers" "case two" } */ + A = four("text" + "text") + ; /* { dg-warning "discards qualifiers" "case four" } */ + + return 0; +}
line3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sysmac2.c =================================================================== --- sysmac2.c (nonexistent) +++ sysmac2.c (revision 154) @@ -0,0 +1,28 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic -Wtraditional -fno-show-column" } */ + +/* Tests diagnostics are suppressed for some macros defined in system + headers. */ + +/* Source: Neil Booth, 15 Jan 2001. */ + +#include "syshdr.h" + +#define uint 1U +#define fl 1.0f +#define ld 1.0L + +int +main () +{ + int u1 = uint; /* { dg-warning "traditional C rejects" } */ + int u2 = sys_uint; /* { dg-bogus "traditional C rejects" } */ + float f1 = fl; /* { dg-warning "traditional C rejects" } */ + float f2 = sys_fl; /* { dg-bogus "traditional C rejects" } */ + long double ld1 = ld; /* { dg-warning "traditional C rejects" } */ + long double l2 = sys_ld; /* { dg-bogus "traditional C rejects" } */ + + return 0; +}
sysmac2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20348.c =================================================================== --- pr20348.c (nonexistent) +++ pr20348.c (revision 154) @@ -0,0 +1,16 @@ +/* PR preprocessor/20348 */ +/* { dg-do compile } */ +/* { dg-options "-I$srcdir/gcc.dg/cpp -I$srcdir/gcc.dg/cpp/inc" } */ + +#include +#define MIDDLE +#include + +#ifndef PR20348_H_SEEN +# error pr20348.h not included after MIDDLE definition +#endif +#ifndef INC_PR20348_H_SEEN +# error inc/pr20348.h not included before MIDDLE definition +#endif + +int i;
pr20348.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro5.c =================================================================== --- macro5.c (nonexistent) +++ macro5.c (revision 154) @@ -0,0 +1,24 @@ +/* { dg-do preprocess } */ + +/* Test source Robert Lipe, with minor modifications for the testsuite + by Neil Booth. 29 Oct 2000. */ + +#define _VA_ARGS_0() 42 +#define _L_0() ( +#define _R_0() ) + +#define __VA_ARGLIST(argc,list) \ + _VA_ARGS_##argc list + +#define _CAT_LIST(argc,list1,list2) \ + _L_##argc list1 _R_##argc list2 + +#define _VA_ARGLIST(argc,list1,list2) \ + __VA_ARGLIST(argc, \ + _CAT_LIST(argc, list1, list2)) + +#define BLAH(a) _VA_ARGLIST(a, (), ()) + +#if BLAH (0) != 42 +#error Simulated varargs macros +#endif
macro5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr20348.h =================================================================== --- pr20348.h (nonexistent) +++ pr20348.h (revision 154) @@ -0,0 +1,9 @@ +#ifdef MIDDLE +# ifndef PR20348_H_SEEN +# define PR20348_H_SEEN +# else +# error pr20348.h included twice after MIDDLE definition +# endif +#else +# error pr20348.h included before MIDDLE definition +#endif
pr20348.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi5.c =================================================================== --- mi5.c (nonexistent) +++ mi5.c (revision 154) @@ -0,0 +1,13 @@ +/* Test "ignore redundant include" facility, with -C on. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do preprocess } + { dg-options "-H -C" } + { dg-error "mi1c\.h" "redundant include check with -C" { target *-*-* } 0 } */ + +#include "mi1c.h" +#include "mi1c.h"
mi5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cpp.exp =================================================================== --- cpp.exp (nonexistent) +++ cpp.exp (revision 154) @@ -0,0 +1,43 @@ +# Copyright (C) 1997, 2000, 2003, 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# There's a bunch of headers we need. +if [is_remote host] { + foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] { + remote_download host $header + } +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,S} ]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish Index: gnuc89-pedantic.c =================================================================== --- gnuc89-pedantic.c (nonexistent) +++ gnuc89-pedantic.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu89 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=gnu89 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL /* { dg-warning "long long" } */ +#endif
gnuc89-pedantic.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: widestr1.c =================================================================== --- widestr1.c (nonexistent) +++ widestr1.c (revision 154) @@ -0,0 +1,9 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation. + + by Alexandre Oliva */ + +/* { dg-do preprocess } */ + +#line 1 L"foo" /* { dg-error "not a valid filename" "wide string in #line" } */ +#include L"stdio.h" /* { dg-error "expects" "wide string in #include" } */ +
widestr1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: syshdr2.h =================================================================== --- syshdr2.h (nonexistent) +++ syshdr2.h (revision 154) @@ -0,0 +1,5 @@ +/* This file would generate an error because of #include_next, but the + #pragma marks it a system header, so the error is suppressed. */ + +#pragma GCC system_header +#include_next
syshdr2.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000628-1a.h =================================================================== --- 20000628-1a.h (nonexistent) +++ 20000628-1a.h (revision 154) @@ -0,0 +1,15 @@ +/* Included from 20000628-1.h. This header is supposed to be seen + exactly three times. */ + +#if !defined A +#define A +int a; +#elif !defined B +#define B +int b; +#elif !defined C +#define C +int c; +#else +#error Included a fourth time +#endif
20000628-1a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: strp2.c =================================================================== --- strp2.c (nonexistent) +++ strp2.c (revision 154) @@ -0,0 +1,23 @@ +/* { dg-do run } */ + +/* Test for odd corner cases in stringizing/pasting. + Taken more or less verbatim from C99 section 6.10.3.3. */ + +#include +#include + +#define hash_hash # ## # +#define mkstr(a) # a +#define in_between(a) mkstr(a) +#define join(c, d) in_between(c hash_hash d) + +const char p[] = join(x, y); +const char q[] = "x ## y"; + +int +main (void) +{ + if (strcmp (p, q)) + abort (); + return 0; +}
strp2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tr-warn5.c =================================================================== --- tr-warn5.c (nonexistent) +++ tr-warn5.c (revision 154) @@ -0,0 +1,14 @@ +/* Test for -Wtraditional warnings on the unary plus operator. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 8/22/2000. */ +/* { dg-do preprocess } */ +/* { dg-options "-Wtraditional -fno-show-column" } */ + +#if +1 /* { dg-warning "unary plus operator" "unary plus operator" } */ +#endif + +# 11 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +#if +1 +#endif
tr-warn5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: maccom5.c =================================================================== --- maccom5.c (nonexistent) +++ maccom5.c (revision 154) @@ -0,0 +1,18 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that C++ comments are converted to C comments + when saved in the macro and copied to the output file when the macro + is expanded when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def // passed + +def: + +/* + /* The + in the regexp prevents it from matching itself. */ + { dg-final { scan-file maccom5.i "p+assed" } } + { dg-final { scan-file-not maccom5.i "p+assed:" } } +*/
maccom5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: error-1.c =================================================================== --- error-1.c (nonexistent) +++ error-1.c (revision 154) @@ -0,0 +1,5 @@ +/* Test that error messages include "error:" in the text. */ +/* Origin: Joseph Myers */ +/* { dg-do preprocess } */ + +/* { dg-error "error: unterminated comment" }
error-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: _Pragma3.c =================================================================== --- _Pragma3.c (nonexistent) +++ _Pragma3.c (revision 154) @@ -0,0 +1,11 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Pragma buffers have a NULL "inc" member, which we would dereference + when getting a file's date and time. + + Based on PR 7526. 14 Aug 2002. */ + +#define GCC_PRAGMA(x) _Pragma (#x) +GCC_PRAGMA(GCC dependency "mi1c.h")
_Pragma3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused.c =================================================================== --- Wunused.c (nonexistent) +++ Wunused.c (revision 154) @@ -0,0 +1,38 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* Duplicate command line options should not warn. */ +/* { dg-options "-Wunused-macros -Dfoo -Dfoo" } */ + +/* Test everything related to -Wunused-macros. + + Source: Neil Booth, 23 Jul 2002. */ + +#include "Wunused.h" + +#define used1 /* { dg-bogus "used" } */ +#define used2 /* { dg-bogus "used" } */ +#define used3 /* { dg-bogus "used" } */ +#define used4 used4 /* { dg-bogus "used" } */ + +#define unused5 /* { dg-warning "used" } */ +#define unused6 /* { dg-warning "used" } */ +#define unused7() /* { dg-warning "used" } */ + +#if defined used1 +#endif +#ifdef used2 +#endif +#ifndef used3 +#endif +used4 + +unused7 /* This does not count as a use. */ + +#if 0 +unused5 /* This does not count as a use. */ +#endif +#undef unused5 + +#define unused6 +unused6
Wunused.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000129-1.c =================================================================== --- 20000129-1.c (nonexistent) +++ 20000129-1.c (revision 154) @@ -0,0 +1,15 @@ +/* Regression test for trigraph warnings. Under certain conditions we + got the line numbers wrong. + Originally exposed by XEmacs and reported by Martin Buchholz + ; this test case is synthetic. */ + +/* { dg-do preprocess } */ +/* { dg-options -Wall } */ + +#define some_macro \ + blah \ + blah \ + blah \ + blah + +??> /* { dg-warning "trigraph ..." "trigraph encountered" } */
20000129-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunused.h =================================================================== --- Wunused.h (nonexistent) +++ Wunused.h (revision 154) @@ -0,0 +1 @@ +#define unused_but_ok
Wunused.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: digraph2.c =================================================================== --- digraph2.c (nonexistent) +++ digraph2.c (revision 154) @@ -0,0 +1,19 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-std=c89" } */ + +/* Just simple check that digraphs are not on in c89, for both + preprocessor and compiler. digraphs.c is the general test. */ + +int main (int argc, char *argv[]) +{ + return 0; +%> /* { dg-error "parse error|syntax error|expected" } */ + +/* Place this after main () so we get to test both the compiler above + and the preprocessor below. */ +%:define glue /* { dg-error "expected declaration" } */ +#ifdef glue +#error glue is defined! +#endif
digraph2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste6.c =================================================================== --- paste6.c (nonexistent) +++ paste6.c (revision 154) @@ -0,0 +1,12 @@ +/* Regression test for paste appearing at the beginning of a set of + actual arguments. Original bug exposed by Linux kernel. Problem + reported by Jakub Jelinek . */ + +/* { dg-do compile } */ + +extern int foo(int x); + +#define bar(x) foo(x) +#define baz(x) bar(##x) + +int quux(int y) { return baz(y); } /* { dg-warning "valid preprocessing" } */
paste6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucnid-5.c =================================================================== --- ucnid-5.c (nonexistent) +++ ucnid-5.c (revision 154) @@ -0,0 +1,17 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -pedantic -fextended-identifiers" } */ + +\u00AA +\u00AB /* { dg-error "not valid in an identifier" } */ +\u00B6 /* { dg-error "not valid in an identifier" } */ +\u00BA +\u00C0 +\u00D6 +\u0384 /* { dg-error "not valid in an identifier" } */ + +\u0669 /* { dg-error "not valid at the start of an identifier" } */ +A\u0669 +0\u00BA +0\u0669 +\u0E59 /* { dg-error "not valid at the start of an identifier" } */ +A\u0E59
ucnid-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: include2.c =================================================================== --- include2.c (nonexistent) +++ include2.c (revision 154) @@ -0,0 +1,16 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests that #include does not allow the terminating '>' or '"' to be + escaped, as per the standard. */ + +/* Source: Neil Booth, 4 Nov 2000. */ + +#include > /* { dg-warning "extra tokens" "" } */ +#include "silly\"" /* { dg-warning "extra tokens" "" } */ + +/* These error is No such file or directory, just once. However, this + message is locale-dependent, so don't test for it. */ +/* { dg-error "silly" "" { target *-*-* } 10 } */ +/* { dg-error "missing" "" { target *-*-* } 11 } */
include2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vararg4.c =================================================================== --- vararg4.c (nonexistent) +++ vararg4.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -std=gnu99 } */ + +/* Source: Neil Booth, 6 Aug 2002. + + Tests that we DTRT with varargs commas. */ + +#define g(a, ...) a , ## __VA_ARGS__ + +/* The comma from g's expansion should be retained. */ +#if g (2, ) 3 /* { dg-bogus "missing binary operator" } */ +#endif
vararg4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: line4.c =================================================================== --- line4.c (nonexistent) +++ line4.c (revision 154) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +/* Test #line with and without macros for the line number. */ + +extern void abort (void); + +#define L 90 + +#line 44 +enum { i = __LINE__ }; + +#line L +enum { j = __LINE__ }; + +#line 16 /* N.B. the _next_ line is line 16. */ + +char array1[i == 44 ? 1 : -1]; +char array2[j == 90 ? 1 : -1]; +char array3[__LINE__ == 19 ? 1 : -1];
line4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wmissingdirs.c =================================================================== --- Wmissingdirs.c (nonexistent) +++ Wmissingdirs.c (revision 154) @@ -0,0 +1,7 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99 -I /jolly/well/better/not/exist -Wmissing-include-dirs -fno-show-column" } */ + +/* Test that -Wmissing-include-dirs issues a warning when a specified + directory does not exist. Source Ben Elliston, 2004-05-13. */ + +/* { dg-warning "No such file or directory" "-Wmissing-include-dirs" { target *-*-* } 0 } */
Wmissingdirs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19990409-1.c =================================================================== --- 19990409-1.c (nonexistent) +++ 19990409-1.c (revision 154) @@ -0,0 +1,6 @@ +/* Test that __LINE__ works when embedded in a macro. */ +/* { dg-do compile } */ + +#define XLINE __LINE__ + +char array[XLINE == __LINE__ ? 1 : -1];
19990409-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro6.c =================================================================== --- macro6.c (nonexistent) +++ macro6.c (revision 154) @@ -0,0 +1,32 @@ +/* { dg-do run } */ + +/* Test that, when a macro expansion spills into the source file, we + expand macros we suck in from there, as the standard clearly states + they are not nested. + + Submitter: Neil Booth, with minor modifications to the originals. 3 + Dec 2000. + Source: PR 962 and Thomas Pornin. */ + +extern void abort (void); +int e = 10, f = 100; + +#define e(n) 4 + n +#define X e +#define f(x) x +#define h(x) x + f + +int +main () +{ + if (X(X) != 14) /* Should expand to "4 + e". */ + abort (); + + if (X(X(f)) != 108) /* Should expand to "4 + 4 + f". */ + abort (); + + if (h(e)(h(e)) != 120) /* Should expand to "e + e + f". */ + abort (); + + return 0; +}
macro6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dN-M.c =================================================================== --- cmdlne-dN-M.c (nonexistent) +++ cmdlne-dN-M.c (revision 154) @@ -0,0 +1,15 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dN -M" } */ + +/* Test -dN -M does not fail. It should print just + the Makefile rule with dependencies. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file-not cmdlne-dN-M.i "(^|\\n)#define foo" } } + { dg-final { scan-file-not cmdlne-dN-M.i "variable" } } + { dg-final { scan-file cmdlne-dN-M.i "(^|\\n)cmdlne-dM-M\[^\\n\]*:\[^\\n\]*cmdlne-dM-M.c" { xfail *-*-* } } } */
cmdlne-dN-M.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi6.c =================================================================== --- mi6.c (nonexistent) +++ mi6.c (revision 154) @@ -0,0 +1,61 @@ +/* Another test case for over-eager multiple include optimization, + where the leading "#if !defined" expression is obtained partially, + or wholly, from macros. Neil Booth, 30 Sep 2001. */ + +/* { dg-do compile } */ +/* { dg-options "" } */ + +extern void abort (void); + +/* Each include file should not be subject to MI optimisation, since + macro definitions can change. Each header increments the variable + VAR if it is defined. + + The first set of inclusions gets the headers into CPP's cache, but + does nothing since VAR is not defined. The second set should each + increment VAR, since none of the initial set should have been + flagged as optimizable. */ + +#define EMPTYL +#define EMPTYR +#define NOT ! +#define DEFINED defined (guard) +#define NOT_DEFINED ! defined (guard) + +#include "mi6a.h" +#include "mi6b.h" +#include "mi6c.h" +#include "mi6d.h" +#include "mi6e.h" + +/* Define the macro guard, and redefine the macros to something that + forces compilation of the conditional blocks. */ +#define guard +#undef EMPTYL +#define EMPTYL 1 || +#undef EMPTYR +#define EMPTYR || 1 +#undef NOT +#define NOT +#undef DEFINED +#define DEFINED 0 +#undef NOT_DEFINED +#define NOT_DEFINED 1 + +#define VAR five + +int +main(void) +{ + unsigned int five = 0; + +#include "mi6a.h" +#include "mi6b.h" +#include "mi6c.h" +#include "mi6d.h" +#include "mi6e.h" + + if (five != 5) + abort (); + return 0; +}
mi6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: escape-1.c =================================================================== --- escape-1.c (nonexistent) +++ escape-1.c (revision 154) @@ -0,0 +1,39 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* This tests various diagnostics about escape sequences, for both + the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '\x' /* { dg-error "no following" "\x with no digits" } */ +#endif +#if '\x400' /* { dg-warning "out of range" "\x out of range" } */ +#endif +#if '\x0ff' /* { dg-bogus "out of range" "\x out of range" } */ +#endif +#if '\400' /* { dg-warning "out of range" "\x out of range" } */ +#endif +#if '\377' /* { dg-bogus "out of range" "bogus \x out of range" } */ +#endif +#if '\177' != 0x7f /* { dg-bogus "out of range" "bogus \x out of range" } */ +#error bad octal /* { dg-bogus "bad" "bad octal evaluation" } */ +#endif +#if '\0377' /* { dg-warning "multi" "too long octal" } */ +#endif +#if '\p' /* { dg-error "unknown escape" "unknown escape seq" } */ +#endif + +void foo () +{ + int c; + + c = '\x'; /* { dg-error "no following" "\x with no digits" } */ + c = '\x100'; /* { dg-warning "out of range" "\x out of range" } */ + c = '\x0ff'; /* { dg-bogus "out of range" "\x out of range" } */ + c = '\400'; /* { dg-warning "out of range" "\x out of range" } */ + c = '\377'; /* { dg-bogus "out of range" "bogus \x out of range" } */ + c = '\0377'; /* { dg-warning "multi" "too long octal" } */ + c = '\p'; /* { dg-error "unknown escape" "unknown escape seq" } */ +}
escape-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pragma-once-1b.h =================================================================== --- pragma-once-1b.h (nonexistent) +++ pragma-once-1b.h (revision 154) @@ -0,0 +1,8 @@ +#ifndef _B_H_ +#define _B_H_ + +#pragma once + +#include "pragma-once-1c.h" + +#endif
pragma-once-1b.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: multiline.c =================================================================== --- multiline.c (nonexistent) +++ multiline.c (revision 154) @@ -0,0 +1,25 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. */ +/* { dg-do preprocess } */ +/* { dg-options "-C" } */ +/* Test that multi-line tokens are recognized by cpp0 as being + multiline . Source: Neil Booth, 17 Dec 2000. */ +/* Line 1 + Line 2 + Line 3 + Line 4 +*/ +"line 1 + line 2 + line 3 + line 4" +L"line 1 + line 2 + line 3 + line 4" +/* Nowhere in the output of this file should there be a blank line. + We check for that in the .i file. + { dg-final { scan-file-not multiline.i "(^|\\n)\\n" } } */ +/* { dg-warning "missing term" "multiline strings" { target *-*-* } 11 } */ +/* { dg-warning "missing term" "multiline strings" { target *-*-* } 14 } */ +/* { dg-warning "missing term" "multiline strings" { target *-*-* } 15 } */ +/* { dg-warning "missing term" "multiline strings" { target *-*-* } 18 } */
multiline.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: skipping2.c =================================================================== --- skipping2.c (nonexistent) +++ skipping2.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests that excess tokens in skipped conditional blocks don't warn. */ + +/* Source: Neil Booth, 25 Jul 2001. */ + +#if 0 +#if foo +#else foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */ +#endif foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */ +#endif bar /* { dg-warning "extra tokens" "tokens after #endif" } */ +
skipping2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c99-hexfloat-3.c =================================================================== --- c99-hexfloat-3.c (nonexistent) +++ c99-hexfloat-3.c (revision 154) @@ -0,0 +1,6 @@ +/* Test for hex floating point constants: in C99 only. Compiler test. */ +/* Origin: Michael Matz */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +double d = 0x.2p2; /* { dg-bogus "radix 16" "bogus C99 hex float error" } */
c99-hexfloat-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tr-warn6.c =================================================================== --- tr-warn6.c (nonexistent) +++ tr-warn6.c (revision 154) @@ -0,0 +1,27 @@ +/* Test for -Wtraditional warnings for stringification of macro args. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi 9/8/2000. */ +/* { dg-do preprocess } */ +/* { dg-options "-Wtraditional -fno-show-column" } */ + +#define foo1(h) sdf "h3" fds "h" /* { dg-warning "macro argument \"h\" would be stringified" "traditional stringification" } */ +#define foo2(h2) sdf "h2" fds "h3" /* { dg-warning "macro argument \"h2\" would be stringified" "traditional stringification" } */ +#define foo3(h3) sdf "h2" fds "h3" /* { dg-warning "macro argument \"h3\" would be stringified" "traditional stringification" } */ +#define foo4(h) sdf 'h3' fds 'h' /* { dg-warning "macro argument \"h\" would be stringified" "traditional stringification" } */ +#define foo5(h2) sdf 'h2' fds 'h3' /* { dg-warning "macro argument \"h2\" would be stringified" "traditional stringification" } */ +#define foo6(h3) sdf 'h2' fds 'h3' /* { dg-warning "macro argument \"h3\" would be stringified" "traditional stringification" } */ +#define foo7(AA, hello, world, EEE) sdf "A B hello C,world,DhelloE F" fds EEE /* { dg-warning "macro argument \"hello\" would be stringified" "traditional stringification" } */ + +/* Catch the second warning from the above line. */ +/* { dg-warning "macro argument \"world\" would be stringified" "traditional stringification second warning" { target *-*-* } 13 } */ + +# 19 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +#define bar1(h) sdf "h3" fds "h" +#define bar2(h2) sdf "h2" fds "h3" +#define bar3(h3) sdf "h2" fds "h3" +#define bar4(h) sdf 'h3' fds 'h' +#define bar5(h2) sdf 'h2' fds 'h3' +#define bar6(h3) sdf 'h2' fds 'h3' +#define bar7(AA, hello, world, EEE) sdf "A B hello C,world,DhelloE F" fds EEE
tr-warn6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: assert1.c =================================================================== --- assert1.c (nonexistent) +++ assert1.c (revision 154) @@ -0,0 +1,46 @@ +/* Basic tests of the #assert preprocessor extension. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#define def unused expansion +#define fail int fail + +#assert abc (def) +#assert abc (ghi) +#assert abc (jkl) +#assert space ( s p a c e ) + +/* Basic: */ +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) +fail +#endif + +/* any answer for #abc */ +#if !#abc +fail +#endif + +/* internal whitespace is collapsed, + external whitespace is deleted */ +#if !#space (s p a c e) || !#space ( s p a c e ) || #space (space) +fail +#endif + +/* removing assertions */ +#unassert abc (jkl) +#if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl) +fail +#endif + +#unassert abc +#if #abc || #abc (def) || #abc (ghi) || #abc (jkl) +fail +#endif + +int gobble + +/* make sure it can succeed too. + also check space before open paren isn't significant */ +#if #space(s p a c e) +; +#endif
assert1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000301-1.c =================================================================== --- 20000301-1.c (nonexistent) +++ 20000301-1.c (revision 154) @@ -0,0 +1,3 @@ +/* { dg-do preprocess } */ +/* Test for crash with indented empty definitions. */ + #define _LIBC_LIMITS_H_ /* nothing */
20000301-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi1x.h =================================================================== --- mi1x.h (nonexistent) +++ mi1x.h (revision 154) @@ -0,0 +1,9 @@ +/* This header is never to have its contents visible, but it should + still receive the optimization. */ + +#ifndef MIX_H +#define MIX_H + +#define main wibble + +#endif
mi1x.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c94-pedantic.c =================================================================== --- c94-pedantic.c (nonexistent) +++ c94-pedantic.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:199409 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=iso9899:199409 + -pedantic mode. Neil Booth, 2 Dec 2000. */ + +#if 1LL /* { dg-warning "long long" } */ +#endif
c94-pedantic.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: maccom6.c =================================================================== --- maccom6.c (nonexistent) +++ maccom6.c (revision 154) @@ -0,0 +1,20 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that expressions function properly + when used with macros containing comments and the -CC option + is being used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define ONE 1 /* one */ +#define TWO 2 /* two */ +#define THREE 3 /* three */ + +#if (ONE + TWO) != THREE +failed +#else +passed +#endif + +/* { dg-final { scan-file maccom6.i "(^|\n)passed" } } */
maccom6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pragma-once-1.c =================================================================== --- pragma-once-1.c (nonexistent) +++ pragma-once-1.c (revision 154) @@ -0,0 +1,8 @@ +/* PR preprocessor/15167 */ +/* Origin: Roland Meub */ + +/* { dg-do compile } */ +/* { dg-options "-I." } */ + +#include "inc/pragma-once-1a.h" +#include "pragma-once-1d.h"
pragma-once-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wtrigraphs-2.c =================================================================== --- Wtrigraphs-2.c (nonexistent) +++ Wtrigraphs-2.c (revision 154) @@ -0,0 +1,20 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -Wtrigraphs -fno-show-column" } */ + +/* Test warnings for trigraphs in comments, with trigraphs enabled. + Neil Booth. 4 May 2003. */ + +/* { dg-bogus "converted" } Test ??< ??= a few ??/ random things in + { dg-warning "converted" } some ??/ + { dg-bogus "converted" } ??< comments. */ + +// { dg-bogus "converted" } More ??/ comment ??> tests. + +// { dg-warning "converted" } Another ??/ + Test + +// { dg-warning "converted" } And another with space after ??/ + the escape + +// { dg-bogus "converted" } A tricky one ??/\ +
Wtrigraphs-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: _Pragma4.c =================================================================== --- _Pragma4.c (nonexistent) +++ _Pragma4.c (revision 154) @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ + +/* Based on Debian GNATS PR 157416. 3 Sep 2002. */ + +#define b foo _Pragma ("bar") baz +a b c + +/* { dg-final { scan-file "_Pragma4.i" "(^|\\n)#pragma bar($|\\n)" } } */
_Pragma4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ident-1.c =================================================================== --- ident-1.c (nonexistent) +++ ident-1.c (revision 154) @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ +/* { dg-options "" } */ /* shut off -pedantic */ + +/* Based on PR 16999 */ + +#ident "this is an ident" + +/* { dg-final { scan-file "ident-1.i" "(^|\\n)#ident \"this is an ident\"($|\\n)" } } */
ident-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi6a.h =================================================================== --- mi6a.h (nonexistent) +++ mi6a.h (revision 154) @@ -0,0 +1,5 @@ +#if NOT_DEFINED + #ifdef VAR + VAR++; + #endif +#endif
mi6a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste7.c =================================================================== --- paste7.c (nonexistent) +++ paste7.c (revision 154) @@ -0,0 +1,19 @@ +/* { dg-do run } */ + +#define D_2 1, 2 +#define C_2(X, I0, I1) X##_a = I0, X##_b = I1 +#define B_2(X, I) C_2(X, I) +#define A(N, X) B_##N (X, D_##N) + +extern void abort(void); +extern void exit(int); + +int x_a, x_b; + +int main(void) +{ + A(2, x); + if (x_a != 1 || x_b != 2) + abort(); + exit(0); +}
paste7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucnid-6.c =================================================================== --- ucnid-6.c (nonexistent) +++ ucnid-6.c (revision 154) @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c89" } */ +#define a b( +#define b(x) q +int a\u00aa);
ucnid-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: include3.c =================================================================== --- include3.c (nonexistent) +++ include3.c (revision 154) @@ -0,0 +1,7 @@ +/* Unpatched, this file would include "inc/ foo.h" (note the space) */ + +#define PREINC_XSTR(str) #str +#define PREINC_STR(str) PREINC_XSTR(str) +#define COMP_INC(comp,file) PREINC_STR(comp/file) + +#include COMP_INC(inc, foo.h)
include3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: line5.c =================================================================== --- line5.c (nonexistent) +++ line5.c (revision 154) @@ -0,0 +1,15 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fpreprocessed" } */ + +/* Source: Neil Booth, 16 Sep 2001. + + This file, with an indented line marker, is not possible without + user editing of preprocessed output, or the user using + -fpreprocessed on raw source. Nevertheless, we should not + segfault. This is a test that we don't back up two tokens in + cpplib.c - one to back up over the number, and one when we + recognize that it's not a valid directive in preprocessed input. */ + + # 1 "foo.c"
line5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-oppr.c =================================================================== --- if-oppr.c (nonexistent) +++ if-oppr.c (revision 154) @@ -0,0 +1,97 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* Test the full range of preprocessor operator precedence. Each + operator is tested with one of immediately higher precedence to + verify it is of strictly lower precedence. To avoid complications, + each test uses just those two operators. Occasionally this assumes + correct operation of if-then-else, so the first tests verify this. */ + +/* { dg-do preprocess } */ + +/* Ensure correct functioning of if-then-else. */ +#if 1 +#else +#error #else block evaluated for true conditional +#endif + +#if 0 +#error #if block evaluated for false conditional +#else +#endif + +/* , not higher than ?. This is not a syntax error if it is. */ +#if 1 ? 0, 1: 1 /* { dg-error "without" "? higher precedence than ," } */ +#error +#endif + +/* : strictly higher than ?. This would give a syntax error otherwise. */ +#if 0 ? 0 : 1 ? 1 : 1 +#endif + +/* || strictly higher than ?:. */ +#if 1 ? 0: 0 || 1 +#error operator ?: has higher precedence than operator || +#endif + +/* && strictly higher than ||. */ +#if 1 || 0 && 0 +#else +#error operator || has higher precedence than operator && +#endif + +/* | strictly higher than &&. */ +#if 0 && 0 | 1 +#error operator && has higher precedence than operator | +#endif + +/* ^ strictly higher than |. */ +#if 1 | 0 ^ 1 +#else +#error operator | has higher precedence than operator ^ +#endif + +/* & strictly higher than ^. */ +#if 1 ^ 0 & 0 +#else +#error operator ^ has higher precedence than operator & +#endif + +/* == (!=) strictly higher than &. */ +#if 0 & 0 == 0 +#error operator & has higher precedence than operator == +#endif + +/* < (>, <=, >=) strictly higher than == (!=). */ + +#if 0 == 0 < 0 +#else +#error operator == has higher precedence than operator < +#endif + +/* << (>>) strictly higher than < (>, <=, >=). */ +#if 1 < 1 << 1 +#else +#error operator < has higher precedence than operator << +#endif + +/* Binary + (-) strictly higher than << (>>). */ +#if 0 << 0 + 1 +#error operator << has higher precedence than binary + +#endif + +/* Binary * (/, %) strictly higher than binary + (-). */ +#if 1 + 0 * 0 +#else +#error binary + has higher precedence than binary * +#endif + +/* Unary operators (!, ~, -, +) strictly higher than binary * (/, %). + Equality is hard to detect because of right-associativity. */ +#if ~1 * 0 +#error binary * has higher precedence than operator ~ +#endif + +/* () > Unary. Unfortunately this requires an additional operator. */ +#if -(1 - 1) +#error unary - has higher precedence than operator () +#endif
if-oppr.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gnuc89.c =================================================================== --- gnuc89.c (nonexistent) +++ gnuc89.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu89" } */ + +/* This file is for testing the preprocessor in -std=gnu89 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif
gnuc89.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19960224-1.c =================================================================== --- 19960224-1.c (nonexistent) +++ 19960224-1.c (revision 154) @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ + +#if 0 +#if 0 +#endif \ +\ + +#endif
19960224-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-C.c =================================================================== --- cmdlne-C.c (nonexistent) +++ cmdlne-C.c (revision 154) @@ -0,0 +1,37 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -C } */ + +/* 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
cmdlne-C.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: usr/include/stdio.h =================================================================== --- usr/include/stdio.h (nonexistent) +++ usr/include/stdio.h (revision 154) @@ -0,0 +1,4 @@ +/* Used by gcc.dg/cpp/isysroot-1.c to test isysroot. */ +void foo() +{ +}
usr/include/stdio.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro7.c =================================================================== --- macro7.c (nonexistent) +++ macro7.c (revision 154) @@ -0,0 +1,10 @@ +/* { dg-do preprocess } */ + +/* Test we don't complain about directives in macro expansions when + looking for the '(' of a function-like macro. + + Submitter: Neil Booth. 3 Mar 2000. */ + +#define f(x) x +f +#define g
macro7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: isysroot-1.c =================================================================== --- isysroot-1.c (nonexistent) +++ isysroot-1.c (revision 154) @@ -0,0 +1,10 @@ +/* { dg-options "-isysroot ${srcdir}/gcc.dg/cpp" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include +int main() +{ + /* Special stdio.h supplies function foo. */ + void (*x)(void) = foo; + return 0; +}
isysroot-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-unary.c =================================================================== --- if-unary.c (nonexistent) +++ if-unary.c (revision 154) @@ -0,0 +1,32 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test the various unary operators. */ + +#if 1 + + + 1 /* allow multiple unary sign operators :) */ +#endif + +#if 8 - +3 != +4 + +1 +#error /* { dg-bogus "error" "unary +" } */ +#endif + +#if -2 - -1 != -1 +#error /* { dg-bogus "error" "unary -" } */ +#endif + +#if ~0 != -1 +#error /* { dg-bogus "error" "unary ~" } */ +#endif + +#if !0 && (!1 == 0) && !!1 != 1 +#error /* { dg-bogus "error" "unary !" } */ +#endif + +#if ~~8 != 8 +#error /* { dg-bogus "error" "double unary ~" } */ +#endif + +#if 5 + +!-4 != 5 +#error /* { dg-bogus "error" "compound unary +, !, -" } */ +#endif
if-unary.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi7.c =================================================================== --- mi7.c (nonexistent) +++ mi7.c (revision 154) @@ -0,0 +1,19 @@ +/* Test "ignore redundant include" facility. + + -H is used because cpp might confuse the issue by optimizing out + #line markers. This test only passes if the headers is read + twice. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do preprocess } + { dg-options "-H" } + { dg-error "mi7a\.h\n\[^\n\]*mi7a\.h\n\[^\n\]*mi7b\.h\n\[^\n\]*mi7b\.h" "redundant include check" { target *-*-* } 0 } */ + +#include "mi7a.h" +#include "mi7a.h" +#include "mi7b.h" +#include "mi7b.h"
mi7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: direct2.c =================================================================== --- direct2.c (nonexistent) +++ direct2.c (revision 154) @@ -0,0 +1,46 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 8 May 2001 */ + +/* Test of prohibition on directives which result from macro expansion. + See also direct2s.c */ + +/* { dg-do compile } */ + +#define HASH # +#define HASHDEFINE #define +#define HASHINCLUDE #include + +HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/ +/*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 13 }*/ +int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" { target *-*-* } 13 }*/ + +HASHINCLUDE /*{ dg-error "stray|expected" "non-include 2" }*/ +/*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 17 }*/ +int resync_parser_2; + +void g1 () +{ +HASH define X 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "# from macro" } */ + int resync_parser_3; +} + +void g2 () +{ +HASHDEFINE Y 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "#define from macro" } */ + int resync_parser_4; +} + +#pragma GCC dependency "direct2.c" +# + +void f () +{ + int i = X; /* { dg-error "undeclared|for each" "no macro X" } */ + int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */ +} + +#define slashstar /##* +#define starslash *##/ + +slashstar starslash /* { dg-error "parse error|syntax error|expected" "not a comment" } */ +/* { dg-warning "does not give" "paste warning(s)" { target *-*-* } 45 } */
direct2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macspace1.c =================================================================== --- macspace1.c (nonexistent) +++ macspace1.c (revision 154) @@ -0,0 +1,63 @@ +/* PR preprocessor/19475 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors -fno-show-column" } */ + +#define a! /* { dg-warning "missing whitespace" } */ +#define b" /* { dg-warning "missing whitespace" } */ +#define c# /* { dg-warning "missing whitespace" } */ +#define d% /* { dg-warning "missing whitespace" } */ +#define e& /* { dg-warning "missing whitespace" } */ +#define f' /* { dg-warning "missing whitespace" } */ +#define g) /* { dg-warning "missing whitespace" } */ +#define h* /* { dg-warning "missing whitespace" } */ +#define i+ /* { dg-warning "missing whitespace" } */ +#define j, /* { dg-warning "missing whitespace" } */ +#define k- /* { dg-warning "missing whitespace" } */ +#define l. /* { dg-warning "missing whitespace" } */ +#define m/ /* { dg-warning "missing whitespace" } */ +#define n: /* { dg-warning "missing whitespace" } */ +#define o; /* { dg-warning "missing whitespace" } */ +#define p< /* { dg-warning "missing whitespace" } */ +#define q= /* { dg-warning "missing whitespace" } */ +#define r> /* { dg-warning "missing whitespace" } */ +#define s? /* { dg-warning "missing whitespace" } */ +#define t[ /* { dg-warning "missing whitespace" } */ +#define u] /* { dg-warning "missing whitespace" } */ +#define v^ /* { dg-warning "missing whitespace" } */ +#define w{ /* { dg-warning "missing whitespace" } */ +#define x| /* { dg-warning "missing whitespace" } */ +#define y} /* { dg-warning "missing whitespace" } */ +#define z~ /* { dg-warning "missing whitespace" } */ +#define A>> /* { dg-warning "missing whitespace" } */ +#define B<< /* { dg-warning "missing whitespace" } */ +#define E&& /* { dg-warning "missing whitespace" } */ +#define F|| /* { dg-warning "missing whitespace" } */ +#define G== /* { dg-warning "missing whitespace" } */ +#define H!= /* { dg-warning "missing whitespace" } */ +#define I>= /* { dg-warning "missing whitespace" } */ +#define J<= /* { dg-warning "missing whitespace" } */ +#define K+= /* { dg-warning "missing whitespace" } */ +#define L-= /* { dg-warning "missing whitespace" } */ +#define M*= /* { dg-warning "missing whitespace" } */ +#define N/= /* { dg-warning "missing whitespace" } */ +#define O%= /* { dg-warning "missing whitespace" } */ +#define P&= /* { dg-warning "missing whitespace" } */ +#define Q|= /* { dg-warning "missing whitespace" } */ +#define R^= /* { dg-warning "missing whitespace" } */ +#define S>>= /* { dg-warning "missing whitespace" } */ +#define T<<= /* { dg-warning "missing whitespace" } */ +#define W... /* { dg-warning "missing whitespace" } */ +#define X++ /* { dg-warning "missing whitespace" } */ +#define Y-- /* { dg-warning "missing whitespace" } */ +#define Z-> /* { dg-warning "missing whitespace" } */ +#define aa:: /* { dg-warning "missing whitespace" } */ +#define ab->* /* { dg-warning "missing whitespace" } */ +#define ac.* /* { dg-warning "missing whitespace" } */ +#define ad\x /* { dg-warning "missing whitespace" } */ +#define ae\\x /* { dg-warning "missing whitespace" } */ +#define af'1' /* { dg-warning "missing whitespace" } */ +#define ag"abc" /* { dg-warning "missing whitespace" } */ + +int dummy; +/* { dg-error "missing terminating" "" { target *-*-* } 6 } */ +/* { dg-error "missing terminating" "" { target *-*-* } 10 } */
macspace1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000519-1.c =================================================================== --- 20000519-1.c (nonexistent) +++ 20000519-1.c (revision 154) @@ -0,0 +1,10 @@ +/* Regression test for preprocessor crash. + Reported by Mathias Froehlich . */ +/* { dg-do preprocess } */ +#define foo + +#define __CAT__(a,b,c,d) a##b##c##d +#define CAT(a,b,c,d) __CAT__(a,b,c,d) + +#define bar CAT(,foo,bar,) +bar
20000519-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pragma-once-1c.h =================================================================== --- pragma-once-1c.h (nonexistent) +++ pragma-once-1c.h (revision 154) @@ -0,0 +1,6 @@ +#ifndef _C_H_ +#define _C_H_ + +#include "pragma-once-1b.h" + +#endif
pragma-once-1c.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c94.c =================================================================== --- c94.c (nonexistent) +++ c94.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:199409" } */ + +/* This file is for testing the preprocessor in -std=iso9899:199409 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif
c94.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: escape-2.c =================================================================== --- escape-2.c (nonexistent) +++ escape-2.c (revision 154) @@ -0,0 +1,20 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-pedantic -std=c99 -fno-show-column" } */ + +/* This tests various diagnostics with -pedantic about escape + sequences, for both the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '\e' /* { dg-warning "non-ISO" "non-ISO \\e" } */ +#endif +#if L'\u00a0' /* { dg-bogus "unknown" "\\u is known in C99" } */ +#endif + +void foo () +{ + int c = '\E'; /* { dg-warning "non-ISO" "non-ISO \\E" } */ + c = L'\u00a0'; /* { dg-bogus "unknown" "\\u is known in C99" } */ +}
escape-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: escape.c =================================================================== --- escape.c (nonexistent) +++ escape.c (revision 154) @@ -0,0 +1,25 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-Wtraditional -std=c89 -fno-show-column" } */ + +/* This tests various diagnostics with -Wtraditioanl about escape + sequences, for both the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '\a' /* { dg-warning "traditional" "traditional bell" } */ +#endif +#if '\x1a' != 26 /* { dg-warning "traditional" "traditional hex" } */ + #error bad hex /* { dg-bogus "bad" "bad hexadecimal evaluation" } */ +#endif +#if L'\u00a1' /* { dg-warning "only valid" "\u is unknown in C89" } */ +#endif + +void foo () +{ + int c = '\a'; /* { dg-warning "traditional" "traditional bell" } */ + + c = '\xa1'; /* { dg-warning "traditional" "traditional hex" } */ + c = L'\u00a1'; /* { dg-warning "only valid" "\u is unknown in C89" } */ +}
escape.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-sc.c =================================================================== --- if-sc.c (nonexistent) +++ if-sc.c (revision 154) @@ -0,0 +1,26 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test that all operators correctly short circuit. */ + +#if (2 || 3 / 0) != 1 +#error /* { dg-bogus "error" "|| short circuit" } */ +#endif + +#if 0 && 3 / 0 +#error /* { dg-bogus "error" "&& short circuit" } */ +#endif + +#if 1 ? 0 : 3 / 0 +#error /* { dg-bogus "error" "? : right short circuit" } */ +#endif + +#if 0 ? 3 / 0 : 2 +#else +#error /* { dg-bogus "error" "? : left short circuit" } */ +#endif + +#if -1 ? 0 && 3 / 0 : 3 / 0 + 5 == 5 +#error /* { dg-bogus "error" "nested short circuiting" } */ +#endif
if-sc.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pragma-1.c =================================================================== --- pragma-1.c (nonexistent) +++ pragma-1.c (revision 154) @@ -0,0 +1,13 @@ +/* Verify that preprocessor does not insert redundant newlines + after #pragma */ +/* { dg-do compile } */ +int +main () +{ +#pragma unknown + { + error; + /* { dg-error "undeclared" "undeclared-variable message" { target *-*-* } { 9 } } */ + /* { dg-error "function it appears in" "reminder message" { target *-*-* } { 9 } } */ + } +}
pragma-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19940712-1.c =================================================================== --- 19940712-1.c (nonexistent) +++ 19940712-1.c (revision 154) @@ -0,0 +1,19 @@ +/* { dg-do preprocess } */ +/* PR 4713 */ + +/* dg.exp doesn't read the header files for magic comments. */ +/* { dg-error "unterminated comment" "" { target *-*-* } 4 } */ +/* { dg-error "unterminated comment" "header error" { target *-*-* } 8 } */ + +#include "19940712-1.h" /* { dg-error "" } // In file included from: */ +#include "19940712-1a.h" /* { dg-error "" } // In file included from: */ +#include "19940712-1b.h" + +/* comment start in comment error +/* in a .c file */ + +int main () +{ + return 0; +} +
19940712-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: empty-include.c =================================================================== --- empty-include.c (nonexistent) +++ empty-include.c (revision 154) @@ -0,0 +1,13 @@ +/* + * Copyright 2004 Free Software Foundation, Inc. + * Contributed and written by Nathanael Nerode. + * + * GCC 3.4 would attempt to open stdin as the included file + * (PR 17610), causing a sort of hang. + * + * We should get an error. + */ + +/* {dg-do preprocess} */ +#include "" /* { dg-error "empty" "error on empty filename in include" } */ +int x; /* Otherwise we have an empty file and get more errors. */
empty-include.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19940712-1.h =================================================================== --- 19940712-1.h (nonexistent) +++ 19940712-1.h (revision 154) @@ -0,0 +1,10 @@ +/* comment start in comment error +/* in a .h file */ + +#if 0 +#endif /* comment start in comment error +/* after a cpp directive */ + +/* comment start in comment error + +
19940712-1.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: assert2.c =================================================================== --- assert2.c (nonexistent) +++ assert2.c (revision 154) @@ -0,0 +1,24 @@ +/* Malformed assertion tests. */ +/* { dg-do preprocess } */ +/* { dg-options "-fno-show-column" } */ + +#assert /* { dg-error "without predicate" "assert w/o predicate" } */ +#assert % /* { dg-error "an identifier" "assert punctuation" } */ +#assert 12 /* { dg-error "an identifier" "assert number" } */ +#assert abc /* { dg-error "missing" "assert w/o answer" } */ + +#if # /* { dg-error "without predicate" "test w/o predicate" } */ +#endif + +#if #% /* { dg-error "an identifier" "test punctuation" } */ +#endif + +#if #12 /* { dg-error "an identifier" "test number" } */ +#endif + +#if #abc +#error /* { dg-bogus "error" "test w/o answer" } */ +#endif + +#if #abc[def] /* { dg-error "is not valid" "test with malformed answer" } */ +#endif
assert2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19990119-1.c =================================================================== --- 19990119-1.c (nonexistent) +++ 19990119-1.c (revision 154) @@ -0,0 +1,9 @@ +/* This checks for two things: + - an obscure corner case in the standard rules for __LINE__ + - regression of an associated bug in cpplib where the semicolon got lost */ +/* { dg-do compile } */ + +enum { i = __LINE__\ +}; + +char array[i == 6 ? 1 : -1];
19990119-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dD.c =================================================================== --- cmdlne-dD.c (nonexistent) +++ cmdlne-dD.c (revision 154) @@ -0,0 +1,12 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -dD } */ + +/* Test -dD does not fail. */ + +#define objlike obj like +#define funlike(like) fun like +#define funlike2(fun, like) fun ## like +#define varargs(x, ...) x #x __VA_ARGS__ +#define gnu_varargs(x, y...) x ## y
cmdlne-dD.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000207-1.c =================================================================== --- 20000207-1.c (nonexistent) +++ 20000207-1.c (revision 154) @@ -0,0 +1,16 @@ +/* { dg-do preprocess } */ + +/* Test for proper handling of unary minus in #if. */ + +#if !(-1) +#error Error /* { dg-bogus "Error" "case !(-1)" } */ +#endif + +#if !-1 +#error Error /* { dg-bogus "Error" "case !-1" } */ +#endif + +#if -1 +#else +#error Error /* { dg-bogus "Error" "case -1" } */ +#endif
20000207-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: _Pragma5.c =================================================================== --- _Pragma5.c (nonexistent) +++ _Pragma5.c (revision 154) @@ -0,0 +1,10 @@ +/* { dg-do preprocess } */ + +/* Based on Debian GNATS PR 8524. 17 Nov 2002. */ + +#define ALPHA(A) alpha_ ## A +#define BETA(B) beta_ ## B +#define GAMMA(C) _Pragma("moose") ALPHA(C) BETA(C) +GAMMA(baz); + +/* { dg-final { scan-file "_Pragma5.i" "alpha_baz beta_baz;" } } */
_Pragma5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000725-1.c =================================================================== --- 20000725-1.c (nonexistent) +++ 20000725-1.c (revision 154) @@ -0,0 +1,3 @@ +/* { dg-do preprocess } */ + +#define foo(x, y, defined) bar(x, y, defined)
20000725-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: uchar-1.c =================================================================== --- uchar-1.c (nonexistent) +++ uchar-1.c (revision 154) @@ -0,0 +1,8 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-funsigned-char -fsigned-char" } */ + +#if defined (__CHAR_UNSIGNED__) +# error __CHAR_UNSIGNED__ defined +#endif
uchar-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: digraphs.c =================================================================== --- digraphs.c (nonexistent) +++ digraphs.c (revision 154) @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ + +/* Fully test the 6 digraphs under c99 assumptions. Four are pasted, + to check that digraph pasting works. */ + +extern int strcmp (const char *, const char *); +extern void abort (void); +extern int puts (const char *); +#define err(str) do { puts(str); abort(); } while (0) + +%:define glue(x, y) x %:%: y /* #define glue(x, y) x ## y. */ +#ifndef glue +#error glue not defined! +#endif +%:define str(x) %:x /* #define str(x) #x */ + +int main (int argc, char *argv<::>) /* argv[] */ +glue (<, %) /* { */ + /* di_str[] = */ + const char di_str glue(<, :)glue(:, >) = str(%:%:<::><%%>%:); + + /* Check the glue macro actually pastes, and that the spelling of + all digraphs is preserved. */ + if (glue(str, cmp) (di_str, "%:%:<::><%%>%:")) + err ("Digraph spelling not preserved!"); + + return 0; +glue (%, >) /* } */
digraphs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: wchar-1.c =================================================================== --- wchar-1.c (nonexistent) +++ wchar-1.c (revision 154) @@ -0,0 +1,24 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-w" } */ + +/* Source: Neil Booth, 24 Feb 2002. + + Test if compiler and preprocessor agree on signeness of wide + chars. */ + +int main () +{ + __WCHAR_TYPE__ c = -1; + +#if L'\x0' - 1 < 0 + if (c > 0) + abort (); +#else + if (c < 0) + abort (); +#endif + + return 0; +}
wchar-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi6b.h =================================================================== --- mi6b.h (nonexistent) +++ mi6b.h (revision 154) @@ -0,0 +1,5 @@ +#if NOT defined (guard) + #ifdef VAR + VAR++; + #endif +#endif
mi6b.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste8.c =================================================================== --- paste8.c (nonexistent) +++ paste8.c (revision 154) @@ -0,0 +1,15 @@ +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +int foo(int, ...); + +#define a(x, y...) foo(x, ##y) +a(1) +a(1, 2, 3) +#define b(x, y, z...) foo(x, ##y) +b(1, 2, 3) /* { dg-warning "valid preprocessing token" } */ +#define c(x, y, z...) foo(x, ##z) +c(1, 2) +c(1, 2, 3) +#define d(x) fo(##x) +d(1) /* { dg-warning "valid preprocessing token" } */
paste8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucnid-7.c =================================================================== --- ucnid-7.c (nonexistent) +++ ucnid-7.c (revision 154) @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ +#define a b( +#define b(x) q +int a\U0000000z );
ucnid-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19921210-1.c =================================================================== --- 19921210-1.c (nonexistent) +++ 19921210-1.c (revision 154) @@ -0,0 +1,13 @@ +/* Test for proper disabling of macros within their own expansions. */ +/* { dg-do compile } */ + +/* The following is a trick to evaluate a complex boolean expression + at compile time, inspired by autoconf 2.13's sizeof-detection. */ + +enum { a = 4, f = 3 }; + +#define a1(y) (y+2) +#define a2(y) a1(y)+1 +#define f a+f + +char array[(a2(f)) == 10 ? 1 : -1];
19921210-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lexident.c =================================================================== --- lexident.c (nonexistent) +++ lexident.c (revision 154) @@ -0,0 +1,25 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-trigraphs -fdollars-in-identifiers" } */ + +/* Test lexing of identifiers. */ + +/* Escaped newlines, _ and $ in identifiers. */ +#def\ +\ +ine foo_ + +#d\ +ef??/ +in\ +e b\ +a$r + +#ifndef foo_ +#error foo_ +#endif + +#ifndef ba$r +#error ba$r +#endif
lexident.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: undef2.c =================================================================== --- undef2.c (nonexistent) +++ undef2.c (revision 154) @@ -0,0 +1,25 @@ +/* C99 6.10.8 para 4: None of [the predefined macro names] shall be + the subject of a #define or an #undef preprocessing directive. We + pass -fno-show-column as otherwise dejagnu gets confused. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fno-show-column" } */ + +#undef __DATE__ /* { dg-warning "undefining" "__DATE__" } */ +#undef __TIME__ /* { dg-warning "undefining" "__TIME__" } */ +#undef __FILE__ /* { dg-warning "undefining" "__FILE__" } */ +#undef __LINE__ /* { dg-warning "undefining" "__LINE__" } */ +#undef __STDC__ /* { dg-warning "undefining" "__STDC__" } */ + +/* These should be protected from #undef, but aren't, because they + are set with normal #define commands - and on top of that, some + of them are library properties, outside our control. To consider: + warn about undefining/redefining any identifier beginning with + __STDC_ . + + __STDC_HOSTED__ + __STDC_VERSION__ + __STDC_IEC_559__ + __STDC_IEC_559_COMPLEX__ + __STDC_ISO_10646__ + */
undef2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-mop.c =================================================================== --- if-mop.c (nonexistent) +++ if-mop.c (revision 154) @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth. */ + +/* Various illegal expressions with missing components. */ + +#if /* { dg-error "no expression" "empty #if" } */ +#endif + +#if ~ /* { dg-error "no right op" "no unary operand" } */ +#endif + +#if 3 + * 6 + 4 /* { dg-error "no right op" "no right operand" } */ +#endif + +#if 2 ~2 /* { dg-error "missing bin" "no binary operator" } */ +#endif + +#if 1 + 2 (3) /* { dg-error "missing bin" "immediate then open paren" } */ +#endif + +#if (2) 4 * 2 /* { dg-error "missing bin" "close paren then immediate" } */ +#endif + +#if == 2 /* { dg-error "no left op" } */ +#endif + +#if (==2) /* { dg-error "no left op" } */ +#endif
if-mop.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inc/pr20356-aux.h =================================================================== --- inc/pr20356-aux.h (nonexistent) +++ inc/pr20356-aux.h (revision 154) @@ -0,0 +1 @@ +#include "pr20356.h"
inc/pr20356-aux.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inc/pr20348-aux.h =================================================================== --- inc/pr20348-aux.h (nonexistent) +++ inc/pr20348-aux.h (revision 154) @@ -0,0 +1 @@ +#include "pr20348.h"
inc/pr20348-aux.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inc/pr20356.h =================================================================== --- inc/pr20356.h (nonexistent) +++ inc/pr20356.h (revision 154) @@ -0,0 +1,6 @@ +#ifndef INC_PR20356_H +# define INC_PR20356_H +#endif +#ifndef PR20356_H +# include_next +#endif
inc/pr20356.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inc/pr20348.h =================================================================== --- inc/pr20348.h (nonexistent) +++ inc/pr20348.h (revision 154) @@ -0,0 +1,9 @@ +#ifndef MIDDLE +# ifndef INC_PR20348_H_SEEN +# define INC_PR20348_H_SEEN +# else +# error inc/pr20348.h included twice before MIDDLE definition +# endif +#else +# error inc/pr20348.h included after MIDDLE definition +#endif
inc/pr20348.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inc/foo.h =================================================================== --- inc/foo.h (nonexistent) +++ inc/foo.h (revision 154) @@ -0,0 +1 @@ +extern int a;
inc/foo.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inc/pragma-once-1a.h =================================================================== --- inc/pragma-once-1a.h (nonexistent) +++ inc/pragma-once-1a.h (revision 154) @@ -0,0 +1,6 @@ +#ifndef _A_H_ +#define _A_H_ + +#include "../pragma-once-1b.h" + +#endif
inc/pragma-once-1a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: subframework1.c =================================================================== --- subframework1.c (nonexistent) +++ subframework1.c (revision 154) @@ -0,0 +1,15 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. */ + +/* { dg-do preprocess { target *-*-darwin* } } */ +/* { dg-options "-F$srcdir/gcc.dg/cpp/frame" } */ + +/* Contributed by Robert Bowdidge */ +/* include a file from a subframework that will import two files that + both look at the same file. Make sure we only include that file once; + if so, the program will compile fine. If not, we'll get redefinition + errors */ + +#include +#ifndef ONESUB_C_INCLUDED +#error C.h not included +#endif
subframework1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro8.c =================================================================== --- macro8.c (nonexistent) +++ macro8.c (revision 154) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options -std=gnu89 } */ + +/* GCC 2.95.2 used to get the following variable argument macro + expansions wrong. + + Source: Neil Booth, from PR 3852 with persmission. 31 Jul 2001. */ + +#define TEST_WORSE(args...) (5, ## args) +#define TEST_BAD(foo, args...) (2, (foo), ## args) + +extern void abort (); + +static int add (int a, int b) +{ + return a + b; +} + +int main () +{ + /* Would expand to a single closing parenthesis, maybe because of + the "no args requires space" brokenness. */ + if (TEST_WORSE () != 5) + abort (); + /* The macro would expand to (0, (0) with a missing closing parenthesis. */ + if (add TEST_BAD (5) != 7) + abort (); + return 0; +}
macro8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: isysroot-2.c =================================================================== --- isysroot-2.c (nonexistent) +++ isysroot-2.c (revision 154) @@ -0,0 +1,10 @@ +/* { dg-options "-isysroot ${srcdir}/gcc.dg/cpp" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include +int main() +{ + /* Special Carbon.h supplies function foo. */ + void (*x)(void) = foo; + return 0; +}
isysroot-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-1.c =================================================================== --- if-1.c (nonexistent) +++ if-1.c (revision 154) @@ -0,0 +1,41 @@ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic-errors" } */ + +#if 0xa != 10 +#error 0xa != 10 /* { dg-bogus "#error" "normal conversion" } */ +#endif + +#if 077 != 63 +#error 077 != 63 /* { dg-bogus "#error" "normal conversion" } */ +#endif + +#if 12wrt /* { dg-error "invalid suffix" "invalid number" } */ +#endif + +#if 0abc /* { dg-error "invalid suffix" "invalid number" } */ +#endif + +#if 42abc /* { dg-error "invalid suffix" "invalid number" } */ +#endif + +#if 0xabc != 2748 +#error 0xabc /* { dg-bogus "#error" "normal conversion" } */ +#endif + +#if 1.2 /* { dg-error "loating constant" "floating point in #if" } */ +#endif + +#if 4uu /* { dg-error "invalid suffix" "too many suffixes" } */ +#endif + +#if 124123231lll /* { dg-error "invalid suffix" "too many suffixes" } */ +#endif + +#if 1234lul /* { dg-error "invalid suffix" "u between ls" } */ +#endif + +#if 099 /* { dg-error "invalid digit" "decimal in octal constant" } */ +#endif + +#if 0xfffffffffffffffff /* { dg-error "integer constant" "range error" } */ +#endif
if-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macspace2.c =================================================================== --- macspace2.c (nonexistent) +++ macspace2.c (revision 154) @@ -0,0 +1,63 @@ +/* PR preprocessor/19475 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors -fno-show-column" } */ + +#define a! /* { dg-error "requires whitespace" } */ +#define b" /* { dg-error "requires whitespace" } */ +#define c# /* { dg-error "requires whitespace" } */ +#define d% /* { dg-error "requires whitespace" } */ +#define e& /* { dg-error "requires whitespace" } */ +#define f' /* { dg-error "requires whitespace" } */ +#define g) /* { dg-error "requires whitespace" } */ +#define h* /* { dg-error "requires whitespace" } */ +#define i+ /* { dg-error "requires whitespace" } */ +#define j, /* { dg-error "requires whitespace" } */ +#define k- /* { dg-error "requires whitespace" } */ +#define l. /* { dg-error "requires whitespace" } */ +#define m/ /* { dg-error "requires whitespace" } */ +#define n: /* { dg-error "requires whitespace" } */ +#define o; /* { dg-error "requires whitespace" } */ +#define p< /* { dg-error "requires whitespace" } */ +#define q= /* { dg-error "requires whitespace" } */ +#define r> /* { dg-error "requires whitespace" } */ +#define s? /* { dg-error "requires whitespace" } */ +#define t[ /* { dg-error "requires whitespace" } */ +#define u] /* { dg-error "requires whitespace" } */ +#define v^ /* { dg-error "requires whitespace" } */ +#define w{ /* { dg-error "requires whitespace" } */ +#define x| /* { dg-error "requires whitespace" } */ +#define y} /* { dg-error "requires whitespace" } */ +#define z~ /* { dg-error "requires whitespace" } */ +#define A>> /* { dg-error "requires whitespace" } */ +#define B<< /* { dg-error "requires whitespace" } */ +#define E&& /* { dg-error "requires whitespace" } */ +#define F|| /* { dg-error "requires whitespace" } */ +#define G== /* { dg-error "requires whitespace" } */ +#define H!= /* { dg-error "requires whitespace" } */ +#define I>= /* { dg-error "requires whitespace" } */ +#define J<= /* { dg-error "requires whitespace" } */ +#define K+= /* { dg-error "requires whitespace" } */ +#define L-= /* { dg-error "requires whitespace" } */ +#define M*= /* { dg-error "requires whitespace" } */ +#define N/= /* { dg-error "requires whitespace" } */ +#define O%= /* { dg-error "requires whitespace" } */ +#define P&= /* { dg-error "requires whitespace" } */ +#define Q|= /* { dg-error "requires whitespace" } */ +#define R^= /* { dg-error "requires whitespace" } */ +#define S>>= /* { dg-error "requires whitespace" } */ +#define T<<= /* { dg-error "requires whitespace" } */ +#define W... /* { dg-error "requires whitespace" } */ +#define X++ /* { dg-error "requires whitespace" } */ +#define Y-- /* { dg-error "requires whitespace" } */ +#define Z-> /* { dg-error "requires whitespace" } */ +#define aa:: /* { dg-error "requires whitespace" } */ +#define ab->* /* { dg-error "requires whitespace" } */ +#define ac.* /* { dg-error "requires whitespace" } */ +#define ad\x /* { dg-error "requires whitespace" } */ +#define ae\\x /* { dg-error "requires whitespace" } */ +#define af'1' /* { dg-error "requires whitespace" } */ +#define ag"abc" /* { dg-error "requires whitespace" } */ + +int dummy; +/* { dg-error "missing terminating" "" { target *-*-* } 6 } */ +/* { dg-error "missing terminating" "" { target *-*-* } 10 } */
macspace2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pragma-once-1d.h =================================================================== --- pragma-once-1d.h (nonexistent) +++ pragma-once-1d.h (revision 154) @@ -0,0 +1,6 @@ +#ifndef _D_H_ +#define _D_H_ + +#include "pragma-once-1b.h" + +#endif
pragma-once-1d.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: multiline-2.c =================================================================== --- multiline-2.c (nonexistent) +++ multiline-2.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* Test that multi-line tokens are rejected by the compiler. Source: + Neil Booth. */ + +const char *p = "line 1 +" +""; /* The compiler front end sees this. */ + +/* { dg-error "missing term" "multiline strings" { target *-*-* } 8 } */ +/* { dg-error "missing term" "multiline strings" { target *-*-* } 9 } */ +
multiline-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi7a.h =================================================================== --- mi7a.h (nonexistent) +++ mi7a.h (revision 154) @@ -0,0 +1,4 @@ +: +#ifndef GUARD1 +#define GUARD1 +#endif
mi7a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unc1.c =================================================================== --- unc1.c (nonexistent) +++ unc1.c (revision 154) @@ -0,0 +1,14 @@ +/* Tests for un-terminated conditionals: 1. */ +/* { dg-do preprocess } */ + +#if 1 /* { dg-error "unterminated" "unterminated #if" } */ + +#ifdef notdef /* { dg-bogus "unterminated" "nested terminated #ifdef" } */ + +blah blah blah + +#endif + +more text + +/* oops! */
unc1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pragma-2.c =================================================================== --- pragma-2.c (nonexistent) +++ pragma-2.c (revision 154) @@ -0,0 +1,16 @@ +/* Verify that preprocessor does not insert redundant newlines + after #pragma, also check this for #include, #define and #undef */ +/* { dg-do compile } */ +/* { dg-options "-dD" } */ +#include + +#undef unknow_def + +int main () { + +#pragma unknown + {} + error; + /* { dg-error "undeclared" "undeclared-variable message" { target *-*-* } { 13 } } */ + /* { dg-error "function it appears in" "reminder message" { target *-*-* } { 13 } } */ +}
pragma-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste10.c =================================================================== --- paste10.c (nonexistent) +++ paste10.c (revision 154) @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +/* This testcase used to produce a bogus "invalid paste" warning, owing + to not clearing a PASTE_LEFT flag. */ + +#define strcpy(src) __strcpy_small (src) + +#define __strcpy_small(src) src + +#define tprintf(format, args...) sprintf(format, ## args) + +strcpy(tprintf("<%s>", test))
paste10.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gnuc99.c =================================================================== --- gnuc99.c (nonexistent) +++ gnuc99.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99" } */ + +/* This file is for testing the preprocessor in -std=gnu99 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif
gnuc99.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: charconst-2.c =================================================================== --- charconst-2.c (nonexistent) +++ charconst-2.c (revision 154) @@ -0,0 +1,19 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-fsigned-char" } */ + +/* Crosscompiling from i686-linux (32-bit) to x86_64-linux (64-bit) + gave extra warnings on the two assignments: + warning: large integer implicitly truncated to unsigned type + warning: overflow in implicit constant conversion + This test has been added as a regression test after fixing the bug + by Andreas Jaeger, 23 Nov 2001. */ +int +main (void) +{ + signed char c = '\xff'; + unsigned char d = '\xff'; + + return 0; +}
charconst-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: assert3.c =================================================================== --- assert3.c (nonexistent) +++ assert3.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-A abc=def -A abc\(ghi\) \"-Aabc = jkl\" -A abc=mno -A -abc=mno" } */ + +/* Test -A command line syntax. Source Neil Booth. 31 Oct 2000. */ + +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) || #abc(mno) +#error Command line -A assertions +#endif
assert3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000207-2.c =================================================================== --- 20000207-2.c (nonexistent) +++ 20000207-2.c (revision 154) @@ -0,0 +1,16 @@ +/* { dg-do preprocess } */ + +/* Test for proper handling of unary plus in #if. */ + +#if !(+1) +#error Error /* { dg-bogus "Error" "case !(+1)" } */ +#endif + +#if !+1 +#error Error /* { dg-bogus "Error" "case !+1" } */ +#endif + +#if +1 +#else +#error Error /* { dg-bogus "Error" "case +1" } */ +#endif
20000207-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: _Pragma6.c =================================================================== --- _Pragma6.c (nonexistent) +++ _Pragma6.c (revision 154) @@ -0,0 +1,11 @@ +/* PR c/27747 */ +/* This is supposed to succeed only if + the target defines HANDLE_PRAGMA_PACK_PUSH_POP + and doesn't define HANDLE_PRAGMA_PACK_WITH_EXPANSION. */ +/* { dg-do compile { target { ! { *-*-solaris2* sh*-[us]*-elf } } } } */ + +#define push bar +#define foo _Pragma ("pack(push)") +foo +int i; +#pragma pack(pop)
_Pragma6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: assembler.S =================================================================== --- assembler.S (nonexistent) +++ assembler.S (revision 154) @@ -0,0 +1,26 @@ +/* Regression test - in assembly language, # may have some significance + other than 'stringize macro argument' and therefore must be preserved + in the output, and should not be warned about. */ + +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +#define foo() mov r0, #5 /* { dg-bogus "not followed" "spurious warning" } */ + +entry: + foo() + +/* Check we don't EOF on an unknown directive. */ +#unknown directive +#error a later diagnostic /* { dg-error "diagnostic" } */ + +/* + { dg-final { if ![file exists 20000510-1.i] { return } } } + { dg-final { set tmp [grep 20000510-1.i # line] } } + { dg-final { if {[string length $tmp] > 0} \{ } } + { dg-final { pass "20000510-1.S: # preservation" } } + { dg-final { \} else \{ } } + { dg-final { fail "20000510-1.S: # preservation" } } + { dg-final { \} } } +*/ +
assembler.S Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste1.c =================================================================== --- paste1.c (nonexistent) +++ paste1.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test operator ## semantics. */ + +#define bad1 ## owt /* { dg-error "cannot" "## at objlike start" } */ +#define bad2 owt ## /* { dg-error "cannot" "## at objlike end" } */ +#define bad3(x) ## x /* { dg-error "cannot" "## at funlike start" } */ +#define bad4(x) x ## /* { dg-error "cannot" "## at funlike end" } */
paste1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi2a.h =================================================================== --- mi2a.h (nonexistent) +++ mi2a.h (revision 154) @@ -0,0 +1,5 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey . */ + +#include "mi2c.h"
mi2a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: normalize-1.c =================================================================== --- normalize-1.c (nonexistent) +++ normalize-1.c (revision 154) @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ + +\u00AA +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A /* { dg-warning "not in NFC" } */ + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 /* { dg-warning "not in NFC" } */ +\uAC01 +\u1100\u1161\u11A8 /* { dg-warning "not in NFC" } */ +\uAC00\u11A8 /* { dg-warning "not in NFC" } */
normalize-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000627-1.c =================================================================== --- 20000627-1.c (nonexistent) +++ 20000627-1.c (revision 154) @@ -0,0 +1,10 @@ +/* Test for spurious warnings with backslashes in perverse locations. + Bug exposed by Plumhall. */ +/* { dg-do compile } */ + +extern int bar; + +#def\ +ine foo bar + +int main(void) { return foo; }
20000627-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dM.c =================================================================== --- cmdlne-dM.c (nonexistent) +++ cmdlne-dM.c (revision 154) @@ -0,0 +1,12 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -dM } */ + +/* Test -dM does not fail. */ + +#define objlike obj like +#define funlike(like) fun like +#define funlike2(fun, like) fun ## like +#define varargs(x, ...) x #x #__VA_ARGS__ __VA_ARGS__ +#define gnu_varargs(x, y...) #y x ## y y
cmdlne-dM.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: strify1.c =================================================================== --- strify1.c (nonexistent) +++ strify1.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test operator # semantics. */ + +#define OK1 # /* No problem. */ +#define OK2(x) x#x /* No problem. */ +#define bad1(x) # /* { dg-error "followed by a macro parameter" "#1" } */ +#define bad2(x) #y /* { dg-error "followed by a macro parameter" "#2" } */
strify1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi6c.h =================================================================== --- mi6c.h (nonexistent) +++ mi6c.h (revision 154) @@ -0,0 +1,5 @@ +#if !DEFINED + #ifdef VAR + VAR++; + #endif +#endif
mi6c.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: spacing1.c =================================================================== --- spacing1.c (nonexistent) +++ spacing1.c (revision 154) @@ -0,0 +1,65 @@ +/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* This tests correct spacing of macro expansion output, as well as + the line it falls on. This is quite subtle; it involves newlines + within macro arguments becoming spaces, but not if it turns out to + not be a macro invocation. Also, multiple macro invocations spread + across many lines. + + Neil Booth, 1 Dec 2000, 23 Sep 2001. */ + +/* The actual location of the expansion of a multi-line macro + invocation is not defined: we might consider them to be in the same + line as the initial token of the invocation, or as the final token + of the invocation, or even anything in between. We choose to make + it the initial token, such that everything that is in a logical + line ends up in a single line after preprocessing. + + Alexandre Oliva, Sept 13, 2003. */ + +#define str(x) #x +#define f(x) x +#define glue(x, y) x ## y +#define EMPTY +/* These are based on PR 4492, we mustn't lose padding tokens when + scanning ahead for a '(' and failing to find it. */ +#define A(x) B x +#define B(x) +#define C A +#define D() A + +/* The correct output is shown here. Note the spaces, and the way + everything after the invocation of f appears on the same line. + + 44 ; +B Q B Q A Q A: +f +bar +A +bad +g "1 2" bam baz + +*/ + +glue (EMPTY 4, 4) EMPTY; +A(Q) C(Q) D()Q D(): +f +bar +A +bad +f (g) str +( +1 +2 +) f +(bam) baz + +/* { dg-final { scan-file spacing1.i " 44 ;" } } + { dg-final { scan-file spacing1.i "B Q B Q A Q A:" } } + { dg-final { scan-file-not spacing1.i "f\[^\n\]*bar" } } + { dg-final { scan-file spacing1.i "(^|\n)bar" } } + { dg-final { scan-file spacing1.i "(^|\n)A($|\n)" } } + { dg-final { scan-file spacing1.i "(^|\n)bad($|\n)" } } + { dg-final { scan-file spacing1.i "g \"1 2\" bam baz" } } */
spacing1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste9.c =================================================================== --- paste9.c (nonexistent) +++ paste9.c (revision 154) @@ -0,0 +1,23 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "" } */ + +/* Apparently older preprocessors used to fail this test. */ + +#include + +extern void abort (void); + +#define S(str, args...) " " str "\n", ##args + +int +main() +{ + const char *s = S("foo"); + + if (strchr (s, '\n') == NULL) + abort (); + + return 0; +}
paste9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucnid-8.c =================================================================== --- ucnid-8.c (nonexistent) +++ ucnid-8.c (revision 154) @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ +/* Test that -std=c99 does not enable extended identifiers while the + feature is experimental; remove this test after audit of all + identifier uses in the compiler. */ +#define a b( +#define b(x) q +int a\u00aa);
ucnid-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: directiv.c =================================================================== --- directiv.c (nonexistent) +++ directiv.c (revision 154) @@ -0,0 +1,35 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -pedantic } */ + +/* Tests general directive syntax, and directive error recovery. */ + + +/* Test directive name is not expanded. */ +#define foo define +#foo EMPTY /* { dg-error "invalid" } */ + +/* Test # must be first on line. */ +EMPTY #define bar +#ifdef bar +#error bar is defined +#endif + +/* Test form feed and vertical tab warn pedantically, see 6.10 + paragraph 5. Tab is OK. */ +# define something /* { dg-warning "form feed" } */ +#define something_else /* { dg-warning "vertical tab" } */ + #define some thing /* Tab OK, as is form feed before #. */ + +/* Our friend the null directive OK? */ +# + +/* Check newlines end directives, even in function-like macro + invocations. 6.10 paragraph 1. + + Note that the #if is still treated as a conditional, so there + should be no errors about #endif without #if. */ +#define func(x) x +#if func ( /* { dg-error "unterminated argument" } */ +#endif
directiv.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro1.c =================================================================== --- macro1.c (nonexistent) +++ macro1.c (revision 154) @@ -0,0 +1,128 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ + +/* Tests various macro abuse is correctly expanded. */ + +extern int puts (const char *); +extern void abort (void); +extern int strcmp(const char *s1, const char *s2); + +#define err(str) do { puts(str); abort(); } while (0) +#define j(x, y) x + y +#define k(x, y) j(x + 2, y + +#define glue(x, y) x ## y +#define xglue(x, y) glue(x, y) + +/* Functions called when macros are left unexpanded. */ +int q(int x) {return x + 40;} +int B(int x) {return x + 20;} +int foo(int x) {return x + 10;} +int bar(int x, int y) {return x + y;} +int baz(int x, int y) {return x + y;} +int toupper(int x) {return x + 32;} +int M(int x) {return x * 2;} + +int main (int argc, char *argv[]) +{ +#define q(x) x + if (q(q)(2) != 42) + err ("q"); + +#define A(x) B(x) + if (A(A(2)) != 42) + err ("A"); + +#define E(x) A x +#define F (22) + if (E(F) != 42) + err ("E(F)"); + +#define COMMA , +#define NASTY(a) j(a 37) + if (NASTY (5 COMMA) != 42) + err ("NASTY"); + +#define bar(x, y) foo(x(y, 0)) +#define apply(x, y) foo(x(y, 22)) +#define bam bar + if (bar(bar, 32) != 42) /* foo(bar(32, 0)). */ + err ("bar bar"); + if (bar(bam, 32) != 42) /* Same. */ + err ("bar bam"); + if (apply(bar, baz) != 42) /* foo(foo(baz(22, 0))). */ + err ("apply bar baz"); + + /* Taken from glibc. */ +#define __tobody(c, f) f (c) +#define toupper(c) __tobody (c, toupper) + if (toupper (10) != 42) /* toupper (10). */ + err ("toupper"); + + /* This tests that M gets expanded the right no. of times. Too many + times, and we get excess "2 +"s and the wrong sum. Derived from + nested stpcpy in dggettext.c. */ +#define M(x) 2 + M(x) +#define stpcpy(a) M(a) + if (stpcpy (stpcpy (9)) != 42) /* 2 + M (2 + M (9)) */ + err ("stpcpy"); + + /* Another test derived from nested stpcpy's of dggettext.c. Uses + macro A(x) and function B(x) as defined above. The problem was + the same - excess "1 +"s and the wrong sum. */ +#define B(x) 1 + B(x) +#define C(x) A(x) + if (C(B(0)) != 42) /* 1 + B (1 + B (0)) */ + err ("C"); + + /* More tests derived from gcc itself - the use of XEXP and COST. + These first two should both expand to the same thing. */ + { + int insn = 6, i = 2, b = 2; +#define XEXP(RTX, N) (RTX * N + 2) +#define PATTERN(INSN) XEXP(INSN, 3) + if (XEXP (PATTERN (insn), i) != 42) /* ((insn * 3 + 2) * i + 2) */ + err ("XEXP (PATTERN)"); + if (XEXP (XEXP (insn, 3), i) != 42) /* ((insn * 3 + 2) * i + 2) */ + err ("XEXP (XEXP)"); + +#define COST(X) XEXP (XEXP (X, 4), 4) + if (COST (b) != 42) /* ((b * 4 + 2) * 4 + 2) */ + err ("COST"); + } + + /* This tests macro recursion and expand-after-paste. */ +#define FORTYTWO "forty" +#define TWO TWO "-two" + if (strcmp (glue(FORTY, TWO), "forty")) + err ("glue"); + if (strcmp (xglue(FORTY, TWO), "forty-two")) + err ("xglue"); + + /* Test ability to call macro over multiple logical lines. */ + if (q + (42) != 42 + || q ( + 42) != 42 + || q (42 + ) != 42 + || q + ( + 42 + ) + != 42) + err ("q over multiple lines"); + + /* Corner case. Test that macro expansion is turned off for later + q, when not at start but at end of argument context, and supplied + with the '(' necessary for expansion. */ + if (q(1 + q)(1) != 42) /* 1 + q(1) */ + err ("Nested q"); + + /* This looks like it has too many ')', but it hasn't. */ + if (k(1, 4) 35) != 42) + err ("k"); + + /* Phew! */ + return 0; +}
macro1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: skipping.c =================================================================== --- skipping.c (nonexistent) +++ skipping.c (revision 154) @@ -0,0 +1,25 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests expansion of macros whilst skipping false conditionals. */ + +/* Source: Neil Booth, 29 Oct 2000. */ + +#define F() +#define TRUE 1 + +#if 0 +F( /* No diagnostic: don't even try to expand it. */ +#endif + +#if 0 +#elif TRUE /* Expand this, even though we were skipping. */ +#else +#error Macros not expanded in #elif +#endif + +/* Check we don't warn about bad identifiers when skipping. */ +#if 0 +#define foo __VA_ARGS__ /* { dg-bogus "warned about identifier" } */ +#endif
skipping.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi1.c =================================================================== --- mi1.c (nonexistent) +++ mi1.c (revision 154) @@ -0,0 +1,39 @@ +/* Test "ignore redundant include" facility. + + We must test with C and C++ comments, and null directives, outside + the guard conditional; also, we test guarding with #ifndef and #if + !defined. -H is used because cpp might confuse the issue by + optimizing out #line markers. This test only passes if each of the + headers is read exactly once. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do compile } + { dg-options "-H" } + { dg-error "mi1c\.h\n\[^\n\]*mi1cc\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */ + +#include "mi1c.h" +#include "mi1c.h" +#include "mi1c.h" + +#include "mi1cc.h" +#include "mi1cc.h" + +#include "mi1nd.h" +#include "mi1nd.h" + +#include "mi1ndp.h" +#include "mi1ndp.h" + +#define MIX_H +#include "mi1x.h" +#include "mi1x.h" + +int +main (void) +{ + return a + b + c + d; +}
mi1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro9.c =================================================================== --- macro9.c (nonexistent) +++ macro9.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* Source: Neil Booth, 15 Sep 2001. + + A silly test to check that if a function-like macro name is + immediately followed by a directive, then we process the directive + properly. */ + +#define main() +int main +#define mainbody () { return 0; } +mainbody
macro9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-M.c =================================================================== --- cmdlne-M.c (nonexistent) +++ cmdlne-M.c (revision 154) @@ -0,0 +1,8 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-M" } */ + +/* Test that dependency output suppresses warnings by implying -w. */ + +#warning bogus /* { dg-bogus "warning" "warning not suppressed" } */
cmdlne-M.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-2.c =================================================================== --- if-2.c (nonexistent) +++ if-2.c (revision 154) @@ -0,0 +1,28 @@ +/* { dg-do preprocess } */ +/* { dg-options -pedantic-errors } */ + +#if 'a' != 'a' || '\001' != 1 || '\x12' != 0x12 +#error a,1,0x12 /* { dg-bogus "#error" "basic charconst recognition" } */ +#endif + +#if 'a' != L'a' +#error L'a' /* { dg-bogus "error" "wide charconst recognition 1" } */ +#endif + +#if L'\xfeed' != 0xfeed && L'\xfeed' != (0xfeed - 0x10000) +#error 0xfeed /* { dg-bogus "error" "wide charconst recognition 2" } */ +#endif + +#if L'\x1234' != 0x1234 +#error 0x1234 /* { dg-bogus "error" "wide charconst recognition 3" } */ +#endif + +/* The 'character constant (is )?too long' message is produced by 16-bit targets. */ +#if 'abcd' /* { dg-warning "(multi-character character constant)|(character constant (is )?too long)" "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
if-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi1c.h =================================================================== --- mi1c.h (nonexistent) +++ mi1c.h (revision 154) @@ -0,0 +1,12 @@ +/* Redundant header include test with C comments at top. */ +# /* And a null directive at the top. */ + +#ifndef CPP_MIC_H +#define CPP_MIC_H + +int a; + +#endif + +# /* And at the end, too! */ +/* And at the end too! */
mi1c.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: defined.c =================================================================== --- defined.c (nonexistent) +++ defined.c (revision 154) @@ -0,0 +1,85 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests behavior of the defined operator. */ + +/* Source: Neil Booth, 29 Oct 2000, Zack Weinberg 11 Dec 2000. */ + +#define defined /* { dg-error "defined" } */ + +/* No diagnostics, though you could argue there should be. */ +#if defined defined +#error defined is defined! +#endif + +#define is_Z_defined defined Z + +#if defined Z +#error Z is not defined +#endif + +/* The behavior of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined +#error Macro expanding into defined operator test 1 +#endif + +#define Z + +#if !defined Z +#error Z is defined +#endif + +#if !is_Z_defined +#error Macro expanding into defined operator test 2 +#endif + +#undef is_Z_defined +#undef Z + +/* Do all the tests over again with the () form of defined. */ + +/* No diagnostics, though you could argue there should be. */ +#if defined(defined) +#error defined is defined! +#endif + +#define is_Z_defined defined ( Z ) + +#if defined(Z) +#error Z is not defined +#endif + +/* The behavior of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined +#error Macro expanding into defined operator test 1 +#endif + +#define Z + +#if !defined(Z) +#error Z is defined +#endif + +#if !is_Z_defined +#error Macro expanding into defined operator test 2 +#endif + +/* Use of defined in different contexts. */ + +#define bad1 defined +#if !bad1 Z /* { dg-warning "may not be portable" } */ +#error Z is defined +#endif + +#if !bad1 (Z) /* { dg-warning "may not be portable" } */ +#error Z is defined +#endif + +#define bad2 defined (Z +#if !bad2) /* { dg-warning "may not be portable" } */ +#error Z is defined +#endif +
defined.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi7b.h =================================================================== --- mi7b.h (nonexistent) +++ mi7b.h (revision 154) @@ -0,0 +1,4 @@ +#ifndef GUARD2 +#define GUARD2 +#endif +:
mi7b.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: hash1.c =================================================================== --- hash1.c (nonexistent) +++ hash1.c (revision 154) @@ -0,0 +1,9 @@ +/* Test for proper handling of # in object-like macros. + From Linux kernel. */ +/* { dg-do preprocess } */ + +#define FIXUP .section ".fixup",#alloc,#execinstr + +FIXUP + +/* { dg-bogus "not followed by" "object-like #" { target *-*-* } 3 } */
hash1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: redef1.c =================================================================== --- redef1.c (nonexistent) +++ redef1.c (revision 154) @@ -0,0 +1,19 @@ +/* Test for redefining macros with insignificant (i.e. whitespace) + differences. */ + +/* { dg-do preprocess } */ + +#define foo bar +#define /* x */ foo /* x */ bar /* x */ + +#define quux(thud) a one and a thud and a two +#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two +#define quux(thud) a one and a thud and a two /* bah */ + +/* { dg-bogus "redefined" "foo redefined" { target *-*-* } 7 } */ +/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 10 } */ +/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 11 } */ + +/* { dg-bogus "previous def" "foo prev def" { target *-*-* } 6 } */ +/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 9 } */ +/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 10 } */
redef1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unc2.c =================================================================== --- unc2.c (nonexistent) +++ unc2.c (revision 154) @@ -0,0 +1,12 @@ +/* Tests for unterminated conditionals: 2. */ +/* { dg-do preprocess } */ + +#ifdef __sparc__ /* { dg-error "unterminated" "unterminated if-elif-elif..." } */ +sparc +#elif defined __powerpc__ +ppc +#elif defined __i386__ +i386 +#elif defined __vax__ +vax +
unc2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19930510-1.c =================================================================== --- 19930510-1.c (nonexistent) +++ 19930510-1.c (revision 154) @@ -0,0 +1,7 @@ +/* { dg-do compile } */ + +extern void exit (int); + +#define ugly 3 +#ugly "foobar" 3 /* { dg-error "invalid" "invalid directive" } */ +int main() { exit (0); }
19930510-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tr-warn1.c =================================================================== --- tr-warn1.c (nonexistent) +++ tr-warn1.c (revision 154) @@ -0,0 +1,39 @@ +/* Test for warnings about nontraditional directives. */ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -Wtraditional -fno-show-column" } */ + +/* Block 1: K+R directives should have the # indented. */ + +#define foo bar /* { dg-bogus "indented" "^#kandr" } */ +# define foo bar /* { dg-bogus "indented" "^# kandr" } */ + #define foo bar /* { dg-warning "indented" "^ #kandr" } */ + # define foo bar /* { dg-warning "indented" "^ # kandr" } */ + +/* Block 2: C89 directives should not have the # indented. */ + +#pragma whatever /* { dg-warning "indented" "^#c89" } */ +# pragma whatever /* { dg-warning "indented" "^# c89" } */ + #pragma whatever /* { dg-bogus "indented" "^ #c89" } */ + # pragma whatever /* { dg-bogus "indented" "^ # c89" } */ + +/* Block 3: Extensions should not have the # indented, + _and_ they should get a -pedantic warning. */ + +#assert foo(bar) /* { dg-warning "indented" "^#ext" } */ +# assert bar(baz) /* { dg-warning "indented" "^# ext" } */ + #assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */ + # assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */ + +/* We warn of #elif regardless of whether we're skipping or not, and + do not warn about indentaion. */ +#if 0 +#if 1 +#elif 1 /* { dg-warning "#elif" "#elif skipping" } */ +#endif +#elif 0 /* { dg-warning "#elif" "#elif not skipping" } */ +#endif + +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 22 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 23 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 24 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 25 } */
tr-warn1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste11.c =================================================================== --- paste11.c (nonexistent) +++ paste11.c (revision 154) @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test correct pasting of identifiers and numbers. We can paste any + number, as long as no '.', '-' or '+' appears in its spelling. */ + +#define glue(x, y) x ## y + +glue (ident, 12) /* OK. */ +glue (ident, 12e3) /* OK. */ +glue (ident, 12e+3) /* { dg-warning "valid preprocessing tok" } */ +glue (ident, 12e-3) /* { dg-warning "valid preprocessing tok" } */ +glue (ident, 1.2) /* { dg-warning "valid preprocessing tok" } */ +glue (ident, .12) /* { dg-warning "valid preprocessing tok" } */
paste11.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: maccom1.c =================================================================== --- maccom1.c (nonexistent) +++ maccom1.c (revision 154) @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that comments are ignored between # and the + directive name when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#/**/define def passed + +def + +/* { dg-final { scan-file maccom1.i "(^|\\n)passed" } } */ +
maccom1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cxxcom1.c =================================================================== --- cxxcom1.c (nonexistent) +++ cxxcom1.c (revision 154) @@ -0,0 +1,11 @@ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -std=gnu89" } */ + +/* You can't do this in your own code... */ +// C++ comment is not in C89 { dg-warning "style comment|reported only once" "good warning" } + +/* ...but we don't bitch about it more than once. */ +// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" } + +/* { dg-final { scan-file-not cxxcom1.i "is not in C89" } } */ +
cxxcom1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19940712-1a.h =================================================================== --- 19940712-1a.h (nonexistent) +++ 19940712-1a.h (revision 154) @@ -0,0 +1,4 @@ +/* spanning a .h file */ + +#if 0 +#endif /* comment start in comment error
19940712-1a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: charconst-3.c =================================================================== --- charconst-3.c (nonexistent) +++ charconst-3.c (revision 154) @@ -0,0 +1,50 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options -Wno-multichar } */ + +/* This tests values and signedness of multichar charconsts. + + Neil Booth, 5 May 2002. */ + +#include + +extern void abort (void); + +int main () +{ + /* These tests require at least 2-byte ints. 8-) */ +#if INT_MAX > 127 + int scale = (int) (unsigned char) -1 + 1; + + if ('ab' != (int) ((unsigned char) 'a' * scale + (unsigned char) 'b')) + abort (); + + if ('\234b' != (int) ((unsigned char) '\234' * scale + (unsigned char) 'b')) + abort (); + + if ('b\234' != (int) ((unsigned char) 'b' * scale + (unsigned char) '\234')) + abort (); + /* Multichar charconsts have type int and should be signed. */ +#if INT_MAX == 32767 +# if '\234a' > 0 +# error Preprocessor charconsts 1 +# endif + if ('\234a' > 0) + abort (); +#elif INT_MAX == 2147483647 +# if '\234aaa' > 0 +# error Preprocessor charconsts 2 +# endif + if ('\234aaa' > 0) + abort (); +#elif INT_MAX == 9223372036854775807 +# if '\234aaaaaaa' > 0 +# error Preprocessor charconsts 3 +# endif + if ('\234aaaaaaa' > 0) + abort (); +#endif +#endif + return 0; +}
charconst-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dM-dD.c =================================================================== --- cmdlne-dM-dD.c (nonexistent) +++ cmdlne-dM-dD.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dM -dD" } */ + +/* Test -dM -dD does not fail. It should give the same output + as plain -dD. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file cmdlne-dM-dD.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file cmdlne-dM-dD.i "variable" } } */
cmdlne-dM-dD.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: assert4.c =================================================================== --- assert4.c (nonexistent) +++ assert4.c (revision 154) @@ -0,0 +1,405 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + Test builtin preprocessor assertions. + By Kaveh Ghazi . */ + +/* { dg-do preprocess } */ + +/* Check for #system assertions. */ + +#if defined __gnu_linux__ +# if !#system(linux) || !#system(unix) || !#system(posix) +# error +# endif +#elif #system(linux) +# error +#endif + +#if defined __gnu_hurd__ +# if !#system(gnu) || !#system(unix) || !#system(posix) || !#system(mach) +# error +# endif +#elif #system(gnu) +# error +#endif + +#if defined __FreeBSD__ +# if !#system(FreeBSD) || !#system(unix) || !#system(bsd) +# error +# endif +#elif #system(FreeBSD) +# error +#endif + +#if defined __NetBSD__ +# if !#system(NetBSD) || !#system(unix) || !#system(bsd) +# error +# endif +#elif #system(NetBSD) +# error +#endif + +#if defined __OpenBSD__ +# if !#system(OpenBSD) || !#system(unix) || !#system(bsd) +# error +# endif +#elif #system(OpenBSD) +# error +#endif + +#if defined __svr4__ || defined __SYSTYPE_SVR4__ +# if !#system(svr4) || !#system(unix) +# error +# endif +#elif #system(svr4) +# error +#endif + +#if defined __hpux__ +# if !#system(hpux) || !#system(unix) +# error +# endif +#elif #system(hpux) +# error +#endif + +#if defined _AIX +# if !#system(aix) || !#system(unix) +# error +# endif +#elif #system(aix) +# error +#endif + +#if defined __lynx__ +# if !#system(lynx) || !#system(unix) +# error +# endif +#elif #system(lynx) +# error +#endif + +#if ( defined __unix__ && !defined __CYGWIN__ ) || defined _AIX +# if !#system(unix) +# error +# endif +#elif #system(unix) +# error +#endif + +#if defined __rtems__ +# if !#system(rtems) +# error +# endif +#elif #system(rtems) +# error +#endif + +#if defined __vms__ +# if !#system(vms) +# error +# endif +#elif #system(vms) +# error +#endif + +#if defined __mvs__ +# if !#system(mvs) +# error +# endif +#elif #system(mvs) +# error +#endif + +#if defined __MSDOS__ +# if !#system(msdos) +# error +# endif +#elif #system(msdos) +# error +#endif + +#if defined __WINNT__ || defined __CYGWIN__ +# if !#system(winnt) +# error +# endif +#elif #system(winnt) +# error +#endif + +#if defined __BEOS__ +# if !#system(beos) +# error +# endif +#elif #system(beos) +# error +#endif + +#if defined __netware__ +# if !#system(netware) +# error +# endif +#elif #system(netware) +# error +#endif + + +/* Check for #cpu and #machine assertions. */ + +#if defined __arc__ +# if !#cpu(arc) || !#machine(arc) +# error +# endif +#elif #cpu(arc) || #machine(arc) +# error +#endif + +#if defined __alpha__ +# if !#cpu(alpha) || !#machine(alpha) \ + || (defined __alpha_cix__ && !#cpu(cix)) \ + || (!defined __alpha_cix__ && #cpu(cix)) \ + || (defined __alpha_fix__ && !#cpu(fix)) \ + || (!defined __alpha_fix__ && #cpu(fix)) \ + || (defined __alpha_bwx__ && !#cpu(bwx)) \ + || (!defined __alpha_bwx__ && #cpu(bwx)) \ + || (defined __alpha_max__ && !#cpu(max)) \ + || (!defined __alpha_max__ && #cpu(max)) \ + || (defined __alpha_ev6__ && !#cpu(ev6)) \ + || (!defined __alpha_ev6__ && #cpu(ev6)) \ + || (defined __alpha_ev5__ && !#cpu(ev5)) \ + || (!defined __alpha_ev5__ && #cpu(ev5)) \ + || (defined __alpha_ev4__ && !#cpu(ev4)) \ + || (!defined __alpha_ev4__ && #cpu(ev4)) +# error +# endif +#elif #cpu(alpha) || #machine(alpha) || #cpu(cix) || #cpu(fix) || #cpu(bwx) \ + || #cpu(max) || #cpu(ev6) || #cpu(ev5) || #cpu(ev4) +# error +#endif + +#if defined __arm__ +# if !#cpu(arm) || !#machine(arm) +# error +# endif +#elif #cpu(arm) || #machine(arm) +# error +#endif + +#if defined __cris__ +# if !#cpu(cris) || !#machine(cris) +# error +# endif +#elif #cpu(cris) || #machine(cris) +# error +#endif + +#if defined __fr30__ +# if !#cpu(fr30) || !#machine(fr30) +# error +# endif +#elif #cpu(fr30) || #machine(fr30) +# error +#endif + +#if defined __frv__ +# if !#cpu(frv) || !#machine(frv) +# error +# endif +#elif #cpu(frv) || #machine(frv) +# error +#endif + +#if defined __h8300__ +# if !#cpu(h8300) || !#machine(h8300) \ + || (defined __H8300__ && (!#cpu(h8300) || !#machine(h8300))) \ + || (defined __H8300H__ && (!#cpu(h8300h) || !#machine(h8300h))) \ + || (!defined __H8300H__ && (#cpu(h8300h) || #machine(h8300h))) \ + || (defined __H8300S__ && (!#cpu(h8300s) || !#machine(h8300s))) \ + || (!defined __H8300S__ && (#cpu(h8300s) || #machine(h8300s))) +# error +# endif +#elif #cpu(h8300) || #machine(h8300) || #cpu(h8300h) || #machine(h8300h) || \ + #cpu(h8300s) || #machine(h8300s) +# error +#endif + +#if defined __hppa__ +# if !#cpu(hppa) || !#machine(hppa) +# error +# endif +#elif #cpu(hppa) || #machine(hppa) +# error +#endif + +#if defined __i370__ +# if !#cpu(i370) || !#machine(i370) +# error +# endif +#elif #cpu(i370) || #machine(i370) +# error +#endif + +#if defined __x86_64__ +# if !#cpu(x86_64) || !#machine(x86_64) +# error +# endif +#elif #cpu(x86_64) || #machine(x86_64) +# error +#endif + +#if defined __i386__ +# if !#cpu(i386) || !#machine(i386) +# error +# endif +#elif #cpu(i386) || #machine(i386) +# error +#endif + +#if defined __ia64__ +# if !#cpu(ia64) || !#machine(ia64) +# error +# endif +#elif #cpu(ia64) || #machine(ia64) +# error +#endif + +#if defined __iq2000__ +# if !#cpu(iq2000) || !#machine(iq2000) +# error +# endif +#elif #cpu(iq2000) || #machine(iq2000) +# error +#endif + +#if defined __M32R__ +# if !#cpu(m32r) || !#machine(m32r) +# error +# endif +#elif #cpu(m32r) || #machine(m32r) +# error +#endif + +#if defined __m68k__ +# if !#cpu(m68k) || !#machine(m68k) +# error +# endif +#elif #cpu(m68k) || #machine(m68k) +# error +#endif + +#if defined __mcore__ +# if !#cpu(mcore) || !#machine(mcore) +# error +# endif +#elif #cpu(mcore) || #machine(mcore) +# error +#endif + +#if defined __mips__ +# if !#cpu(mips) || (defined __sgi__ && !#machine(sgi)) \ + || (!defined __sgi__ && !#machine(mips)) +# error +# endif +#elif #cpu(mips) || #machine(sgi) || #machine(mips) +# error +#endif + +#if defined __mn10300__ +# if !#cpu(mn10300) || !#machine(mn10300) +# error +# endif +#elif #cpu(mn10300) || #machine(mn10300) +# error +#endif + +#if defined __pdp11__ +# if !#cpu(pdp11) || !#machine(pdp11) +# error +# endif +#elif #cpu(pdp11) || #machine(pdp11) +# error +#endif + +#if defined __powerpc__ +# if defined __powerpc64__ +# if (#cpu(powerpc) || #machine(powerpc) \ + || !#cpu(powerpc64) || !#machine(powerpc64)) +# error +# endif +# else +# if (!#cpu(powerpc) || !#machine(powerpc) \ + || #cpu(powerpc64) || #machine(powerpc64)) +# error +# endif +# endif +#elif (#cpu(powerpc) || #machine(powerpc) \ + || #cpu(powerpc64) || #machine(powerpc64)) +# error +#endif + +#if defined __rs6000__ +# if !#cpu(rs6000) || !#machine(rs6000) +# error +# endif +#elif #cpu(rs6000) || #machine(rs6000) +# error +#endif + +#if defined __s390__ +# if !#cpu(s390) || !#machine(s390) +# error +# endif +#elif #cpu(s390) || #machine(s390) +# error +#endif + +#if defined __sh__ +# if !#cpu(sh) || !#machine(sh) +# error +# endif +#elif #cpu(sh) || #machine(sh) +# error +#endif + +#if defined __sparc__ +# if (defined __arch64__ \ + && (!#cpu(sparc64) || !#machine(sparc64) || #cpu(sparc) || #machine(sparc))) + || (!defined __arch64__ \ + && (#cpu(sparc64) || #machine(sparc64) || !#cpu(sparc) || !#machine(sparc))) +# error +# endif +#elif #cpu(sparc64) || #machine(sparc64) || #cpu(sparc) || #machine(sparc) +# error +#endif + +#if defined __xstormy16__ +# if !#cpu(xstormy16) || !#machine(xstormy16) +# error +# endif +#elif #cpu(xstormy16) || #machine(xstormy16) +# error +#endif + +#if defined __v850__ +# if !#cpu(v850) || !#machine(v850) +# error +# endif +#elif #cpu(v850) || #machine(v850) +# error +#endif + +#if defined __vax__ +# if !#cpu(vax) || !#machine(vax) +# error +# endif +#elif #cpu(vax) || #machine(vax) +# error +#endif + +#if defined __XTENSA__ +# if !#cpu(xtensa) || !#machine(xtensa) +# error +# endif +#elif #cpu(xtensa) || #machine(xtensa) +# error +#endif +
assert4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mac-eol-at-eof.c =================================================================== --- mac-eol-at-eof.c (nonexistent) +++ mac-eol-at-eof.c (revision 154) @@ -0,0 +1,3 @@ +/* Test no newline at eof warning when Mac line ending is used*/ +/* { dg-do compile } */ +int main() { return 0; }
mac-eol-at-eof.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: extratokens2.c =================================================================== --- extratokens2.c (nonexistent) +++ extratokens2.c (revision 154) @@ -0,0 +1,22 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fno-show-column -Wno-endif-labels" } */ + +/* Tests that -Wno-endif-labels correctly disables the checks done by + default (and tested in extratokens.c). */ + +/* Source: Phil Edwards, 21 Mar 2002. Copied from extratokens.c and + modified. */ + +#if 1 +#if 0 +#else foo /* { dg-bogus "extra tokens" "bad warning" } */ +#endif / /* { dg-bogus "extra tokens" "bad warning" } */ +#endif + +# 36 "file.c" 3 + +/* ... but in a system header, it's acceptable. */ +#ifdef KERNEL +#endif KERNEL /* { dg-bogus "extra tokens" "bad warning" } */
extratokens2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000127-1.c =================================================================== --- 20000127-1.c (nonexistent) +++ 20000127-1.c (revision 154) @@ -0,0 +1,139 @@ +/* { dg-do compile } */ + +/* Test for core dump in the preprocessor. Originally exposed by + XEmacs, but this has been synthesized from scratch. */ + +#define foo(bar) bar + +int x = +foo( + /* + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + + */ + 2);
20000127-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: import1.c =================================================================== --- import1.c (nonexistent) +++ import1.c (revision 154) @@ -0,0 +1,16 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +/* This tests that our eagerness to apply the multiple include guard + optimization to the #import doesn't stop us marking the file + once-only. + + Neil Booth, 2 August 2003. */ + +#include "import1.h" +#import "import1.h" +#undef IMPORT1_H +#define BUG +#include "import1.h"
import1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: backslash.c =================================================================== --- backslash.c (nonexistent) +++ backslash.c (revision 154) @@ -0,0 +1,21 @@ +/* Test backslash newline with and without trailing spaces. */ + +#define alpha(a, b, c) \ + a, \ + b, \ + c + +/* Note the trailing whitespace on the next three lines. */ +#define beta(a, b, c) \ + a, \ + b, \ + c + +/* { dg-warning "separated by space" "space" { target *-*-* } 9 } */ +/* { dg-warning "separated by space" "tab" { target *-*-* } 10 } */ +/* { dg-warning "separated by space" "space and tab" { target *-*-* } 11 } */ + +int x[] = { + alpha(1, 2, 3), + beta(4, 5, 6) +};
backslash.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste2.c =================================================================== --- paste2.c (nonexistent) +++ paste2.c (revision 154) @@ -0,0 +1,118 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +/* Test ## behavior and corner cases thoroughly. The macro expander + failed many of these during development. */ + +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +typedef __WCHAR_TYPE__ wchar_t; + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +#define EMPTY +#define str(x) #x +#define xstr(x) str(x) +#define glue(x, y) x ## y +#define xglue(x, y) glue (x, y) +#define glue3(x, y, z) x ## y ## z +#define glue_var(x, ...) x ## __VA_ARGS__ + +#define __muldi3 __NDW(mul, 3 = 50) +#define __NDW(a,b) __ ## a ## di ## b +#define m3 NDW() +#define NDW(x) m3 ## x = 50 +#define five 5 +#define fifty int fif ## ty + +/* Defines a function called glue, returning what it is passed. */ +int glue (glue,) (int x) +{ + return x; +} + +int main () +{ + /* m3 and __muldi3 would sometimes cause an infinite loop. Ensure + we only expand fifty once. */ + fifty = 50, m3, __muldi3; + + /* General glue and macro expanding test. */ + int five0 = xglue (glue (fi, ve), 0); + + /* Tests only first and last tokens are pasted, and pasting to form + the != operator. Should expand to: if (five0 != 50). */ + if (glue3 (fi, ve0 !,= glue (EMPTY 5, 0))) + err ("five0 != 50"); + + /* Test varags pasting, and pasting to form the >> operator. */ + if (glue_var(50 >, > 1 != 25)) + err ("Operator >> pasting"); + + /* The LHS should not attempt to expand twice, and thus becomes a + call to the function glue. */ + if (glue (gl, ue) (12) != 12) + err ("Recursive macros"); + + /* Test placemarker pasting. The glued lines should all appear + neatly in the same column and below each other, though we don't + test that here. */ + { + int glue3(a, b, ) = 1, glue3(a,,) = 1; + glue3(a, , b)++; + glue3(, a, b)++; + glue3(,a,)++; + glue3(,,a)++; + if (a != 3 || ab != 3 glue3(,,)) + err ("Placemarker pasting"); + } + + /* Test that macros in arguments are not expanded. */ + { + int glue (EMPTY,1) = 123, glue (T, EMPTY) = 123; + if (EMPTY1 != 123 || TEMPTY != 123) + err ("Pasted arguments macro expanding"); + } + + /* Test various paste combinations. */ + { + const wchar_t* wc_array = glue(L, "wide string"); + wchar_t wc = glue(L, 'w'); + const char * hh = xstr(xglue(glue(%, :), glue(%, :))); + int array glue (<, :) 1 glue (:, >) = glue(<, %) 1 glue(%, >); + int x = 4; + + if (array[0] != 1) + err ("Digraph pasting"); + + x glue (>>, =) 1; /* 2 */ + x glue (<<, =) 1; /* 4 */ + x glue (*, =) 2; /* 8 */ + x glue (+, =) 100; /* 108 */ + x glue (-, =) 50; /* 58 */ + x glue (/, =) 2; /* 29 */ + x glue (%, =) 20; /* 9 */ + x glue (&, =) 254; /* 8 */ + x glue (|, =) 16; /* 24 */ + x glue (^, =) 18; /* 10 */ + + if (x != 10 || 0 glue (>, =) 1 glue (|, |) 1 glue (<, =) 0) + err ("Various operator pasting"); + if (strcmp (hh, "%:%:")) + err ("Pasted digraph spelling"); + if ((glue (., 1) glue (!, =) .1)) + err ("Pasted numbers 1"); + /* glue3 here will only work if we paste left-to-right. If a + future implementation does not do this, change the test. */ + if (glue3 (1.0e, +, 1) != 10.0) + err ("Pasted numbers 2"); + } + + return 0; +}
paste2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi2b.h =================================================================== --- mi2b.h (nonexistent) +++ mi2b.h (revision 154) @@ -0,0 +1,6 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey . */ + +#define need_x +#include "mi2c.h"
mi2b.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: normalize-2.c =================================================================== --- normalize-2.c (nonexistent) +++ normalize-2.c (revision 154) @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=nfkc" } */ + +\u00AA /* { dg-warning "not in NFKC" } */ +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A /* { dg-warning "not in NFC" } */ + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 /* { dg-warning "not in NFC" } */ +\uAC01 +\u1100\u1161\u11A8 /* { dg-warning "not in NFC" } */ +\uAC00\u11A8 /* { dg-warning "not in NFC" } */
normalize-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000529-1.c =================================================================== --- 20000529-1.c (nonexistent) +++ 20000529-1.c (revision 154) @@ -0,0 +1,14 @@ +/* Regression test for bug with macro expansion on #if lines - + exposed by glibc. */ +/* { dg-do compile } */ + +# define SHLIB_COMPAT(lib, introduced, obsoleted) \ + (!(ABI_##lib##_##obsoleted - 0) \ + || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))) + +#if 0 +bad +#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +int +#endif +x;
20000529-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucnid-1.c =================================================================== --- ucnid-1.c (nonexistent) +++ ucnid-1.c (revision 154) @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ +void abort (void); + +#define \u00C0 1 +#define \u00C1 2 +#define \U000000C2 3 +#define wh\u00ff 4 +#define a\u00c4b\u0441\U000003b4e 5 + +int main (void) +{ + + if (\u00C0 != 1) + abort (); + if (\u00c1 != 2) + abort (); + if (\u00C2 != 3) + abort (); + if (wh\u00ff != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e != 5) + abort (); + + return 0; +}
ucnid-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: import1.h =================================================================== --- import1.h (nonexistent) +++ import1.h (revision 154) @@ -0,0 +1,6 @@ +#ifndef IMPORT1_H +#define IMPORT1_H +#ifdef BUG +#error Should not happen +#endif +#endif
import1.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: strify2.c =================================================================== --- strify2.c (nonexistent) +++ strify2.c (revision 154) @@ -0,0 +1,56 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-std=c99 -pedantic-errors -fno-show-column" } */ + +/* Tests a whole bunch of things are correctly stringified. */ + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +#define str(x) #x +#define xstr(x) str(x) +#define strvar(...) #__VA_ARGS__ + +#define glibc_str(x) glibc_str2 (w, x) +#define glibc_str2(w, x) #x +#define ver GLIBC_2.2 + +int main (int argc, char *argv[]) +{ + str (\); /* { dg-warning "valid string" "str(\\)" } */ + str (\\); /* OK. */ + str (\\\); /* { dg-warning "valid string" "str(\\\\\\)" } */ + + /* This also serves as a useful test of the value of __INCLUDE_LEVEL. */ + if (strcmp (xstr (__INCLUDE_LEVEL__), "0")) + err ("macro expansion"); + + if (strcmp(str (__INCLUDE_LEVEL__), "__INCLUDE_LEVEL__")) + err ("macro name"); + + if (strcmp(str(), "") || strcmp(str( ), "")) + err ("empty string"); + + if (strcmp(str ("s\n"), "\"s\\n\"")) + err ("quoted string"); + + if (strcmp (str (a € b), "a \200 b")) + err ("unprintable char"); + + if (strcmp (str ( a b@ c ), "a b@ c")) + err ("internal whitespace"); + + if (strcmp (str(a \n), "a \n")) + err ("backslash token"); + + if (strcmp (strvar (foo, bar), "foo, bar")) + err ("variable arguments"); + + if (strcmp (glibc_str (ver), "GLIBC_2.2")) + err ("whitespace"); + + return 0; +}
strify2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: uchar-3.c =================================================================== --- uchar-3.c (nonexistent) +++ uchar-3.c (revision 154) @@ -0,0 +1,17 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-funsigned-char -fpreprocessed" } */ + +/* Source: Ziemowit Laski. -fpreprocessed doesn't define macros, but + CPP would interpret charconsts based upon whether __CHAR_UNSIGNED__ + was defined. */ + +int foo() +{ + char f = 0x83; + if (f == '\x83') /* { dg-bogus "always false" } */ + f = 0; + + return 0; +}
uchar-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: System/Library/Frameworks/Carbon.framework/Headers/Carbon.h =================================================================== --- System/Library/Frameworks/Carbon.framework/Headers/Carbon.h (nonexistent) +++ System/Library/Frameworks/Carbon.framework/Headers/Carbon.h (revision 154) @@ -0,0 +1,4 @@ +/* Used by gcc.dg/cpp/isysroot-2.c to test isysroot. */ +void foo() +{ +}
System/Library/Frameworks/Carbon.framework/Headers/Carbon.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20020927-1.c =================================================================== --- 20020927-1.c (nonexistent) +++ 20020927-1.c (revision 154) @@ -0,0 +1,91 @@ +/* Test case for buffer overflow bug in token stringification. + See PR preprocessor/8055 for details. + Reported by Alexander N. Kabaev . + Test case written by Zack Weinberg . */ + +/* { dg-do preprocess } */ + +#define S(x) #x + +/* Fill up one internal buffer with data. */ +S(1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 12345678901234567890123456789012345678901234567890123456789012345) + +/* When stringify_arg() was called with an empty macro argument, it would + advance the buffer pointer by one but fail to check for running past the + end of the buffer. We can only know where the end of the buffer is to + within about eight bytes, so do this sixteen times to be sure of hitting + it. */ + +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() + +/* Now allocate more memory in the buffer, which should provoke a crash. */ + +S(abcdefghijklmnopqrstuvwxyz) +S(abcdefghijklmnopqrstuvwxyz)
20020927-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi6d.h =================================================================== --- mi6d.h (nonexistent) +++ mi6d.h (revision 154) @@ -0,0 +1,5 @@ +#if EMPTYL !defined (guard) + #ifdef VAR + VAR++; + #endif +#endif
mi6d.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: spacing2.c =================================================================== --- spacing2.c (nonexistent) +++ spacing2.c (revision 154) @@ -0,0 +1,16 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* We used to output an unnecessary leading space, leading to Emacs + confusion with its Makefile abuse. + + Neil Booth, 12 Oct 2001. */ + +#define EMPTY +#define foo bar + +a = EMPTY +foo.. /* No leading space on output. */ + +/* { dg-final { scan-file spacing2.i "(^|\n)bar\.\." } } */
spacing2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wvariadic-1.c =================================================================== --- Wvariadic-1.c (nonexistent) +++ Wvariadic-1.c (revision 154) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic -Werror" } */ + +#define f(x,...) /* { dg-error "variadic" } */ +#define g(x,y...) /* { dg-error "variadic" } */ +int not_empty;
Wvariadic-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: frame/one.framework/Frameworks/OneSub.framework/Headers/A.h =================================================================== --- frame/one.framework/Frameworks/OneSub.framework/Headers/A.h (nonexistent) +++ frame/one.framework/Frameworks/OneSub.framework/Headers/A.h (revision 154) @@ -0,0 +1 @@ +#import
frame/one.framework/Frameworks/OneSub.framework/Headers/A.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: frame/one.framework/Frameworks/OneSub.framework/Headers/B.h =================================================================== --- frame/one.framework/Frameworks/OneSub.framework/Headers/B.h (nonexistent) +++ frame/one.framework/Frameworks/OneSub.framework/Headers/B.h (revision 154) @@ -0,0 +1 @@ +#import
frame/one.framework/Frameworks/OneSub.framework/Headers/B.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: frame/one.framework/Frameworks/OneSub.framework/Headers/C.h =================================================================== --- frame/one.framework/Frameworks/OneSub.framework/Headers/C.h (nonexistent) +++ frame/one.framework/Frameworks/OneSub.framework/Headers/C.h (revision 154) @@ -0,0 +1,4 @@ +#ifdef ONESUB_C_INCLUDED +#error should only be imported once +#endif +#define ONESUB_C_INCLUDED 1
frame/one.framework/Frameworks/OneSub.framework/Headers/C.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: frame/one.framework/Headers/one-includeSubs.h =================================================================== --- frame/one.framework/Headers/one-includeSubs.h (nonexistent) +++ frame/one.framework/Headers/one-includeSubs.h (revision 154) @@ -0,0 +1,2 @@ +#import +#import
frame/one.framework/Headers/one-includeSubs.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dI-C.c =================================================================== --- cmdlne-dI-C.c (nonexistent) +++ cmdlne-dI-C.c (revision 154) @@ -0,0 +1,11 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. */ +/* PR 13726 */ + +/* { dg-do preprocess } */ +/* { dg-options "-dI -C" } */ + +#include "cmdlne-dI-C.h" /* #include comment */ +/* comment 2 */ + +/* { dg-final { scan-file cmdlne-dI-C.i "#include c+omment" } } */ +/* { dg-final { scan-file cmdlne-dI-C.i "header file c+omment" } } */
cmdlne-dI-C.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: expr.c =================================================================== --- expr.c (nonexistent) +++ expr.c (revision 154) @@ -0,0 +1,17 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test we get signedness of ?: operator correct. We would skip + evaluation of one argument, and might therefore not transfer its + unsignedness to the result. */ + +/* Neil Booth, 19 Jul 2002. */ + +#if (1 ? -2: 0 + 1U) < 0 +#error /* { dg-bogus "error" } */ +#endif + +#if (0 ? 0 + 1U: -2) < 0 +#error /* { dg-bogus "error" } */ +#endif
expr.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c90-if-comma-1.c =================================================================== --- c90-if-comma-1.c (nonexistent) +++ c90-if-comma-1.c (revision 154) @@ -0,0 +1,11 @@ +/* Test for commas in constant expressions in #if: not permitted in C90 + but permitted in unevaluated subexpressions in C99. */ +/* Origin: Joseph Myers */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +#if (1, 2) /* { dg-error "comma" "evaluated comma" } */ +#endif + +#if 1 || (1, 2) /* { dg-error "comma" "unevaluated comma" } */ +#endif
c90-if-comma-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dI-C.h =================================================================== --- cmdlne-dI-C.h (nonexistent) +++ cmdlne-dI-C.h (revision 154) @@ -0,0 +1 @@ +/* header file comment */
cmdlne-dI-C.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cmdlne-dD-M.c =================================================================== --- cmdlne-dD-M.c (nonexistent) +++ cmdlne-dD-M.c (revision 154) @@ -0,0 +1,15 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dD -M" } */ + +/* Test -dD -M does not fail. It should print just + the Makefile rule with dependencies. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file-not cmdlne-dD-M.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file-not cmdlne-dD-M.i "variable" } } + { dg-final { scan-file-not cmdlne-dD-M.i "(^|\n)cmdlne-dD-M.*:.*cmdlne-dD-M.c" { xfail *-*-* } } } */
cmdlne-dD-M.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro2.c =================================================================== --- macro2.c (nonexistent) +++ macro2.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests the argument context get set at the lower level if we drop + contexts whilst parsing arguments. This would enter an infinite + loop in is_macro_disabled previously. */ + +#define A Something +#define B C +#define C K( +#define K(S) S +#define T B A ) +T /* Expands to . */
macro2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19990407-1.c =================================================================== --- 19990407-1.c (nonexistent) +++ 19990407-1.c (revision 154) @@ -0,0 +1,19 @@ +/* Regression test for a cpplib macro-expansion bug where + `@' becomes `@@' when stringified. */ + +/* { dg-do run } */ + +#include +#include + +#define STR(x) #x + +char *a = STR(@foo), *b = "@foo"; + +int +main(void) +{ + if (strcmp (a, b)) + abort (); + return 0; +}
19990407-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: endif.c =================================================================== --- endif.c (nonexistent) +++ endif.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test case for PR preprocessor/6386 by Andreas Schwab. We'd back up + over the CPP_EOF token (indicating not a funlike macro invocation) + in the header file, which would then be passed through as a real + EOF, leading to an early exit (and therefore bogus complaint about + unterminated #if). */ + +#define S(x) +#if 1 +#include "endif.h" +#endif
endif.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wsignprom.c =================================================================== --- Wsignprom.c (nonexistent) +++ Wsignprom.c (revision 154) @@ -0,0 +1,26 @@ +/* { dg-do preprocess } */ +/* { dg-options "-Wall" } */ + +/* Test that -Wall emits the warnings about integer promotion changing + the sign of an operand. */ + +#if -1 > 0U /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 0U + -1 /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 0U * -1 /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 1U / -2 /* { dg-warning "changes sign when promoted" } */ +#endif + +#if -1 % 1U /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 1 ? 0U : -1 /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 1 ? -1 : 0U /* { dg-warning "changes sign when promoted" } */ +#endif
Wsignprom.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi2.c =================================================================== --- mi2.c (nonexistent) +++ mi2.c (revision 154) @@ -0,0 +1,12 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey . */ +/* { dg-do compile } */ + +#include "mi2a.h" +#include "mi2b.h" + +int main (void) +{ + return x; +}
mi2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c99-pedantic.c =================================================================== --- c99-pedantic.c (nonexistent) +++ c99-pedantic.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=c99 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif
c99-pedantic.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: endif.h =================================================================== --- endif.h (nonexistent) +++ endif.h (revision 154) @@ -0,0 +1 @@ +S
endif.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20050215-1.c =================================================================== --- 20050215-1.c (nonexistent) +++ 20050215-1.c (revision 154) @@ -0,0 +1,10 @@ +/* Testcase for memory corruption bug in macro processing. + See PR preprocessor/19077 for details. */ + +/* { dg-do compile } */ +/* { dg-options "-g3" } */ +#define FOO(a,b,c,d,e) a b c d e \ +" " \ +" " \ +" " +int i;
20050215-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: redef2.c =================================================================== --- redef2.c (nonexistent) +++ redef2.c (revision 154) @@ -0,0 +1,31 @@ +/* Test for redefining macros with significant differences. */ + +/* { dg-do preprocess } + { dg-options "-ansi -Wall -fno-show-column" } */ + +#define mac(a, b) (a) + (b) +#define mac(a, b) (a) * (b) +#define mac(a, b) (a) * (x) +#define mac(a, g) (a) * (x) + +#define ro(x) foo x bar +#define ro(x, b) foo x bar + +#define va(a...) a +#define va(...) __VA_ARGS__ + +#define foo(x) x +#define foo(x)x /* { dg-bogus "redefined" "redefined foo" } */ + +/* { dg-warning "redefined" "redef mac" { target *-*-* } 7 } + { dg-warning "redefined" "redef mac" { target *-*-* } 8 } + { dg-warning "redefined" "redef mac" { target *-*-* } 9 } + { dg-warning "redefined" "redef ro" { target *-*-* } 12 } + { dg-warning "redefined" "redef va" { target *-*-* } 15 } + + { dg-warning "previous" "prev def mac" { target *-*-* } 6 } + { dg-warning "previous" "prev def mac" { target *-*-* } 7 } + { dg-warning "previous" "prev def mac" { target *-*-* } 8 } + { dg-warning "previous" "prev def ro" { target *-*-* } 11 } + { dg-warning "previous" "prev def va" { target *-*-* } 14 } +*/
redef2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unc3.c =================================================================== --- unc3.c (nonexistent) +++ unc3.c (revision 154) @@ -0,0 +1,5 @@ +/* Tests for unterminated conditionals: 3. */ +/* { dg-do preprocess } */ + +#if 1 /* { dg-error "#else" "unterminated #else" } */ +#else
unc3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi1c.h =================================================================== --- trad/mi1c.h (nonexistent) +++ trad/mi1c.h (revision 154) @@ -0,0 +1,12 @@ +/* Redundant header include test with C comments at top. */ +# /* And a null directive at the top. */ + +#ifndef CPP_MIC_H +#define CPP_MIC_H + +int a; + +#endif + +# /* And at the end, too! */ +/* And at the end too! */
trad/mi1c.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/defined.c =================================================================== --- trad/defined.c (nonexistent) +++ trad/defined.c (revision 154) @@ -0,0 +1,78 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests tradcpp0 with defined. The defined operator in traditional C + works just the same as the defined operator in Standard C. */ + +/* Source: Zack Weinberg, glibc, Neil Booth 11 Dec 2000. */ + +#if defined REGPARMS +#error REGPARMS should not be defined +#endif + +#define REGPARMS 1 +#if !defined REGPARMS +#error REGPARMS should be defined +#endif + +#define defined /* { dg-error "defined" } */ + +/* No diagnostics, though you could argue there should be. */ +#if defined defined +#error defined is defined! +#endif + +#define is_Z_defined defined Z + +#if defined Z +#error Z is not defined +#endif + +/* The behavior of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined +#error Macro expanding into defined operator test 1 +#endif + +#define Z + +#if !defined Z +#error Z is defined +#endif + +#if !is_Z_defined +#error Macro expanding into defined operator test 2 +#endif + +#undef is_Z_defined +#undef Z + +/* Do all the tests over again with the () form of defined. */ + +/* No diagnostics, though you could argue there should be. */ +#if defined(defined) +#error defined is defined! +#endif + +#define is_Z_defined defined ( Z ) + +#if defined(Z) +#error Z is not defined +#endif + +/* The behavior of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined +#error Macro expanding into defined operator test 1 +#endif + +#define Z + +#if !defined(Z) +#error Z is defined +#endif + +#if !is_Z_defined +#error Macro expanding into defined operator test 2 +#endif
trad/defined.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/funlike-5.c =================================================================== --- trad/funlike-5.c (nonexistent) +++ trad/funlike-5.c (revision 154) @@ -0,0 +1,10 @@ +/* Test function like macro. */ +/* Contributed by Devang Patel */ + +/* {do-do preprocess } */ +/* { dg-options "-traditional-cpp -E -dD" } */ +int __srget (char *); +#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) +#define getc(fp) __sgetc(fp) +#define getchar() getc(stdin) +
trad/funlike-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/comment-2.c =================================================================== --- trad/comment-2.c (nonexistent) +++ trad/comment-2.c (revision 154) @@ -0,0 +1,11 @@ +/* Test for warning of nested comments. */ + +/* { dg-do preprocess } */ + +/* { dg-options "-traditional-cpp -Wcomments" } + +/* /* */ /* { dg-warning "within comment" } */ + +/* + + /* { dg-warning "within comment" } */
trad/comment-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/comment.c =================================================================== --- trad/comment.c (nonexistent) +++ trad/comment.c (revision 154) @@ -0,0 +1,5 @@ +/* Test for warning of unterminated comment. */ + +/* { dg-do preprocess } */ + +/* { dg-warning "unterminated comment" }
trad/comment.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi7b.h =================================================================== --- trad/mi7b.h (nonexistent) +++ trad/mi7b.h (revision 154) @@ -0,0 +1,4 @@ +#ifndef GUARD2 +#define GUARD2 +#endif +:
trad/mi7b.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/cmdlne-C2.c =================================================================== --- trad/cmdlne-C2.c (nonexistent) +++ trad/cmdlne-C2.c (revision 154) @@ -0,0 +1,11 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-C -traditional-cpp" } */ + +/* Test that comments are actually written out + + Neil Booth, 24 Jun 2002. */ + +/* { dg-final { scan-file cmdlne-C2.i "dg-final" } } */ +
trad/cmdlne-C2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/redef1.c =================================================================== --- trad/redef1.c (nonexistent) +++ trad/redef1.c (revision 154) @@ -0,0 +1,36 @@ +/* Test for redefining traditional macros with insignificant + (i.e. whitespace) differences. */ + +/* { dg-do preprocess } */ + + +#define foo bar +#define /* x */ foo /* x */ bar /* x */ + +#define quux(thud) a one and a thud and a two +#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two +#define quux(thud) a one and a thud and a two /* bah */ + +#define f(x, y)x "x y z" y +#define f(x, y) x "x y z" y + +#define baz() whiz bang +#define baz() whiz bang + +#define g foo +#undef g +#define g + +/* { dg-bogus "redefined" "foo redefined" { target *-*-* } 8 } */ +/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 11 } */ +/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 12 } */ +/* { dg-bogus "redefined" "f redefined" { target *-*-* } 15 } */ +/* { dg-bogus "redefined" "baz redefined" { target *-*-* } 18 } */ +/* { dg-bogus "redefined" "g redefined" { target *-*-* } 22 } */ + +/* { dg-bogus "previous def" "foo prev def" { target *-*-* } 7 } */ +/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 10 } */ +/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 11 } */ +/* { dg-bogus "previous def" "f prev def" { target *-*-* } 14 } */ +/* { dg-bogus "previous def" "baz prev def" { target *-*-* } 17 } */ +/* { dg-bogus "previous def" "g prev def" { target *-*-* } 20 } */
trad/redef1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/maccom1.c =================================================================== --- trad/maccom1.c (nonexistent) +++ trad/maccom1.c (revision 154) @@ -0,0 +1,13 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure that comments are ignored between # and the + directive name when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#/**/define def passed + +def + +/* { dg-final { scan-file maccom1.i "(^|\n)passed" } } */
trad/maccom1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/maccom3.c =================================================================== --- trad/maccom3.c (nonexistent) +++ trad/maccom3.c (revision 154) @@ -0,0 +1,13 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure that comments in the definition of a macro + parameter list are ignored when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def(x /**/, y) passed + +def(x,y) + +/* { dg-final { scan-file maccom3.i "(^|\n)passed" } } */
trad/maccom3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/hash.c =================================================================== --- trad/hash.c (nonexistent) +++ trad/hash.c (revision 154) @@ -0,0 +1,14 @@ +/* Test for erroneously thinking comments are token-pastes. + From XFree86 4.0. */ +/* { dg-do preprocess } */ + +#ifndef foo +#define foo /**/ +#endif + +#ifndef foo +#define foo /* as nothing */ +#endif + +/* { dg-bogus "(start|end) of macro" "paste at end" { target *-*-* } 7 } */ +/* { dg-bogus "(start|end) of macro" "comment at end" { target *-*-* } 11 } */
trad/hash.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/assert2.c =================================================================== --- trad/assert2.c (nonexistent) +++ trad/assert2.c (revision 154) @@ -0,0 +1,23 @@ +/* Malformed assertion tests. */ +/* { dg-do preprocess } */ + +#assert /* { dg-error "without predicate" "assert w/o predicate" } */ +#assert % /* { dg-error "an identifier" "assert punctuation" } */ +#assert 12 /* { dg-error "an identifier" "assert number" } */ +#assert abc /* { dg-error "missing" "assert w/o answer" } */ + +#if # /* { dg-error "without predicate" "test w/o predicate" } */ +#endif + +#if #% /* { dg-error "an identifier" "test punctuation" } */ +#endif + +#if #12 /* { dg-error "an identifier" "test number" } */ +#endif + +#if #abc +#error /* { dg-bogus "error" "test w/o answer" } */ +#endif + +#if #abc[def] /* { dg-error "not valid in" "bad syntax" } */ +#endif
trad/assert2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/cmdlne-dD.c =================================================================== --- trad/cmdlne-dD.c (nonexistent) +++ trad/cmdlne-dD.c (revision 154) @@ -0,0 +1,9 @@ +/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dD -traditional-cpp" } */ + +/* Test -dD does not fail. */ + +#define objlike obj like +#define funlike(like) fun like
trad/cmdlne-dD.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/Wunused.c =================================================================== --- trad/Wunused.c (nonexistent) +++ trad/Wunused.c (revision 154) @@ -0,0 +1,37 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-Wunused-macros -traditional-cpp" } */ + +/* Test everything related to -Wunused-macros. + + Source: Neil Booth, 23 Jul 2002. */ + +#include "Wunused.h" + +#define used1 /* { dg-bogus "used" } */ +#define used2 /* { dg-bogus "used" } */ +#define used3 /* { dg-bogus "used" } */ +#define used4 something /* { dg-bogus "used" } */ + +#define unused5 /* { dg-warning "used" } */ +#define unused6 /* { dg-warning "used" } */ +#define unused7() /* { dg-warning "used" } */ + +#if defined used1 +#endif +#ifdef used2 +#endif +#ifndef used3 +#endif +used4 + +unused7; /* This does not count as a use. */ + +#if 0 +unused5 /* This does not count as a use. */ +#endif + +#undef unused5 +#define unused6 +unused6
trad/Wunused.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/quote.c =================================================================== --- trad/quote.c (nonexistent) +++ trad/quote.c (revision 154) @@ -0,0 +1,6 @@ +/* Test that unterminated quotes are OK when only preprocessing. */ + +/* { dg-do preprocess } */ + +/* { dg-bogus "unterminated" } */ 'x +/* { dg-bogus "unterminated" } */ "x
trad/quote.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi2b.h =================================================================== --- trad/mi2b.h (nonexistent) +++ trad/mi2b.h (revision 154) @@ -0,0 +1,6 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey . */ + +#define need_x +#include "mi2c.h"
trad/mi2b.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/Wunused.h =================================================================== --- trad/Wunused.h (nonexistent) +++ trad/Wunused.h (revision 154) @@ -0,0 +1 @@ +#define unused_but_ok
trad/Wunused.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi6b.h =================================================================== --- trad/mi6b.h (nonexistent) +++ trad/mi6b.h (revision 154) @@ -0,0 +1,5 @@ +#if NOT defined (guard) + #ifdef VAR + VAR++; + #endif +#endif
trad/mi6b.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi6d.h =================================================================== --- trad/mi6d.h (nonexistent) +++ trad/mi6d.h (revision 154) @@ -0,0 +1,5 @@ +#if EMPTYL !defined (guard) + #ifdef VAR + VAR++; + #endif +#endif
trad/mi6d.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi3.def =================================================================== --- trad/mi3.def (nonexistent) +++ trad/mi3.def (revision 154) @@ -0,0 +1,10 @@ +/* Another test case for over-eager multiple include optimization. + This one distilled from glibc's setlocale.c and categories.def. + The #ifdef block doesn't cover the entire file, so it must not be + taken for a reinclude guard. */ + +#ifndef NO_POSTLOAD +#define NO_POSTLOAD NULL +#endif + +int X; Index: trad/xwin1.c =================================================================== --- trad/xwin1.c (nonexistent) +++ trad/xwin1.c (revision 154) @@ -0,0 +1,13 @@ +/* XWindows (as of 4.3) does some pretty strange things with cpp. + This tests one of them; the leading comments are supposed to be + eaten by the preprocessor; but the 'directives' after them are + supposed to be retained as text, not processed, so that imake's cpp + can be run on the output! + { dg-do preprocess } +*/ + +/**/#if 0 +passed +/**/#endif + +/* { dg-final { scan-file xwin1.i "(^|\n)#if 0" } } */
trad/xwin1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/recurse-1.c =================================================================== --- trad/recurse-1.c (nonexistent) +++ trad/recurse-1.c (revision 154) @@ -0,0 +1,10 @@ +/* Test for warning of and recovery from recursion in object-like + macros. */ + +/* { dg-do preprocess } */ + +#define foo foo +foo /* { dg-error "detected recursion" } */ + +#define bar a bar b +bar /* { dg-error "detected recursion" } */
trad/recurse-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/recurse-3.c =================================================================== --- trad/recurse-3.c (nonexistent) +++ trad/recurse-3.c (revision 154) @@ -0,0 +1,25 @@ +/* Tests that macros that look recursive but are not are accepted. */ + +/* { dg-do preprocess } */ + +#define g(x) x +g(g(g(g(g(g(g)))))); /* { dg-bogus "detected recursion" } */ + +/* This macro gets longer with each loop, to thwart tests for + recursion based on length. */ +#define f(a,b,c,d,e,f,g,h,i) a(b,c,d,e,f,g,h,i,2 3 4 5) +f(f,f,f,f,f,f,f,f,f) /* { dg-bogus "detected recursion" } */ + +/* The above cases should be enough, but this is taken from cccp + sources so let's try it too. */ +#define foo(x,y) bar (x (y,0), y) +foo (foo, baz); /* { dg-bogus "detected recursion" } */ + +#define mac mac/**/ro +mac /* { dg-bogus "detected recursion" } */ + +#define mac2 mac2 +"mac2" /* { dg-bogus "detected recursion" } */ + +#define macro "macro +macro mac2 /* { dg-bogus "detected recursion" } */
trad/recurse-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/escaped-eof.c =================================================================== --- trad/escaped-eof.c (nonexistent) +++ trad/escaped-eof.c (revision 154) @@ -0,0 +1,6 @@ +/* Test for warning of escaped EOF. */ + +/* { dg-do preprocess } */ + +/* { dg-warning "backslash-new" "escaped EOF warning" { target *-*-* } 6 } */ +\
trad/escaped-eof.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/escaped-nl.c =================================================================== --- trad/escaped-nl.c (nonexistent) +++ trad/escaped-nl.c (revision 154) @@ -0,0 +1,10 @@ +/* Test escaped newlines at start of macro definition are properly + skipped (buglet in skip_whitespace () in cpptrad.c). */ + +/* { dg-do preprocess } */ + +#define NUM \ +100 +#if NUM != 100 +# error NUM not defined properly /* { dg-bogus "error" } */ +#endif
trad/escaped-nl.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/literals-2.c =================================================================== --- trad/literals-2.c (nonexistent) +++ trad/literals-2.c (revision 154) @@ -0,0 +1,8 @@ +/* Test that unterminated quotes in CPP expressions are + recognized. */ + +/* { dg-do preprocess } */ +/* { dg-error "missing terminating" "bad charconst" { target *-*-* } 7 } */ +/* { dg-error "not valid" "bad charconst" { target *-*-* } 7 } */ +#if 'x +#endif
trad/literals-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi2.c =================================================================== --- trad/mi2.c (nonexistent) +++ trad/mi2.c (revision 154) @@ -0,0 +1,12 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey . */ +/* { dg-do compile } */ + +#include "mi2a.h" +#include "mi2b.h" + +int main (void) +{ + return x; +}
trad/mi2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi4.c =================================================================== --- trad/mi4.c (nonexistent) +++ trad/mi4.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Undefining a macro guard and re-including the file used to confuse + file caching in cppfiles.c, and attempt to open a bad fd. */ + +#include "mi1c.h" +#undef CPP_MIC_H +#include "mi1c.h"
trad/mi4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/define.c =================================================================== --- trad/define.c (nonexistent) +++ trad/define.c (revision 154) @@ -0,0 +1,2 @@ +/* { dg-do preprocess } */ +/* { dg-options "-traditional-cpp -DDEFINE1DEFINE -DDEFINE2DEFIN=" } */
trad/define.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi6.c =================================================================== --- trad/mi6.c (nonexistent) +++ trad/mi6.c (revision 154) @@ -0,0 +1,61 @@ +/* Another test case for over-eager multiple include optimization, + where the leading "#if !defined" expression is obtained partially, + or wholly, from macros. Neil Booth, 30 Sep 2001. */ + +/* { dg-do compile } */ +/* { dg-options "" } */ + +extern void abort (void); + +/* Each include file should not be subject to MI optimisation, since + macro definitions can change. Each header increments the variable + VAR if it is defined. + + The first set of inclusions gets the headers into CPP's cache, but + does nothing since VAR is not defined. The second set should each + increment VAR, since none of the initial set should have been + flagged as optimizable. */ + +#define EMPTYL +#define EMPTYR +#define NOT ! +#define DEFINED defined (guard) +#define NOT_DEFINED ! defined (guard) + +#include "mi6a.h" +#include "mi6b.h" +#include "mi6c.h" +#include "mi6d.h" +#include "mi6e.h" + +/* Define the macro guard, and redefine the macros to something that + forces compilation of the conditional blocks. */ +#define guard +#undef EMPTYL +#define EMPTYL 1 || +#undef EMPTYR +#define EMPTYR || 1 +#undef NOT +#define NOT +#undef DEFINED +#define DEFINED 0 +#undef NOT_DEFINED +#define NOT_DEFINED 1 + +#define VAR five + +int +main(void) +{ + unsigned int five = 0; + +#include "mi6a.h" +#include "mi6b.h" +#include "mi6c.h" +#include "mi6d.h" +#include "mi6e.h" + + if (five != 5) + abort (); + return 0; +}
trad/mi6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/funlike-2.c =================================================================== --- trad/funlike-2.c (nonexistent) +++ trad/funlike-2.c (revision 154) @@ -0,0 +1,23 @@ +/* Test that nested commas and parentheses in macro arguments are + OK. */ + +/* { dg-do preprocess } */ + +#define f(x) x +#define g(x, y) x y + +#if f((1)) != 1 +# error /* { dg-bogus "error" "nested parens 1" } */ +#endif + +#if f((1, 2)) != 2 +# error /* { dg-bogus "error" "nested comma 1" } */ +#endif + +#if g(, (1)) != 1 +# error /* { dg-bogus "error" "nested parens 2" } */ +#endif + +#if g((1, 2), + 3) != 5 +# error /* { dg-bogus "error" "nested comma 2" } */ +#endif
trad/funlike-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/funlike-4.c =================================================================== --- trad/funlike-4.c (nonexistent) +++ trad/funlike-4.c (revision 154) @@ -0,0 +1,26 @@ +/* Test that undefined names evaluate to zero, that macros after a + funlike macro are expanded, and that if it is a '(' the funlike + macro is not treated as such. */ + +/* { dg-do run } */ + +extern void abort (void); + +#define f(x) x + +int main () +{ +#if f(1) == f /**/ (/**/1/**/) + int x; +#endif + + x = 0; + if (f + /**/ ( + /**/ 0/**/ + /**/) + ) + abort (); + + return 0; +}
trad/funlike-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/macro.c =================================================================== --- trad/macro.c (nonexistent) +++ trad/macro.c (revision 154) @@ -0,0 +1,11 @@ +/* Test that varargs are rejected, and that we don't complain about + macro args in skipped blocks. */ + +/* { dg-do preprocess } */ + +#define f(x) +#define g(x, y...) /* { dg-error "macro parameter list" } */ + +#if 0 +#define f(a,b) /* { dg-bogus "passed 2 arguments" } */ +#endif
trad/macro.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/comment-3.c =================================================================== --- trad/comment-3.c (nonexistent) +++ trad/comment-3.c (revision 154) @@ -0,0 +1,6 @@ +/* Test we don't accept C++ comments. */ + +/* { dg-do preprocess } */ + +#if 0 +#endif // /* { dg-warning "extra tokens" } */
trad/comment-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi7a.h =================================================================== --- trad/mi7a.h (nonexistent) +++ trad/mi7a.h (revision 154) @@ -0,0 +1,4 @@ +: +#ifndef GUARD1 +#define GUARD1 +#endif
trad/mi7a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/trad.exp =================================================================== --- trad/trad.exp (nonexistent) +++ trad/trad.exp (revision 154) @@ -0,0 +1,43 @@ +# Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# There's a bunch of headers we need. +if [is_remote host] { + foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] { + remote_download host $header + } +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_TRADCPPFLAGS +if ![info exists DEFAULT_TRADCPPFLAGS] then { + set DEFAULT_TRADCPPFLAGS " -traditional-cpp" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_TRADCPPFLAGS + +# All done. +dg-finish Index: trad/redef2.c =================================================================== --- trad/redef2.c (nonexistent) +++ trad/redef2.c (revision 154) @@ -0,0 +1,32 @@ +/* Test for redefining traditional macros with significant differences. */ + +/* { dg-do preprocess } */ + +#define foo bar /* { dg-warning "previous def" "foo prev def" } */ +#define foo barr /* { dg-warning "redefined" "foo redefined" } */ + +#undef foo +#define foo bar /* { dg-warning "previous def" "foo prev def 2" } */ +#define foo() bar /* { dg-warning "redefined" "foo redefined 2" } */ + +#undef foo +#define foo() bar /* { dg-warning "previous def" "foo prev def" } */ +#define foo() barr /* { dg-warning "redefined" "foo redefined" } */ + +#define quux(thud) a thud b /* { dg-warning "previous def" "quux prev def" } */ +#define quux(thu) a thud b /* { dg-warning "redefined" "quux redefined" } */ + +#define bar(x, y) x+y /* { dg-warning "previous def" "bar prev def" } */ +#define bar(x, y) x+x /* { dg-warning "redefined" "bar redefined" } */ + +#define bat(x, y) x+y /* { dg-warning "previous def" "bat prev def" } */ +#define bat(x, y) x+ y /* { dg-warning "redefined" "bat redefined" } */ + +#define baz(x, y) x+y /* { dg-warning "previous def" "baz prev def" } */ +#define baz(x, y) x +y /* { dg-warning "redefined" "baz redefined" } */ + +#define f(x, y) "x y" /* { dg-warning "previous def" "f prev def" } */ +#define f(x, y) "x y" /* { dg-warning "redefined" "f redefined" } */ + +#define g(x, y) 'x' /* { dg-warning "previous def" "g prev def" } */ +#define g(x, y) ' x' /* { dg-warning "redefined" "g redefined" } */
trad/redef2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/paste.c =================================================================== --- trad/paste.c (nonexistent) +++ trad/paste.c (revision 154) @@ -0,0 +1,18 @@ +/* Test for proper comment elimination semantics from cpplib's -traditional. + This should compile and link with compiled with `gcc -traditional-cpp'. + Test case by Jason R. Thorpe . */ + +/* { dg-do compile } */ + +extern int printf (const char *, ...); + +#define A(name) X/**/name + +#define B(name) \ +void A(Y/**/name)() { A(name)(); } + +void Xhello() { printf("hello world\n"); } + +B(hello) + +int main() { XYhello(); return (0); }
trad/paste.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi1nd.h =================================================================== --- trad/mi1nd.h (nonexistent) +++ trad/mi1nd.h (revision 154) @@ -0,0 +1,8 @@ +/* Redundant include check with #if !defined. */ + +#if !defined CPP_MIND_H +#define CPP_MIND_H + +int c; + +#endif
trad/mi1nd.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/directive.c =================================================================== --- trad/directive.c (nonexistent) +++ trad/directive.c (revision 154) @@ -0,0 +1,23 @@ +/* Test for some basic aspects of -traditional directive processing. */ + +/* { dg-do preprocess } */ + +#define HASH # +HASH + +/* There is a #error directive. */ + +#error bad /* { dg-error "bad" } */ + +/* Directives with their #s indented are not recognized. */ + #if 0 /* { dg-bogus "unterminated" } */ + +#wrong /* { dg-error "invalid" } */ + +#define foo 2 +#define bar + 3 +#define foobar 6 + +#if foo/**/bar != 5 +# error Comments in directive is a separator /* { dg-bogus "error" } */ +#endif
trad/directive.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/strify.c =================================================================== --- trad/strify.c (nonexistent) +++ trad/strify.c (revision 154) @@ -0,0 +1,18 @@ +/* Test whether traditional stringify works. */ +/* { dg-do run } */ + +#define foo(a, b) c="a"; d="b"; + +extern void abort (); +extern void exit (int); + +int main () +{ + char *c, *d; + + foo (p,q); + if (c[0] != 'p' || d[0] != 'q') + abort (); + + exit (0); +}
trad/strify.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/maccom2.c =================================================================== --- trad/maccom2.c (nonexistent) +++ trad/maccom2.c (revision 154) @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure that comments between the #define directive + and the macro identifier are ignored (i.e. treated like whitespace) + when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define/**/def passed + +def + +/* { dg-final { scan-file maccom2.i "(^|\n)passed" } } */
trad/maccom2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/argcount.c =================================================================== --- trad/argcount.c (nonexistent) +++ trad/argcount.c (revision 154) @@ -0,0 +1,21 @@ +/* Test that we correctly complain about an invalid number of macro + arguments. */ + +/* { dg-do preprocess } */ + +#define f(x) x +#define g(x, y) x y +#define h() + +f(); /* { dg-bogus "requires 1" "no arg is 1 empty arg" } */ +f( ); /* { dg-bogus "macro" "1 arg to 1 param macro" } */ +f(1,); /* { dg-error "passed 2" "2 args to 1 param macro" } */ +f(1,2); /* { dg-error "passed 2" "2 args to 1 param macro" } */ +h(); /* { dg-bogus "macro" "no arg to 1 param macro" } */ +h( ); /* { dg-error "passed 1" "1 arg to 0 param macro" } */ +h(1,2); /* { dg-error "passed 2" "2 args to 0 param macro" } */ +g(); /* { dg-error "requires 2" "0 args to 2 param macro" } */ +g( ); /* { dg-error "requires 2" "1 args to 2 param macro" } */ +g( ,2); /* { dg-bogus "requires 2" "2 args to 2 param macro" } */ +g(,); /* { dg-bogus "requires 2" "2 args to 2 param macro" } */ +g(1,2,3); /* { dg-error "passed 3" "3 args to 2 param macro" } */
trad/argcount.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/assert1.c =================================================================== --- trad/assert1.c (nonexistent) +++ trad/assert1.c (revision 154) @@ -0,0 +1,46 @@ +/* Basic tests of the #assert preprocessor extension. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#define def unused expansion +#define fail int fail + +#assert abc (def) +#assert abc (ghi) +#assert abc (jkl) +#assert space ( s p a c e ) + +/* Basic: */ +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) +fail +#endif + +/* any answer for #abc */ +#if !#abc +fail +#endif + +/* internal whitespace is collapsed, + external whitespace is deleted */ +#if !#space (s p a c e) || !#space ( s p a c e ) || #space (space) +fail +#endif + +/* removing assertions */ +#unassert abc (jkl) +#if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl) +fail +#endif + +#unassert abc +#if #abc || #abc (def) || #abc (ghi) || #abc (jkl) +fail +#endif + +int gobble + +/* make sure it can succeed too. + also check space before open paren isn't significant */ +#if #space(s p a c e) +; +#endif
trad/assert1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi1x.h =================================================================== --- trad/mi1x.h (nonexistent) +++ trad/mi1x.h (revision 154) @@ -0,0 +1,9 @@ +/* This header is never to have its contents visible, but it should + still receive the optimization. */ + +#ifndef MIX_H +#define MIX_H + +#define main wibble + +#endif
trad/mi1x.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/maccom4.c =================================================================== --- trad/maccom4.c (nonexistent) +++ trad/maccom4.c (revision 154) @@ -0,0 +1,17 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure the comment is saved in the macro and copied + to the output file when the macro is expanded when the -CC option is + used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def /* passed */ + +def + +/* + /* The + in the regexp prevents it from matching itself. */ + { dg-final { scan-file maccom4.i "p+assed" } } +*/
trad/maccom4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/assert3.c =================================================================== --- trad/assert3.c (nonexistent) +++ trad/assert3.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-A abc=def -A abc\(ghi\) \"-Aabc = jkl\" -A abc=mno -A -abc=mno" } */ + +/* Test -A command line syntax. Source Neil Booth. 31 Oct 2000. */ + +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) || #abc(mno) +#error Command line -A assertions +#endif
trad/assert3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/maccom6.c =================================================================== --- trad/maccom6.c (nonexistent) +++ trad/maccom6.c (revision 154) @@ -0,0 +1,20 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure that expressions function properly + when used with macros containing comments and the -CC option + is being used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define ONE 1 /* one */ +#define TWO 2 /* two */ +#define THREE 3 /* three */ + +#if (ONE + TWO) != THREE +failed +#else +passed +#endif + +/* { dg-final { scan-file maccom6.i "(^|\n)passed" } } */
trad/maccom6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/builtins.c =================================================================== --- trad/builtins.c (nonexistent) +++ trad/builtins.c (revision 154) @@ -0,0 +1,52 @@ +/* Test that builtin-macros are OK. */ + +/* { dg-do run } */ + +#include "builtins.h" + +void abort (void); +char *strstr (const char *, const char *); +int strcmp (const char *, const char *); + +#define LINE __LINE__ + +#if __LINE__ != 13 +# error __LINE__ part 1 /* { dg-bogus "__LINE__" } */ +#endif + +#if \ + __LINE__ != 18 +# error __LINE__ part 2 /* { dg-bogus "__LINE__" } */ +#endif + +#if LINE != 22 +# error __LINE__ part 3 /* { dg-bogus "__LINE__" } */ +#endif + +#if __INCLUDE_LEVEL != 0 +# error __INCLUDE_LEVEL__ /* { dg-bogus "__INCLUDE_LEVEL__" } */ +#endif + +#if !defined (__TIME__) +# error __TIME__ /* { dg-bogus "__TIME__" } */ +#endif + +#if !defined (__DATE__) +# error __DATE__ /* { dg-bogus "__DATE__" } */ +#endif + + +int main () +{ + /* level is defined in builtins.h. */ + if (level != 1) + abort (); + + if (!strstr (__FILE__, "builtins.c")) + abort (); + + if (!strcmp (__BASE_FILE__, "builtins.c")) + abort (); + + return 0; +}
trad/builtins.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/__STDC__.c =================================================================== --- trad/__STDC__.c (nonexistent) +++ trad/__STDC__.c (revision 154) @@ -0,0 +1,7 @@ +/* Test that __STDC__ is not defined. */ + +/* { dg-do preprocess } */ + +#if defined __STDC__ +# error __STDC__ defined /* { dg-bogus "__STDC__" "__STDC__ defined" } */ +#endif
trad/__STDC__.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/assembler.S =================================================================== --- trad/assembler.S (nonexistent) +++ trad/assembler.S (revision 154) @@ -0,0 +1,29 @@ +/* Regression test - in assembly language, # may have some significance + other than 'stringize macro argument' and therefore must be preserved + in the output, and should not be warned about. */ + +/* { dg-do preprocess } */ + +#ifndef FOO +#1 /* Once caused a bogus unterminated #ifndef. */ +#endif + +#define foo() mov r0, #5 /* { dg-bogus "not followed" "spurious warning" } */ + +entry: + foo() + +/* Check we don't EOF on an unknown directive. */ +#unknown directive +#error a later diagnostic /* { dg-error "diagnostic" } */ + +/* + { dg-final { if ![file exists 20000510-1.i] { return } } } + { dg-final { set tmp [grep 20000510-1.i # line] } } + { dg-final { if {[string length $tmp] > 0} \{ } } + { dg-final { pass "20000510-1.S: # preservation" } } + { dg-final { \} else \{ } } + { dg-final { fail "20000510-1.S: # preservation" } } + { dg-final { \} } } +*/ +
trad/assembler.S Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/num-sign.c =================================================================== --- trad/num-sign.c (nonexistent) +++ trad/num-sign.c (revision 154) @@ -0,0 +1,16 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +/* Tests that traditional numbers are signed, unless otherwise + specified. This test assumes a 32 bit target. + + Neil Booth, 5 Aug 2001. Inspired by PR 3824. */ + +#if 0xffffffffffffffff >= 0 +# error 0xffffffffffffffff /* { dg-bogus "0xffffffffffffffff" "0xffffffffffffffff positive" } */ +#endif + +#if 0xffffffffffffffffU <= 0 +# error 0xffffffffffffffffU /* { dg-bogus "0xffffffffffffffffU" "0xffffffffffffffffU negative" } */ +#endif
trad/num-sign.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi2a.h =================================================================== --- trad/mi2a.h (nonexistent) +++ trad/mi2a.h (revision 154) @@ -0,0 +1,5 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey . */ + +#include "mi2c.h"
trad/mi2a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi1ndp.h =================================================================== --- trad/mi1ndp.h (nonexistent) +++ trad/mi1ndp.h (revision 154) @@ -0,0 +1,7 @@ +#if !defined ( CPP_MINDP_H) +#define CPP_MINDP_H + +/* Redundant include check with #if !defined and parentheses. */ +int d; + +#endif
trad/mi1ndp.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/builtins.h =================================================================== --- trad/builtins.h (nonexistent) +++ trad/builtins.h (revision 154) @@ -0,0 +1 @@ +int level = __INCLUDE_LEVEL__;
trad/builtins.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi2c.h =================================================================== --- trad/mi2c.h (nonexistent) +++ trad/mi2c.h (revision 154) @@ -0,0 +1,15 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey . */ +#ifdef need_x +#undef need_x +#ifndef have_x +#define have_x +extern int x; +#endif +#endif + +#ifndef t_h +#define t_h +extern int y; +#endif
trad/mi2c.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/cmdlne-dM.c =================================================================== --- trad/cmdlne-dM.c (nonexistent) +++ trad/cmdlne-dM.c (revision 154) @@ -0,0 +1,9 @@ +/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dM -traditional-cpp" } */ + +/* Test -dM does not fail. */ + +#define objlike obj like +#define funlike(like) fun like
trad/cmdlne-dM.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi6a.h =================================================================== --- trad/mi6a.h (nonexistent) +++ trad/mi6a.h (revision 154) @@ -0,0 +1,5 @@ +#if NOT_DEFINED + #ifdef VAR + VAR++; + #endif +#endif
trad/mi6a.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/uchar.c =================================================================== --- trad/uchar.c (nonexistent) +++ trad/uchar.c (revision 154) @@ -0,0 +1,8 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-funsigned-char -fsigned-char -traditional-cpp" } */ + +#if defined (__CHAR_UNSIGNED__) +# error __CHAR_UNSIGNED__ defined +#endif
trad/uchar.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi6c.h =================================================================== --- trad/mi6c.h (nonexistent) +++ trad/mi6c.h (revision 154) @@ -0,0 +1,5 @@ +#if !DEFINED + #ifdef VAR + VAR++; + #endif +#endif
trad/mi6c.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi6e.h =================================================================== --- trad/mi6e.h (nonexistent) +++ trad/mi6e.h (revision 154) @@ -0,0 +1,5 @@ +#if !defined (guard) EMPTYR + #ifdef VAR + VAR++; + #endif +#endif
trad/mi6e.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/recurse-2.c =================================================================== --- trad/recurse-2.c (nonexistent) +++ trad/recurse-2.c (revision 154) @@ -0,0 +1,16 @@ +/* Test for warning of and recovery from recursion in function-like + macros. */ + +/* { dg-do preprocess } */ + +#define foo() foo() +foo(); /* { dg-error "detected recursion" } */ + +#define bar() bar baz() bar +bar(); /* { dg-bogus "detected recursion" } */ + +#define baz() foo() +baz(); /* { dg-error "detected recursion" } */ + +#define a(x) x(a) +a(a); /* { dg-error "detected recursion" } */
trad/recurse-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/literals-1.c =================================================================== --- trad/literals-1.c (nonexistent) +++ trad/literals-1.c (revision 154) @@ -0,0 +1,28 @@ +/* Test that (what looks like) comments are not recognized in literals + and that quotes within quotes do not confused the preprocessor. */ + +/* { dg-do run } */ + +extern void abort (void); + +int main () +{ + const char *str1 = "/*"; + const char *str2 = "'"; + + if (str1[0] != '/' || str1[1] != '*' || str1[2] != '\0') + abort (); + + if (str2[0] != '\'' || str2[1] != '\0') + abort (); + +#if '"' != '\"' +# error /* { dg-bogus "error" "double quote in charconst" } */ +#endif + +#if !'\'' +# error quote /* { dg-bogus "quote" "quote in charconst" } */ +#endif + + return 0; +}
trad/literals-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/macroargs.c =================================================================== --- trad/macroargs.c (nonexistent) +++ trad/macroargs.c (revision 154) @@ -0,0 +1,30 @@ +/* Test that whitespace in arguments is preserved, and that each + newline in macro arguments become a space. */ + +/* { dg-do run } */ + +#define f(x, y) "x y" +#define g(x) x + +extern void abort (void); + +int main () +{ + const char *str1 = f( foo ,bar); + const char *str2 = f( +foo +,bar); + + if (strcmp (str1, " foo bar")) + abort (); + + if (strcmp (str1, str2)) + abort (); + + /* Verify that quoted state is preserved over a newline. */ + if (strcmp (g /* { dg-bogus "unterminated 2" } */ ("1 +, 2"), "1 , 2")) + abort (); + + return 0; +}
trad/macroargs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/cmdlne-C.c =================================================================== --- trad/cmdlne-C.c (nonexistent) +++ trad/cmdlne-C.c (revision 154) @@ -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
trad/cmdlne-C.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/include.c =================================================================== --- trad/include.c (nonexistent) +++ trad/include.c (revision 154) @@ -0,0 +1,9 @@ +/* Copyright (c) 2002 Free Software Foundation Inc. */ + +/* Test that macros are not expanded in the <> quotes of #inlcude. */ + +/* { dg-do preprocess } */ + +#define __STDC__ 1 /* Stop complaints about non-ISO compilers. */ +#define stdio 1 +#include /* { dg-bogus "o such file or directory" } */
trad/include.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi1.c =================================================================== --- trad/mi1.c (nonexistent) +++ trad/mi1.c (revision 154) @@ -0,0 +1,36 @@ +/* Test "ignore redundant include" facility. + + We must test with C comments, and null directives, outside + the guard conditional; also, we test guarding with #ifndef and #if + !defined. -H is used because cpp might confuse the issue by + optimizing out #line markers. This test only passes if each of the + headers is read exactly once. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do compile } + { dg-options "-H -traditional-cpp" } + { dg-error "mi1c\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */ + +#include "mi1c.h" +#include "mi1c.h" +#include "mi1c.h" + +#include "mi1nd.h" +#include "mi1nd.h" + +#include "mi1ndp.h" +#include "mi1ndp.h" + +#define MIX_H +#include "mi1x.h" +#include "mi1x.h" + +int +main (void) +{ + return a + c + d; +}
trad/mi1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi3.c =================================================================== --- trad/mi3.c (nonexistent) +++ trad/mi3.c (revision 154) @@ -0,0 +1,20 @@ +/* Another test case for over-eager multiple include optimization. + This one distilled from glibc's setlocale.c and categories.def. */ +/* { dg-do compile } */ + +#define X a +#include "mi3.def" +#undef X + +#define X b +#include "mi3.def" +#undef X + +#include "mi3.h" +#include "mi3.h" /* The second include declares variable c. */ + +int +main(void) +{ + return a + b + c; +}
trad/mi3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi5.c =================================================================== --- trad/mi5.c (nonexistent) +++ trad/mi5.c (revision 154) @@ -0,0 +1,13 @@ +/* Test "ignore redundant include" facility, with -C on. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do preprocess } + { dg-options "-H -C -traditional-cpp" } + { dg-error "mi1c\.h" "redundant include check with -C" { target *-*-* } 0 } */ + +#include "mi1c.h" +#include "mi1c.h"
trad/mi5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/null-drctv.c =================================================================== --- trad/null-drctv.c (nonexistent) +++ trad/null-drctv.c (revision 154) @@ -0,0 +1,6 @@ +/* Test that the null directive doesn't swallow the following line. */ + +/* { dg-do preprocess } */ + +# +#error OK /* { dg-error "OK" } */
trad/null-drctv.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi7.c =================================================================== --- trad/mi7.c (nonexistent) +++ trad/mi7.c (revision 154) @@ -0,0 +1,19 @@ +/* Test "ignore redundant include" facility. + + -H is used because cpp might confuse the issue by optimizing out + #line markers. This test only passes if the headers is read + twice. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do preprocess } + { dg-options "-H -traditional-cpp" } + { dg-error "mi7a\.h\n\[^\n\]*mi7a\.h\n\[^\n\]*mi7b\.h\n\[^\n\]*mi7b\.h" "redundant include check" { target *-*-* } 0 } */ + +#include "mi7a.h" +#include "mi7a.h" +#include "mi7b.h" +#include "mi7b.h"
trad/mi7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/funlike-3.c =================================================================== --- trad/funlike-3.c (nonexistent) +++ trad/funlike-3.c (revision 154) @@ -0,0 +1,12 @@ +/* Test that function-like macros are restricted to directives, and + that unterminated ones are warned about. */ + +/* { dg-do preprocess } */ + +#define f(x) x + +#if 2 f(/* { dg-error "unterminated" "unterminated macro in directive" } */ +) +#endif + +f( /* { dg-error "unterminated" "unterminated macro" } */
trad/funlike-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/mi3.h =================================================================== --- trad/mi3.h (nonexistent) +++ trad/mi3.h (revision 154) @@ -0,0 +1,7 @@ +/* Another test case for over-eager multiple include optimization. */ + +#ifndef GUARD +#define GUARD +#elif 1 /* #elif kills optimisation */ +int c; +#endif
trad/mi3.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trad/funlike.c =================================================================== --- trad/funlike.c (nonexistent) +++ trad/funlike.c (revision 154) @@ -0,0 +1,25 @@ +/* Test that undefined names evaluate to zero, that macros after a + funlike macro are expanded, and that if it is a '(' the funlike + macro is not treated as such. */ + +/* { dg-do preprocess } */ + +#define f(x) x +#define h != 0 +#define i +#define paren ( + +#if f != 0 +# error /* { dg-bogus "error" "undefined name" } */ +#endif + +#if f h +# error /* { dg-bogus "error" "h not expanded" } */ +#endif + +#if f i +# error /* { dg-bogus "error" "empty macro" } */ +#endif + +#if f paren 6) /* { dg-error "missing binary" "macro-expanded parenthesis" } */ +#endif
trad/funlike.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mac-dir-1.c =================================================================== --- mac-dir-1.c (nonexistent) +++ mac-dir-1.c (revision 154) @@ -0,0 +1,34 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth, 26 Feb 2002. + + Test that we allow directives in macro arguments. */ + +/* { dg-do run } */ +/* { dg-options "" } */ + +#define f(x) x +extern void abort (void); + +int main () +{ + if (f ( +#if f(1) /* True. */ + 0)) /* False. */ +#else + 1)) +#endif + abort (); + + /* Outer f expands to original definition, f in argument expands + to new definition, so result is: if (1 != 2 - 1). */ + if (1 != f(2 +#undef f +#define f - 1 + f)) + abort (); + + return 0; +}
mac-dir-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tr-warn2.c =================================================================== --- tr-warn2.c (nonexistent) +++ tr-warn2.c (revision 154) @@ -0,0 +1,18 @@ +/* K+R rejects use of function-like macros in non-function context. + ANSI C explicitly permits this (the macro is not expanded). + + We should not warn about this during pre-expansion of arguments, + since traditional preprocessors don't do pre-expansion, and we get + the warning anyway during the re-scan pass if and only if it is + appropriate. */ + +/* { dg-do preprocess } */ +/* { dg-options -Wtraditional } */ + +#define f(x) x +#define g(x) x / 2 +#define h(a, b) a(b) +f(g) (3) /* { dg-bogus "must be used with arguments" } */ +f 2 /* { dg-warning "must be used with arguments" } */ +f(g) 3 /* { dg-warning "must be used with arguments" } */ +h(f, 3) /* { dg-bogus "must be used with arguments" } */
tr-warn2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19951025-1.c =================================================================== --- 19951025-1.c (nonexistent) +++ 19951025-1.c (revision 154) @@ -0,0 +1,4 @@ +/* { dg-do preprocess } */ +/* { dg-error "include expects" "include" { target *-*-* } 4 } */ +/* { dg-error "newline at end" "newline" { target *-*-* } 4 } */ +#include /\
19951025-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: backslash2.c =================================================================== --- backslash2.c (nonexistent) +++ backslash2.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test warnings for backslash-space-newline. + Source: Neil Booth. 6 Dec 2000. */ + +foo \ +bar +/* { dg-warning "separated by space" "" { target *-*-* } 8 } */ + +/* foo \ + bar */ +/* { dg-bogus "separated by space" "" { target *-*-* } 12 } */
backslash2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: direct2s.c =================================================================== --- direct2s.c (nonexistent) +++ direct2s.c (revision 154) @@ -0,0 +1,44 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 8 May 2001 */ + +/* Test of prohibition on directives which result from macro + expansion. Same as direct2.c, with -save-temps applied; results + should be identical. */ + +/* { dg-do compile } */ +/* { dg-options "-save-temps -ansi -pedantic-errors" } */ + +#define HASH # +#define HASHDEFINE #define +#define HASHINCLUDE #include + +HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/ +/*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 15 }*/ +int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" { target *-*-* } 15 }*/ + +HASHINCLUDE /*{ dg-error "stray|expected" "non-include 2" }*/ +/*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 18 }*/ +int resync_parser_2; + +void g1 () +{ +HASH define X 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "# from macro" } */ + int resync_parser_3; +} + +void g2 () +{ +HASHDEFINE Y 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "#define from macro" } */ + int resync_parser_4; +} + +#pragma GCC dependency "direct2.c" +# + +void f () +{ + int i = X; /* { dg-error "undeclared|for each" "no macro X" } */ + int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */ +} + +/* { dg-final { cleanup-saved-temps } } */
direct2s.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste12.c =================================================================== --- paste12.c (nonexistent) +++ paste12.c (revision 154) @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ + +/* Test correct diagnostics when pasting in #include. + Source: PR preprocessor/6780. */ + +#define inc2(a,b) <##a.b> +#define INC(X) inc2(X,h) +#include INC(stdio) /* { dg-error "pasting \"<\" and \"stdio\" does not" } */
paste12.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: maccom2.c =================================================================== --- maccom2.c (nonexistent) +++ maccom2.c (revision 154) @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that comments between the #define directive + and the macro identifier are ignored (i.e. treated like whitespace) + when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define/**/def passed + +def + +/* { dg-final { scan-file maccom2.i "(^|\n)passed" } } */
maccom2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cxxcom2.c =================================================================== --- cxxcom2.c (nonexistent) +++ cxxcom2.c (revision 154) @@ -0,0 +1,7 @@ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -std=c89 -Wall" } */ + +#include "cxxcom2.h" + +/* { dg-final { scan-file-not cxxcom2.i "is not in C89" } } */ +
cxxcom2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19940712-1b.h =================================================================== --- 19940712-1b.h (nonexistent) +++ 19940712-1b.h (revision 154) @@ -0,0 +1,2 @@ +/* spanning a .h file */ +
19940712-1b.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: charconst-4.c =================================================================== --- charconst-4.c (nonexistent) +++ charconst-4.c (revision 154) @@ -0,0 +1,52 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-Wno-multichar -fsigned-char" } */ + +/* This tests how overly-long multichar charconsts are truncated, and + whether "short" multichar charconsts are incorrectly sign extended + (regardless of char signedness). Preprocessor is used so that we + have only one place where the too long warning is generated, so + that the test works for all targets. + + Neil Booth, 8 May 2002. */ + +#include + +extern void abort (void); + +#if INT_MAX == 32767 +# define LONG_CHARCONST '!\234a' +# define SHORT_CHARCONST '\234a' +# define POS_CHARCONST '\1' +#elif INT_MAX == 2147483647 +# define LONG_CHARCONST '!\234abc' +# define SHORT_CHARCONST '\234abc' +# define POS_CHARCONST '\234a' +#elif INT_MAX == 9223372036854775807 +# define LONG_CHARCONST '!\234abcdefg' +# define SHORT_CHARCONST '\234abcdefg' +# define POS_CHARCONST '\234a' +#else +/* Target int size not handled, do something that won't fail. */ +# define LONG_CHARCONST '\234a' +# define SHORT_CHARCONST '\234a' +# define POS_CHARCONST '\1' +#endif + +#if POS_CHARCONST < 0 +# error Charconst incorrectly sign-extended +#endif + +#if LONG_CHARCONST != SHORT_CHARCONST /* { dg-warning "too long" "" } */ +# error Overly long charconst truncates wrongly for preprocessor +#endif + +int main () +{ + if (POS_CHARCONST < 0) + abort (); + if (LONG_CHARCONST != SHORT_CHARCONST) /* { dg-warning "too long" "" } */ + abort (); + return 0; +}
charconst-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cxxcom2.h =================================================================== --- cxxcom2.h (nonexistent) +++ cxxcom2.h (revision 154) @@ -0,0 +1,4 @@ +/* A system header may contain C++ comments irrespective of mode. */ +#pragma GCC system_header +// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" } +
cxxcom2.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: import2.c =================================================================== --- import2.c (nonexistent) +++ import2.c (revision 154) @@ -0,0 +1,11 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +/* This tests that the file is only included once + Neil Booth, 2 August 2003. */ + +#include "import2.h" +#import "import2.h" +#include "import2.h"
import2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi1ndp.h =================================================================== --- mi1ndp.h (nonexistent) +++ mi1ndp.h (revision 154) @@ -0,0 +1,7 @@ +#if !defined ( CPP_MINDP_H) +#define CPP_MINDP_H + +/* Redundant include check with #if !defined and parentheses. */ +int d; + +#endif
mi1ndp.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi2c.h =================================================================== --- mi2c.h (nonexistent) +++ mi2c.h (revision 154) @@ -0,0 +1,15 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey . */ +#ifdef need_x +#undef need_x +#ifndef have_x +#define have_x +extern int x; +#endif +#endif + +#ifndef t_h +#define t_h +extern int y; +#endif
mi2c.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: paste3.c =================================================================== --- paste3.c (nonexistent) +++ paste3.c (revision 154) @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +#define plus + + +void foo() +{ + int a, b = 1; + + /* The correct "a = 1 + ++b" will compile. + The incorrect "a = 1 +++b" won't. */ + a = 1 plus++b; +}
paste3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000628-1.c =================================================================== --- 20000628-1.c (nonexistent) +++ 20000628-1.c (revision 154) @@ -0,0 +1,5 @@ +/* Test if #line commands are generated properly even when header + includes self. */ +/* { dg-do compile } */ +#include "20000628-1.h" +int main(void) { return a + b + c; }
20000628-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: normalize-3.c =================================================================== --- normalize-3.c (nonexistent) +++ normalize-3.c (revision 154) @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=id" } */ + +\u00AA +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 +\uAC01 +\u1100\u1161\u11A8 +\uAC00\u11A8
normalize-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi1cc.h =================================================================== --- mi1cc.h (nonexistent) +++ mi1cc.h (revision 154) @@ -0,0 +1,10 @@ +// Redundant header include test with C comments at top. + +#ifndef CPP_MICC_H +#define CPP_MICC_H + +int b; + +#endif + +// And at the end too!
mi1cc.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: import2.h =================================================================== --- import2.h (nonexistent) +++ import2.h (revision 154) @@ -0,0 +1,4 @@ +#ifdef BUG +#error Should not happen! +#endif +#define BUG
import2.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucnid-2.c =================================================================== --- ucnid-2.c (nonexistent) +++ ucnid-2.c (revision 154) @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ +#include +#include + +#define str(t) #t + +int main (void) +{ + const char s[] = str (\u30b2); + + if (strcmp (s, "\u30b2") != 0) + abort (); + + return 0; +}
ucnid-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-paren.c =================================================================== --- if-paren.c (nonexistent) +++ if-paren.c (revision 154) @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* These now use "!=" rather than "<" to increase chance of failure. */ +#if 16 * (1) + 4 != 20 +#error /* { dg-bogus "error" "with paren" } */ +#endif + +#if 16 * 1 + 4 != 20 +#error /* { dg-bogus "error" "without paren" } */ +#endif + +#if () /* { dg-error "expression between" "empty paren" } */ +#endif + +#if (1) == 1 +#error /* { dg-error "error" "simple parens no. 1" } */ +#endif + +#if (2) +#error /* { dg-error "error" "simple parens no. 2" } */ +#endif + +#if 3 == (3) +#error /* { dg-error "error" "simple parens no. 3" } */ +#endif + +#if (((-1) + 8)) == ((+2) * ((3)) - -1) +#error /* { dg-error "error" "nested parentheses" } */ +#endif
if-paren.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: c89.c =================================================================== --- c89.c (nonexistent) +++ c89.c (revision 154) @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c89" } */ + +/* This file is for testing the preprocessor in -std=c89 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif
c89.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vararg1.c =================================================================== --- vararg1.c (nonexistent) +++ vararg1.c (revision 154) @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options -w } */ + +/* count() used to give 1 owing to a buggy test for varargs. */ +#define count(y...) count1 ( , ##y) +#define count1(y...) count2 (y,1,0) +#define count2(_,x0,n,y...) n +#if count() != 0 || count(A) != 1 +#error Incorrect vararg argument counts +#endif + +/* Test for changed behavior of the GNU varargs extension. + ##args, where args is a rest argument which received zero tokens, + used to delete the previous sequence of nonwhitespace characters. + Now it deletes the previous token. */ + +#include + +#define S(str, args...) " " str "\n", ##args + +int +main() +{ + const char *s = S("foo"); + return strchr (s, '\n') == NULL; +}
vararg1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: strify3.c =================================================================== --- strify3.c (nonexistent) +++ strify3.c (revision 154) @@ -0,0 +1,29 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do run } */ + +/* Tests we stringify without inserting a space. GCC 2.95.x and + earlier would insert a bogus space before bar in the string, simply + because a space was there in the invocation. + + Neil Booth, 24 Sep 2001. */ + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +#define str(x) #x +#define xstr(x) str(x) +#define glibc_hack(x, y) x@y + +int main (int argc, char *argv[]) +{ + /* The space before "bar" here is vital. */ + char a[] = xstr(glibc_hack(foo, bar)); + + if (strcmp (a, "foo@bar")) + err ("stringification without spaces"); + + return 0; +}
strify3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 20000628-1.h =================================================================== --- 20000628-1.h (nonexistent) +++ 20000628-1.h (revision 154) @@ -0,0 +1,8 @@ +/* Test if #line commands are generated properly even when header + includes self. */ +#include "20000628-1a.h" +#ifndef t20000628_1_h +#define t20000628_1_h 1 +#include "20000628-1.h" +#include "20000628-1a.h" +#endif
20000628-1.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi6e.h =================================================================== --- mi6e.h (nonexistent) +++ mi6e.h (revision 154) @@ -0,0 +1,5 @@ +#if !defined (guard) EMPTYR + #ifdef VAR + VAR++; + #endif +#endif
mi6e.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: arith-1.c =================================================================== --- arith-1.c (nonexistent) +++ arith-1.c (revision 154) @@ -0,0 +1,257 @@ +/* Preprocessor arithmetic semantic tests. */ + +/* Copyright (C) 2002 Free Software Foundation, Inc. */ +/* Source: Neil Booth, 25 May 2002. */ + +/* The file tests all aspects of preprocessor arithmetic that are + independent of target precision. */ + +/* { dg-do preprocess } */ +/* { dg-options -fno-show-column } */ + +/* Test || operator and its short circuiting. */ +#if 0 || 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 5 || 0 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 0 || 1 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 1 || 4 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 1 || (8 / 0) /* { dg-bogus "division by zero" } */ +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 1 || (1 << 256) /* { dg-bogus "overflow" } */ +#endif + +/* Test && operator and its short circuiting. */ +#if (0 && 0) || (0 && 1) || (1 && 0) +# error /* { dg-bogus "error" } */ +#endif + +#if 1 && 2 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 0 && (8 / 0)/* { dg-bogus "division by zero" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 0 && (1 << 256) /* { dg-bogus "overflow" } */ +#endif + +/* Test == and != operators, and their signedness. */ +#if 1 == 0 || 0 == 1 || 20 != 0x014 || 142 != 0216 +# error /* { dg-bogus "error" } */ +#endif + +#if (1 == 1) - 2 > 0 || (1U != 1U) - 2 > 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test ? : operator, its short circuiting, and its signedness. */ +#if (1 ? 3: 5) != 3 || (0 ? 3: 5) != 5 +# error /* { dg-bogus "error" } */ +#endif + +#if 1 ? 0: 1 / 0 /* { dg-bogus "division by zero" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 0 ? 1 / 0: 0 /* { dg-bogus "division by zero" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 0 ? (1 << 256): 0 /* { dg-bogus "overflow" } */ +#endif + +#if 1 ? 0: (1 << 256) /* { dg-bogus "overflow" } */ +#endif + +/* Test unary + and its signedness. */ + +#if 23 != +23 || 23 != + +23 +# error /* { dg-bogus "error" } */ +#endif + +#if (+1 - 2) > 0 || (+1U - 2) < 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test unary - and its signedness. */ + +#if -1 + 1 != 0 +# error /* { dg-bogus "error" } */ +#endif + +#if -1 >= 0 || -1U <= 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test unary ! and its signedness. */ +#if !5 != 0 || !1 != 0 || !0 != 1 +# error /* { dg-bogus "error" } */ +#endif + +#if !5 - 1 > 0 || !5U - 1 > 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test unary ~ and its signedness. */ +#if ~0 != -1 || ~~5 != 5 || ~-2 != 1 +# error /* { dg-bogus "error" } */ +#endif + +#if ~5 > 0 || ~5U < 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test comparison operators and their signedness. */ +#if 1 >= 1 && 2 >= 1 && -1 >= -1 && -1 >= -2 && 1 >= -1 && 1 >= -2 \ + && !(-2 >= -1) && !(2 >= 3) && -1U >= 2 && !(-1 >= 1) +#else +# error /* { dg-bogus "error" } */ +#endif + +#if ((1 > 0) - 2) > 0 || ((1U > 0) - 2) > 0 +# error /* { dg-bogus "error" } */ +#endif + +#if !(1 > 1) && 2 > 1 && !(-1 > -1) && -1 > -2 && 1 > -1 && 1 > -2 \ + && !(-2 > -1) && !(2 > 3) && -1U > 2 && !(-1 > 1) +#else +# error /* { dg-bogus "error" } */ +#endif + +#if ((1 >= 0) - 2) > 0 || ((1U >= 0) - 2) > 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 1 <= 1 && !(2 <= 1) && -1 <= -1 && !(-1 <= -2) && !(1 <= -1) && !(1 <= -2) \ + && -2 <= -1 && 2 <= 3 && !(-1U <= 2) && -1 <= 1 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if ((1 <= 0) - 2) > 0 || ((1U <= 0) - 2) > 0 +# error /* { dg-bogus "error" } */ +#endif + +#if !(1 < 1) && !(2 < 1) && !(-1 < -1) && !(-1 < -2) && !(1 < -1) && !(1 < -2) \ + && -2 < -1 && 2 < 3 && !(-1U < 2) && -1 < 1 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if ((1 < 0) - 2) > 0 || ((1U < 0) - 2) > 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test bitwise operators and their signedness. */ +#if (3 & 7) != 3 || (-1 & 34) != 34 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 & 7) - 20 > 0 || (3 & 7U) - 20 < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 | 5) != 7 || (-1 | 34) != -1 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 | 7) - 20 > 0 || (3 | 7U) - 20 < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if (7 ^ 5) != 2 || (-1 ^ 34) != ~34 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 ^ 7) - 20 > 0 || (3 ^ 7U) - 20 < 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test shifts and their signedness. */ +#if 3 << 2 != 12 || 3 << -2 != 0 || -1 << 1 != -2 +# error /* { dg-bogus "error" } */ +#endif + +#if 5 >> 1 != 2 || 5 >> -2 != 20 || -5 >> 1 != -3 +# error /* { dg-bogus "error" } */ +#endif + +#if (5 >> 2) - 2 >= 0 || (5U >> 2) - 2 <= 0 +# error /* { dg-bogus "error" } */ +#endif + +#if (5 << 1) - 20 >= 0 || (5U << 1) - 20 <= 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 0 +/* Test min / max and their signedness. */ +#if (3 >? 2) != 3 || (-3 >? -2) != -2 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 ? 2) - 4 >= 0 || (3 >? 2U) - 4 <= 0 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 = 0 || (3 = 0 || 3 * 2U - 7 < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 5 / 2 != 2 || -325 / 50 != -6 || 53 / -4 != -13 || -55 / -12 != 4 +# error /* { dg-bogus "error" } */ +#endif + +#if 3 / 2 - 7 >= 0 || 3 / 2U - 7 < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 5 % 2 != 1 || -325 % 50 != -25 || 53 % -4 != 1 || -55 % -12 != -7 +# error /* { dg-bogus "error" } */ +#endif + +#if 3 % 2 - 7 >= 0 || 3U % 2 - 7 < 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test , and its signedness. */ +#if (1, 2) != 2 || (2, 1) != 1 +# error /* { dg-bogus "error" } */ +#endif + +#if (1, 2) - 3 >= 0 || (1, 2U) - 3 <= 0 || (1U, 2) - 3 >= 0 +# error /* { dg-bogus "error" } */ +#endif
arith-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: extratokens.c =================================================================== --- extratokens.c (nonexistent) +++ extratokens.c (revision 154) @@ -0,0 +1,38 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fno-show-column" } */ + +/* Tests all directives that do not permit excess tokens at the end of + the line. */ + +/* Source: Neil Booth, 4 Dec 2000. The combination of separate test + cases. */ + +#ifdef foo bar /* { dg-error "extra tokens" "tokens after #ifdef" } */ +#endif + +#ifndef foo bar /* { dg-error "extra tokens" "tokens after #ifndef" } */ +#endif + +#if 1 +#if 0 +#else foo /* { dg-warning "extra tokens" "tokens after #else" } */ +#endif / /* { dg-warning "extra tokens" "tokens after #endif" } */ +#endif + +#undef foo bar /* { dg-error "extra tokens" "tokens after #undef" } */ + +#assert foo(bar) bar /* { dg-error "extra tokens" "tokens after #assert" } */ + +#unassert foo(bar) b /* { dg-error "extra tokens" "tokens after #unassert" } */ + +#include "mi1c.h" bar /* { dg-error "extra tokens" "tokens after #include" } */ + +#ident "something" bar /* { dg-error "extra tokens" "tokens after #ident" } */ + +# 36 "file.c" 3 + +/* ... but in a system header, it's acceptable. */ +#ifdef KERNEL +#endif KERNEL /* { dg-bogus "extra tokens" "bad warning" } */
extratokens.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wvariadic-2.c =================================================================== --- Wvariadic-2.c (nonexistent) +++ Wvariadic-2.c (revision 154) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic -Werror -Wno-variadic-macros" } */ + +#define f(x,...) /* { dg-bogus "variadic" } */ +#define g(x,y...) /* { dg-bogus "variadic" } */ +int not_empty;
Wvariadic-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: line1.c =================================================================== --- line1.c (nonexistent) +++ line1.c (revision 154) @@ -0,0 +1,12 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation. + + by Alexandre Oliva */ + +/* { dg-do preprocess } */ + +/* The line number below must be just a few lines greater than the + actual line number. */ +#line 10 "baz" +wibble + +/* { dg-final { scan-file line1.i baz } } */
line1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-shift.c =================================================================== --- if-shift.c (nonexistent) +++ if-shift.c (revision 154) @@ -0,0 +1,22 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test shift operators. */ + +#if 1 << 4 != 16 +#error /* { dg-bogus "error" "<< +ve shift" } */ +#endif + +#if 19 >> 2 != 4 +#error /* { dg-bogus "error" ">> +ve shift" } */ +#endif + +#if 17 << -2 != 17 >> 2 +#error /* { dg-bogus "error" "<< -ve shift" } */ +#endif + +#if 25 >> -2 != 25 << 2 +#error /* { dg-bogus "error" ">> -ve shift" } */ +#endif +
if-shift.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Wunknown-pragmas-1.c =================================================================== --- Wunknown-pragmas-1.c (nonexistent) +++ Wunknown-pragmas-1.c (revision 154) @@ -0,0 +1,29 @@ +/* Copyright 2003 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-Wunknown-pragmas" } */ + +/* Make sure we get warnings in the expected lines. */ + +#pragma unknown1 /* { dg-warning "unknown1" "unknown1" } */ + +#define COMMA , +#define FOO(x) x +#define BAR(x) _Pragma("unknown_before") x +#define BAZ(x) x _Pragma("unknown_after") + +int _Pragma("unknown2") bar1; /* { dg-warning "unknown2" "unknown2" } */ + +FOO(int _Pragma("unknown3") bar2); /* { dg-warning "unknown3" "unknown3" } */ + +int BAR(bar3); /* { dg-warning "unknown_before" "unknown_before 1" } */ + +BAR(int bar4); /* { dg-warning "unknown_before" "unknown_before 2" } */ + +int BAZ(bar5); /* { dg-warning "unknown_after" "unknown_after 1" } */ + +int BAZ(bar6;) /* { dg-warning "unknown_after" "unknown_after 2" } */ + +FOO(int bar7; _Pragma("unknown4")) /* { dg-warning "unknown4" "unknown4" } */ + +#pragma unknown5 /* { dg-warning "unknown5" "unknown5" } */
Wunknown-pragmas-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr29612-1.c =================================================================== --- pr29612-1.c (nonexistent) +++ pr29612-1.c (revision 154) @@ -0,0 +1,15 @@ +/* PR preprocessor/29612 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +# 6 "pr29612-1.c" + +int foo (void) { return 'ab'; } /* { dg-warning "multi-character" } */ + +# 1 "foo.h" 1 3 + +int bar (void) { return 'ab'; } /* No warning in system header. */ + +# 14 "pr29612-1.c" 2 + +int baz (void) { return 'ab'; } /* { dg-warning "multi-character" } */
pr29612-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: macro3.c =================================================================== --- macro3.c (nonexistent) +++ macro3.c (revision 154) @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ + +/* First two tests sourced from a bug report of Thomas Pornin. + Varargs test source Jamie Lokier. + All adapted for the testsuite by Neil Booth, Oct 2000. */ + +/* Tests various macro abuse is correctly expanded. */ +static int d = 4; +#define c(x) d +#define d(x) c(2) + +#if 0 +/* This macro chain above sucks up the whole file once it starts, so + I've commented it out. The example is left for idle amusement :-) */ +#define a(x) b( +#define b(x) a( +#endif + +#define apply(...) apply2 (__VA_ARGS__) +#define half(x) ((x) / 2) +#define apply2(f,x) f (x) + +extern void abort (void); +extern void exit (int); + +int main() +{ + /* Expands to c(2) then d. */ + if (c(c)(c) != 4) + abort (); + + if (apply (half, 200) != 100) + abort (); + + exit (0); +}
macro3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: 19990228-1.c =================================================================== --- 19990228-1.c (nonexistent) +++ 19990228-1.c (revision 154) @@ -0,0 +1,21 @@ +/* Regression test for cpp. The following input may cause core dumps + or # line markers in the middle of the line. */ +/* { dg-do preprocess } */ + +#define foo(string, arg) bar(2, string, arg) + +foo ("\ +\ +\ +\ +\ +\ +\ +\ +\ +\ +\ +", +NULL); + +/* { dg-final { scan-file-not 19990228-1.i "\[^\\n\]#" } } */
19990228-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi3.c =================================================================== --- mi3.c (nonexistent) +++ mi3.c (revision 154) @@ -0,0 +1,20 @@ +/* Another test case for over-eager multiple include optimization. + This one distilled from glibc's setlocale.c and categories.def. */ +/* { dg-do compile } */ + +#define X a +#include "mi3.def" +#undef X + +#define X b +#include "mi3.def" +#undef X + +#include "mi3.h" +#include "mi3.h" /* The second include declares variable c. */ + +int +main(void) +{ + return a + b + c; +}
mi3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: assembl2.S =================================================================== --- assembl2.S (nonexistent) +++ assembl2.S (revision 154) @@ -0,0 +1,19 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Bug report of Jonathan Larmour. Tweaked for test suite by + Neil Booth, 17 Jan 2000. */ + +/* We would not test the buffer->was_skipping variable when skipping, + meaning that some false directives confused CPP. */ + +#if 0 + # foo + # fee + # fie + # foe + # fum +#elif 0 + # bundy +#endif
assembl2.S Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ucs.c =================================================================== --- ucs.c (nonexistent) +++ ucs.c (revision 154) @@ -0,0 +1,67 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ + +/* This tests universal character sequences. + + Neil Booth, 22 May 2001. + Richard Henderson, 3 Apr 2002. */ + +#include + +#define unsigned +0 +#define int +0 +#define char +1 +#define short +2 +#define long +3 + +#if __WCHAR_TYPE__ == 0 +# define WCHAR_MAX INT_MAX +#elif __WCHAR_TYPE__ == 1 +# define WCHAR_MAX CHAR_MAX +#elif __WCHAR_TYPE__ == 2 +# define WCHAR_MAX SHRT_MAX +#elif __WCHAR_TYPE__ == 3 +# define WCHAR_MAX LONG_MAX +#else +# error wacky wchar_t +#endif + +#undef unsigned +#undef int +#undef char +#undef short +#undef long + +#if L'\u1234' != 0x1234 +#error bad short ucs /* { dg-bogus "bad" "bad u1234 evaluation" } */ +#endif + +#if WCHAR_MAX >= 0x7ffffff +# if L'\U1234abcd' != 0x1234abcd +# error bad long ucs /* { dg-bogus "bad" "bad U1234abcd evaluation" } */ +# endif +#endif + +void foo () +{ + int c; + + c = L'\ubad'; /* { dg-error "incomplete" "incomplete UCN 1" } */ + c = L"\U1234"[0]; /* { dg-error "incomplete" "incompete UCN 2" } */ + + c = L'\u000x'; /* { dg-error "incomplete" "non-hex digit in UCN" } */ + /* If sizeof(HOST_WIDE_INT) > sizeof(wchar_t), we can get a multi-character + constant warning even for wide characters. */ + /* { dg-warning "too long|multi-character" "" { target *-*-* } 54 } */ + + c = '\u0024'; /* { dg-bogus "invalid" "0024 is a valid UCN" } */ + c = "\u0040"[0]; /* { dg-bogus "invalid" "0040 is a valid UCN" } */ + c = L'\u00a0'; /* { dg-bogus "invalid" "00a0 is a valid UCN" } */ + c = '\U00000060'; /* { dg-bogus "invalid" "0060 is a valid UCN" } */ + + c = '\u0025'; /* { dg-error "not a valid" "0025 invalid UCN" } */ + c = L"\uD800"[0]; /* { dg-error "not a valid" "D800 invalid UCN" } */ + c = L'\U0000DFFF'; /* { dg-error "not a valid" "DFFF invalid UCN" } */ +}
ucs.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: if-mpar.c =================================================================== --- if-mpar.c (nonexistent) +++ if-mpar.c (revision 154) @@ -0,0 +1,24 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* Test various combinations of missing parentheses give the correct + missing parenthesis message. */ + +/* { dg-do preprocess } */ + +#if (1 /* { dg-error "missing '\\)'" "missing ')' no. 1" } */ +#endif + +#if 2 * (3 + 4 /* { dg-error "missing '\\)'" "missing ')' no. 2" } */ +#endif + +#if (2)) /* { dg-error "missing '\\('" "missing '(' no. 1" } */ +#endif + +#if ) /* { dg-error "missing '\\('" "missing '(' no. 2" } */ +#endif + +#if 4) /* { dg-error "missing '\\('" "missing '(' no. 3" } */ +#endif + +#if ( /* { dg-error "missing '\\)'" "missing ')' no. 3" } */ +#endif
if-mpar.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mi3.h =================================================================== --- mi3.h (nonexistent) +++ mi3.h (revision 154) @@ -0,0 +1,7 @@ +/* Another test case for over-eager multiple include optimization. */ + +#ifndef GUARD +#define GUARD +#elif 1 /* #elif kills optimisation */ +int c; +#endif
mi3.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.