aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Booth <NeilB@earthling.net>2000-09-24 10:42:09 +0000
committerNeil Booth <NeilB@earthling.net>2000-09-24 10:42:09 +0000
commit87bb67684cdb3fc7afd915ba07463259d67485ea (patch)
treecc48c49fb97eab0d2417c46c7dfcc7a7a9fb8e95
parent23787cb6b6b5cab9dc0f62eab7f6c85590c0cd99 (diff)
* cpplex.c: Update TODO comment.
* cpplib.c (do_error, do_warning): Merge common code of do_error and do_warning into do_diagnostic. Use it. (do_diagnostic): New function. * cpplib.h: Fix comment typo. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@36587 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cpplex.c3
-rw-r--r--gcc/cpplib.c29
-rw-r--r--gcc/cpplib.h2
4 files changed, 22 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 55bdbc6cfde..c6ecd38ca78 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+Sun 24-Sep-2000 11:40:23 BST Neil Booth <NeilB@earthling.net>
+
+ * cpplex.c: Update TODO comment.
+ * cpplib.c (do_error, do_warning): Merge common code of
+ do_error and do_warning into do_diagnostic. Use it.
+ (do_diagnostic): New function.
+ * cpplib.h: Fix comment typo.
+
2000-09-24 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (check_format_info): Warn for a wide character string
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index a7a6f99098c..720574bfcd0 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -24,12 +24,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Cleanups to do:-
-o Check line numbers assigned to all errors.
o Distinguish integers, floats, and 'other' pp-numbers.
o Store ints and char constants as binary values.
o New command-line assertion syntax.
-o Work towards functions in cpperror.c taking a message level parameter.
- If we do this, merge the common code of do_warning and do_error.
o Comment all functions, and describe macro expansion algorithm.
o Move as much out of header files as possible.
o Remove single quote pairs `', and some '', from diagnostics.
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 8c61ab0c222..d6fcf9bfb2d 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -52,7 +52,7 @@ static void push_conditional PARAMS ((cpp_reader *, int, int,
static int read_line_number PARAMS ((cpp_reader *, int *));
static int strtoul_for_line PARAMS ((const U_CHAR *, unsigned int,
unsigned long *));
-
+static void do_diagnostic PARAMS ((cpp_reader *, enum error_type));
static const cpp_hashnode *
parse_ifdef PARAMS ((cpp_reader *, const U_CHAR *));
static const cpp_hashnode *
@@ -583,16 +583,16 @@ do_line (pfile)
}
/*
- * Report an error detected by the program we are processing.
- * Use the text of the line in the error message.
- * (We use error because it prints the filename & line#.)
+ * Report a warning or error detected by the program we are
+ * processing. Use the directive's tokens in the error message.
*/
static void
-do_error (pfile)
+do_diagnostic (pfile, code)
cpp_reader *pfile;
+ enum error_type code;
{
- if (_cpp_begin_message (pfile, ERROR, NULL, 0, 0))
+ if (_cpp_begin_message (pfile, code, NULL, 0, 0))
{
cpp_output_list (pfile, stderr, &pfile->token_list,
pfile->first_directive_token);
@@ -600,21 +600,18 @@ do_error (pfile)
}
}
-/*
- * Report a warning detected by the program we are processing.
- * Use the text of the line in the warning message, then continue.
- */
+static void
+do_error (pfile)
+ cpp_reader *pfile;
+{
+ do_diagnostic (pfile, ERROR);
+}
static void
do_warning (pfile)
cpp_reader *pfile;
{
- if (_cpp_begin_message (pfile, WARNING, NULL, 0, 0))
- {
- cpp_output_list (pfile, stderr, &pfile->token_list,
- pfile->first_directive_token);
- putc ('\n', stderr);
- }
+ do_diagnostic (pfile, WARNING);
}
/* Report program identification. */
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 15c30abc67d..c6f7ed34e85 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -457,7 +457,7 @@ struct lexer_state
all directives apart from #define. */
unsigned char save_comments;
- /* Nonzero to get force the lexer to skip newlines. */
+ /* Nonzero to force the lexer to skip newlines. */
unsigned char skip_newlines;
/* Nonzero if we're in the subroutine lex_line. */