diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-07-25 21:02:10 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-07-25 21:02:10 +0000 |
commit | bc013f005fb9d4315225ccdd1f5d80c93ffb250b (patch) | |
tree | ada350f089f1e4c6136bd4c8d2b3cba9658a0a1b /gcc/cpplib.c | |
parent | f47e40847d4c6dcbecf637540f0f47aaebb75982 (diff) | |
download | gcc-bc013f005fb9d4315225ccdd1f5d80c93ffb250b.zip gcc-bc013f005fb9d4315225ccdd1f5d80c93ffb250b.tar.gz gcc-bc013f005fb9d4315225ccdd1f5d80c93ffb250b.tar.bz2 |
cpplib.c (_cpp_check_directive): Issue -Wtraditional warnings for indented directives even if we are skipping.
* cpplib.c (_cpp_check_directive): Issue -Wtraditional
warnings for indented directives even if we are skipping.
From-SVN: r35256
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index f39ff0e..7d7bbc2 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -154,28 +154,33 @@ _cpp_check_directive (pfile, token, bol) for (i = 0; i < N_DIRECTIVES; i++) if (pfile->spec_nodes->dirs[i] == token->val.node) { + /* In -traditional mode, a directive is ignored unless its # + is in column 1. In code intended to work with K+R compilers, + therefore, directives added by C89 must have their # indented, + and directives present in traditional C must not. This is true + even of directives in skipped conditional blocks. */ + if (CPP_WTRADITIONAL (pfile)) + { + if (!bol && dtable[i].origin == KANDR) + cpp_warning (pfile, + "traditional C ignores #%s with the # indented", + dtable[i].name); + + if (bol && dtable[i].origin != KANDR) + cpp_warning (pfile, + "suggest hiding #%s from traditional C with an indented #", + dtable[i].name); + } + /* If we are skipping a failed conditional group, all non-conditional directives are ignored. */ if (pfile->skipping && !(dtable[i].flags & COND)) return 0; - /* In -traditional mode, a directive is ignored unless its # - is in column 1. */ - if (!bol && dtable[i].origin == KANDR && CPP_WTRADITIONAL (pfile)) - cpp_warning (pfile, "traditional C ignores #%s with the # indented", - dtable[i].name); - /* Issue -pedantic warnings for extended directives. */ if (CPP_PEDANTIC (pfile) && dtable[i].origin == EXTENSION) cpp_pedwarn (pfile, "ISO C does not allow #%s", dtable[i].name); - /* -Wtraditional gives warnings about directives with inappropriate - indentation of #. */ - if (bol && dtable[i].origin != KANDR && CPP_WTRADITIONAL (pfile)) - cpp_warning (pfile, - "suggest hiding #%s from traditional C with an indented #", - dtable[i].name); - return &dtable[i]; } |