diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-04-01 22:55:25 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-04-01 22:55:25 +0000 |
commit | 07aa0b04f2ef60131900c2ea350d0d78e028acad (patch) | |
tree | a3327cb688c6ff2c7d9052ffeb7c1c2b56f14d18 /gcc/testsuite | |
parent | 9f47f030f5a96a83863009b0f7f4e313695bb156 (diff) | |
download | gcc-07aa0b04f2ef60131900c2ea350d0d78e028acad.zip gcc-07aa0b04f2ef60131900c2ea350d0d78e028acad.tar.gz gcc-07aa0b04f2ef60131900c2ea350d0d78e028acad.tar.bz2 |
cpplib.c: Include symcat.h.
* cpplib.c: Include symcat.h. Add 'origin' field to struct
directive. Add origin values to DIRECTIVE_TABLE. Generate
the strings and function names on the fly. Take the #sccs
entry out of the table if SCCS_DIRECTIVE is not defined.
(_cpp_handle_directive): Decide if the # was at the beginning
of the line here. Issue -pedantic warnings for extended
directives here. Warn about K+R directives with the #
indented, and C89/extended directives with the # not indented,
here.
(do_import, do_include_next, do_warning, do_ident, do_sccs,
do_assert, do_unassert): Don't issue pedantic warning here.
* cpphash.h: Add CPP_WTRADITIONAL macro.
* cpplib.h (struct cpp_options): Rename warn_stringify to
warn_traditional; update comments.
* cppinit.c (handle_option): Set warn_traditional not
warn_stringify.
* cpphash.c: Replace CPP_OPTION (pfile, warn_stringify) with
CPP_WTRADITIONAL (pfile).
* cpplex.c (_cpp_lex_token): Don't decide if directives should
be ignored in -traditional mode here.
* cpplex.c: Copy ISTABLE macros from cppinit.c, and adapt them
to initialize speccase[] and trigraph_map[]. Delete all
references to pfile->input_speccase. Always treat '?' as a
special character. Remove table-initialization code from
_cpp_init_input_buffer.
* cpplib.h (struct cpp_reader): Remove input_speccase field.
* cppinit.c (cpp_cleanup): Don't free input_speccase.
From-SVN: r32860
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp-tradwarn1.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp-tradwarn1.c b/gcc/testsuite/gcc.dg/cpp-tradwarn1.c new file mode 100644 index 0000000..8395c80 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp-tradwarn1.c @@ -0,0 +1,30 @@ +/* Test for warnings about nontraditional directives. */ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -Wtraditional" } */ + +/* Block 1: K+R directives should have the # at the left margin. */ + +#define foo bar /* { dg-bogus "left margin" "^#kandr" } */ +# define foo bar /* { dg-bogus "left margin" "^# kandr" } */ + #define foo bar /* { dg-warning "left margin" "^ #kandr" } */ + # define foo bar /* { dg-warning "left margin" "^ # kandr" } */ + +/* Block 2: C89 directives should not have the # at the left margin. */ + +#pragma whatever /* { dg-warning "left margin" "^#c89" } */ +# pragma whatever /* { dg-warning "left margin" "^# c89" } */ + #pragma whatever /* { dg-bogus "left margin" "^ #c89" } */ + # pragma whatever /* { dg-bogus "left margin" "^ # c89" } */ + +/* Block 3: Extensions should not have the # at the left margin, + _and_ they should get a -pedantic warning. */ + +#assert foo(bar) /* { dg-warning "left margin" "^#ext" } */ +# assert bar(baz) /* { dg-warning "left margin" "^# ext" } */ + #assert baz(quux) /* { dg-bogus "left margin" "^ #ext" } */ + # assert quux(weeble) /* { dg-bogus "left margin" "^ # ext" } */ + +/* { dg-warning "ISO C does not" "extension warning" { target native } 22 } */ +/* { dg-warning "ISO C does not" "extension warning" { target native } 23 } */ +/* { dg-warning "ISO C does not" "extension warning" { target native } 24 } */ +/* { dg-warning "ISO C does not" "extension warning" { target native } 25 } */ |