aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Booth <neilb@earthling.net>2000-09-28 05:55:22 +0000
committerNeil Booth <neil@gcc.gnu.org>2000-09-28 05:55:22 +0000
commitd8090680186229102bf95754d5117c9f3fb139fa (patch)
treee397904d152d2097125d59904f15ea71e0957eb9
parente93eff9433088e058245212256b3f03f34562817 (diff)
downloadgcc-d8090680186229102bf95754d5117c9f3fb139fa.zip
gcc-d8090680186229102bf95754d5117c9f3fb139fa.tar.gz
gcc-d8090680186229102bf95754d5117c9f3fb139fa.tar.bz2
cpperror.c (_cpp_begin_message): Do the test for suppression of warnings and pedantic warnings before the "is a...
* cpperror.c (_cpp_begin_message): Do the test for suppression of warnings and pedantic warnings before the "is a warning an error" tests. * cppinit.c (cpp_handle_option): Remove surplus \n. * cpplex.c (ON_REST_ARG): Delete. (skip_block_comment): Initialise prevc. (parse_args): Improve error messages. (maybe_paste_with_next): Use CONTEXT_VARARGS rather than ON_REST_ARG. * cpplib.c (cpp_push_buffer): Fix grammar in message. * cppmain.c (main): Set callbacks for #ident and #pragma only if no_output option is false. (do_pragma_implementation): Only call the #pragma handler if it is set in the cpp_reader structure. From-SVN: r36655
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/cpperror.c14
-rw-r--r--gcc/cppinit.c2
-rw-r--r--gcc/cpplex.c17
-rw-r--r--gcc/cpplib.c2
-rw-r--r--gcc/cppmain.c21
6 files changed, 48 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 67a022e..e1e9439 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2000-09-28 Neil Booth <neilb@earthling.net>
+
+ * cpperror.c (_cpp_begin_message): Do the test for suppression
+ of warnings and pedantic warnings before the "is a warning an
+ error" tests.
+ * cppinit.c (cpp_handle_option): Remove surplus \n.
+ * cpplex.c (ON_REST_ARG): Delete.
+ (skip_block_comment): Initialise prevc.
+ (parse_args): Improve error messages.
+ (maybe_paste_with_next): Use CONTEXT_VARARGS rather
+ than ON_REST_ARG.
+ * cpplib.c (cpp_push_buffer): Fix grammar in message.
+ * cppmain.c (main): Set callbacks for #ident and #pragma
+ only if no_output option is false.
+ (do_pragma_implementation): Only call the #pragma handler
+ if it is set in the cpp_reader structure.
+
Wed Sep 27 14:00:07 2000 Donald Lindsay <dlindsay@cygnus.com>
* integrate.c (copy_insn_list): if an ignored return value
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
index 0d6dbfb..fa44708 100644
--- a/gcc/cpperror.c
+++ b/gcc/cpperror.c
@@ -120,11 +120,12 @@ _cpp_begin_message (pfile, code, file, line, col)
switch (code)
{
case WARNING:
+ if (CPP_IN_SYSTEM_HEADER (pfile)
+ && ! CPP_OPTION (pfile, warn_system_headers))
+ return 0;
if (! CPP_OPTION (pfile, warnings_are_errors))
{
- if (CPP_OPTION (pfile, inhibit_warnings)
- || (CPP_IN_SYSTEM_HEADER (pfile)
- && ! CPP_OPTION (pfile, warn_system_headers)))
+ if (CPP_OPTION (pfile, inhibit_warnings))
return 0;
is_warning = 1;
}
@@ -138,11 +139,12 @@ _cpp_begin_message (pfile, code, file, line, col)
break;
case PEDWARN:
+ if (CPP_IN_SYSTEM_HEADER (pfile)
+ && ! CPP_OPTION (pfile, warn_system_headers))
+ return 0;
if (! CPP_OPTION (pfile, pedantic_errors))
{
- if (CPP_OPTION (pfile, inhibit_warnings)
- || (CPP_IN_SYSTEM_HEADER (pfile)
- && ! CPP_OPTION (pfile, warn_system_headers)))
+ if (CPP_OPTION (pfile, inhibit_warnings))
return 0;
is_warning = 1;
}
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index d8ec597..3fbf77e 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -1403,7 +1403,7 @@ cpp_handle_option (pfile, argc, argv)
CPP_OPTION (pfile, out_fname) = "";
break;
case OPT_v:
- fprintf (stderr, _("GNU CPP version %s (cpplib)\n"), version_string);
+ fprintf (stderr, _("GNU CPP version %s (cpplib)"), version_string);
#ifdef TARGET_VERSION
TARGET_VERSION;
#endif
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index 4b2f84b..426e82d 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -162,10 +162,6 @@ TOKEN_LEN (token)
#define IS_ARG_CONTEXT(c) ((c)->flags & CONTEXT_ARG)
#define CURRENT_CONTEXT(pfile) ((pfile)->contexts + (pfile)->cur_context)
-#define ON_REST_ARG(c) \
- (((c)->u.list->flags & VAR_ARGS) \
- && (c)->u.list->tokens[(c)->posn - 1].val.aux \
- == (unsigned int) ((c)->u.list->paramc - 1))
#define ASSIGN_FLAGS_AND_POS(d, s) \
do {(d)->flags = (s)->flags & (PREV_WHITE | BOL | PASTE_LEFT); \
@@ -573,7 +569,7 @@ skip_block_comment (pfile)
cpp_reader *pfile;
{
cpp_buffer *buffer = pfile->buffer;
- cppchar_t c = EOF, prevc;
+ cppchar_t c = EOF, prevc = EOF;
pfile->state.lexing_comment = 1;
while (buffer->cur != buffer->rlimit)
@@ -1837,6 +1833,7 @@ is_macro_disabled (pfile, expansion, token)
pfile->no_expand_level = context - pfile->contexts;
next = _cpp_get_token (pfile);
restore_macro_expansion (pfile, prev_nme);
+
if (next->type != CPP_OPEN_PAREN)
{
_cpp_push_token (pfile, next);
@@ -2001,7 +1998,8 @@ parse_args (pfile, hp, args)
}
else
{
- cpp_error (pfile, "not enough arguments for macro \"%s\"", hp->name);
+ cpp_error (pfile, "%u arguments is not enough for macro \"%s\"",
+ argc, hp->name);
return 1;
}
}
@@ -2009,7 +2007,8 @@ parse_args (pfile, hp, args)
else if (argc > macro->paramc
&& !(macro->paramc == 0 && argc == 1 && empty_argument (args, 0)))
{
- cpp_error (pfile, "too many arguments for macro \"%s\"", hp->name);
+ cpp_error (pfile, "%u arguments is too many for macro \"%s\"",
+ argc, hp->name);
return 1;
}
@@ -2331,8 +2330,8 @@ maybe_paste_with_next (pfile, token)
<whatever> came from a variable argument, because
the author probably intended the ## to trigger
the special extended semantics (see above). */
- if (token->type == CPP_COMMA && IS_ARG_CONTEXT (context)
- && ON_REST_ARG (context - 1))
+ if (token->type == CPP_COMMA
+ && (context->flags & CONTEXT_VARARGS))
/* no warning */;
else
cpp_warning (pfile,
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 0616e8a..37dbe02 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -1495,7 +1495,7 @@ cpp_push_buffer (pfile, buffer, length)
cpp_buffer *new;
if (++pfile->buffer_stack_depth == CPP_STACK_MAX)
{
- cpp_fatal (pfile, "#include nested too deep");
+ cpp_fatal (pfile, "#include nested too deeply");
return NULL;
}
if (pfile->cur_context > 0)
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
index 3e570be..5c88e95 100644
--- a/gcc/cppmain.c
+++ b/gcc/cppmain.c
@@ -88,15 +88,21 @@ main (argc, argv)
return (FATAL_EXIT_CODE);
/* Set callbacks. */
- if (! CPP_OPTION (pfile, no_line_commands)
- && ! CPP_OPTION (pfile, no_output))
+ if (! CPP_OPTION (pfile, no_output))
{
- pfile->cb.enter_file = cb_enter_file;
- pfile->cb.leave_file = cb_leave_file;
- pfile->cb.rename_file = cb_rename_file;
+ pfile->cb.ident = cb_ident;
+ pfile->cb.def_pragma = cb_def_pragma;
+ if (! CPP_OPTION (pfile, no_line_commands))
+ {
+ pfile->cb.enter_file = cb_enter_file;
+ pfile->cb.leave_file = cb_leave_file;
+ pfile->cb.rename_file = cb_rename_file;
+ }
}
+
if (CPP_OPTION (pfile, dump_includes))
pfile->cb.include = cb_include;
+
if (CPP_OPTION (pfile, debug_output)
|| CPP_OPTION (pfile, dump_macros) == dump_names
|| CPP_OPTION (pfile, dump_macros) == dump_definitions)
@@ -105,8 +111,6 @@ main (argc, argv)
pfile->cb.undef = cb_undef;
pfile->cb.poison = cb_def_pragma;
}
- pfile->cb.ident = cb_ident;
- pfile->cb.def_pragma = cb_def_pragma;
/* Register one #pragma which needs special handling. */
cpp_register_pragma(pfile, 0, "implementation", do_pragma_implementation);
@@ -271,7 +275,8 @@ do_pragma_implementation (pfile)
}
/* forward to default-pragma handler. */
- cb_def_pragma (pfile);
+ if (pfile->cb.def_pragma)
+ (*pfile->cb.def_pragma) (pfile);
}
/* Dump out the hash table. */