aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-04-11 08:29:34 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-04-11 08:29:34 +0000
commit3a2b2c7a2062986f770f9860da7499850a5539cf (patch)
tree93c98a7c646d78b47d835793796c2fccda85d151
parent6d8c68df389affd52c1bee1f5d7da04b423dfc7b (diff)
downloadgcc-3a2b2c7a2062986f770f9860da7499850a5539cf.zip
gcc-3a2b2c7a2062986f770f9860da7499850a5539cf.tar.gz
gcc-3a2b2c7a2062986f770f9860da7499850a5539cf.tar.bz2
cppexp.c, [...]: Replace cpp_token with cpp_ttype everywhere.
* cppexp.c, cpphash.c, cpphash.h, cpplex.c, cpplib.c, cpplib.h, cppmain.c, fix-header.c, scan-decls.c: Replace cpp_token with cpp_ttype everywhere. * cpperror.c, cpphash.c, cpplex.c, cpplib.c, scan-decls.c: Replace cpp_buf_line_and_col with CPP_BUF_LINE and/or CPP_BUF_COL. Line and column numbers are unsigned int, not long. * cpplex.c (cpp_buf_line_and_col): Delete. * cpplib.h (struct cpp_buffer, struct cpp_reader): Change 'long lineno' to 'unsigned int lineno'. (CPP_BUF_LINE, CPP_BUF_COL): New macros. From-SVN: r33076
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/cpperror.c46
-rw-r--r--gcc/cppexp.c4
-rw-r--r--gcc/cpphash.c38
-rw-r--r--gcc/cpphash.h6
-rw-r--r--gcc/cpplex.c51
-rw-r--r--gcc/cpplib.c30
-rw-r--r--gcc/cpplib.h23
-rw-r--r--gcc/cppmain.c2
-rw-r--r--gcc/fix-header.c2
-rw-r--r--gcc/scan-decls.c7
11 files changed, 112 insertions, 111 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d3e5e33..136e63e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2000-04-11 Zack Weinberg <zack@wolery.cumb.org>
+
+ * cppexp.c, cpphash.c, cpphash.h, cpplex.c, cpplib.c,
+ cpplib.h, cppmain.c, fix-header.c, scan-decls.c: Replace
+ cpp_token with cpp_ttype everywhere.
+ * cpperror.c, cpphash.c, cpplex.c, cpplib.c, scan-decls.c:
+ Replace cpp_buf_line_and_col with CPP_BUF_LINE and/or
+ CPP_BUF_COL. Line and column numbers are unsigned int, not
+ long.
+ * cpplex.c (cpp_buf_line_and_col): Delete.
+ * cpplib.h (struct cpp_buffer, struct cpp_reader): Change
+ 'long lineno' to 'unsigned int lineno'.
+ (CPP_BUF_LINE, CPP_BUF_COL): New macros.
+
2000-04-11 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* extend.texi: ISO C99 is not a draft anymore.
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
index 0da2c57..0ba2561 100644
--- a/gcc/cpperror.c
+++ b/gcc/cpperror.c
@@ -30,9 +30,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "intl.h"
static void print_containing_files PARAMS ((cpp_reader *, cpp_buffer *));
-static void print_file_and_line PARAMS ((const char *, long, long));
+static void print_file_and_line PARAMS ((const char *, unsigned int,
+ unsigned int));
static void v_message PARAMS ((cpp_reader *, int,
- const char *, long, long,
+ const char *,
+ unsigned int, unsigned int,
const char *, va_list));
/* Print the file names and line numbers of the #include
@@ -53,13 +55,11 @@ print_containing_files (pfile, ip)
/* Find the other, outer source files. */
for (ip = CPP_PREV_BUFFER (ip); ip != NULL; ip = CPP_PREV_BUFFER (ip))
{
- long line;
- cpp_buf_line_and_col (ip, &line, NULL);
if (first)
{
first = 0;
- fprintf (stderr, _("In file included from %s:%ld"),
- ip->nominal_fname, line);
+ fprintf (stderr, _("In file included from %s:%u"),
+ ip->nominal_fname, CPP_BUF_LINE (ip));
}
else
/* Translators note: this message is used in conjunction
@@ -73,8 +73,8 @@ print_containing_files (pfile, ip)
The trailing comma is at the beginning of this message,
and the trailing colon is not translated. */
- fprintf (stderr, _(",\n from %s:%ld"),
- ip->nominal_fname, line);
+ fprintf (stderr, _(",\n from %s:%u"),
+ ip->nominal_fname, CPP_BUF_LINE (ip));
}
if (first == 0)
fputs (":\n", stderr);
@@ -86,16 +86,16 @@ print_containing_files (pfile, ip)
static void
print_file_and_line (filename, line, column)
const char *filename;
- long line, column;
+ unsigned int line, column;
{
if (filename == 0 || *filename == '\0')
filename = "<stdin>";
- if (line <= 0)
+ if (line == 0)
fputs (_("<command line>: "), stderr);
else if (column > 0)
- fprintf (stderr, "%s:%ld:%ld: ", filename, line, column);
+ fprintf (stderr, "%s:%u:%u: ", filename, line, column);
else
- fprintf (stderr, "%s:%ld: ", filename, line);
+ fprintf (stderr, "%s:%u: ", filename, line);
}
/* IS_ERROR is 3 for ICE, 2 for merely "fatal" error,
@@ -106,8 +106,8 @@ v_message (pfile, is_error, file, line, col, msg, ap)
cpp_reader *pfile;
int is_error;
const char *file;
- long line;
- long col;
+ unsigned int line;
+ unsigned int col;
const char *msg;
va_list ap;
{
@@ -117,9 +117,11 @@ v_message (pfile, is_error, file, line, col, msg, ap)
{
if (file == NULL)
file = ip->nominal_fname;
- if (line == -1)
- cpp_buf_line_and_col (ip, &line, &col);
-
+ if (line == 0)
+ {
+ line = CPP_BUF_LINE (ip);
+ col = CPP_BUF_COL (ip);
+ }
print_containing_files (pfile, ip);
print_file_and_line (file, line,
CPP_OPTION (pfile, show_column) ? col : 0);
@@ -172,7 +174,7 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
msgid = va_arg (ap, const char *);
#endif
- v_message (pfile, 3, NULL, -1, -1, msgid, ap);
+ v_message (pfile, 3, NULL, 0, 0, msgid, ap);
va_end(ap);
}
@@ -198,7 +200,7 @@ cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
msgid = va_arg (ap, const char *);
#endif
- v_message (pfile, 2, NULL, -1, -1, msgid, ap);
+ v_message (pfile, 2, NULL, 0, 0, msgid, ap);
va_end(ap);
}
@@ -221,7 +223,7 @@ cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
if (CPP_OPTION (pfile, inhibit_errors))
return;
- v_message (pfile, 1, NULL, -1, -1, msgid, ap);
+ v_message (pfile, 1, NULL, 0, 0, msgid, ap);
va_end(ap);
}
@@ -281,7 +283,7 @@ cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
if (CPP_OPTION (pfile, inhibit_warnings))
return;
- v_message (pfile, 0, NULL, -1, -1, msgid, ap);
+ v_message (pfile, 0, NULL, 0, 0, msgid, ap);
va_end(ap);
}
@@ -335,7 +337,7 @@ cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
return;
v_message (pfile, CPP_OPTION (pfile, pedantic_errors),
- NULL, -1, -1, msgid, ap);
+ NULL, 0, 0, msgid, ap);
va_end(ap);
}
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 3179099..46757c5 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -343,7 +343,7 @@ parse_defined (pfile)
{
int paren = 0, len;
U_CHAR *tok;
- enum cpp_token token;
+ enum cpp_ttype token;
struct operation op;
long old_written = CPP_WRITTEN (pfile);
@@ -413,7 +413,7 @@ lex (pfile, skip_evaluation)
int skip_evaluation;
{
const struct token *toktab;
- enum cpp_token token;
+ enum cpp_ttype token;
struct operation op;
U_CHAR *tok_start, *tok_end;
long old_written;
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index c4cf5f4..e9d20b3 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -41,7 +41,7 @@ static void push_macro_expansion PARAMS ((cpp_reader *,
U_CHAR *, int, HASHNODE *));
static int unsafe_chars PARAMS ((cpp_reader *, int, int));
static int macro_cleanup PARAMS ((cpp_buffer *, cpp_reader *));
-static enum cpp_token macarg PARAMS ((cpp_reader *, int));
+static enum cpp_ttype macarg PARAMS ((cpp_reader *, int));
static void special_symbol PARAMS ((HASHNODE *, cpp_reader *));
/* Initial hash table size. (It can grow if necessary - see hashtab.c.) */
@@ -287,7 +287,7 @@ collect_expansion (pfile, arglist)
{
DEFINITION *defn;
struct reflist *pat = 0, *endpat = 0;
- enum cpp_token token;
+ enum cpp_ttype token;
long start, here, last;
int i;
int argc;
@@ -569,7 +569,7 @@ collect_formal_parameters (pfile)
int len;
int argc = 0;
int i;
- enum cpp_token token;
+ enum cpp_ttype token;
long old_written;
old_written = CPP_WRITTEN (pfile);
@@ -718,11 +718,12 @@ _cpp_create_definition (pfile, funlike)
int funlike;
{
struct arglist *args = 0;
- long line, col;
+ unsigned int line, col;
const char *file;
DEFINITION *defn;
- cpp_buf_line_and_col (CPP_BUFFER (pfile), &line, &col);
+ line = CPP_BUF_LINE (CPP_BUFFER (pfile));
+ col = CPP_BUF_COL (CPP_BUFFER (pfile));
file = CPP_BUFFER (pfile)->nominal_fname;
if (funlike)
@@ -748,13 +749,13 @@ _cpp_create_definition (pfile, funlike)
* Return nonzero to indicate a syntax error.
*/
-static enum cpp_token
+static enum cpp_ttype
macarg (pfile, rest_args)
cpp_reader *pfile;
int rest_args;
{
int paren = 0;
- enum cpp_token token;
+ enum cpp_ttype token;
/* Try to parse as much of the argument as exists at this
input stack level. */
@@ -908,15 +909,11 @@ special_symbol (hp, pfile)
return;
case T_SPECLINE:
- {
- long line;
- cpp_buf_line_and_col (cpp_file_buffer (pfile), &line, NULL);
-
- CPP_RESERVE (pfile, 10);
- sprintf (CPP_PWRITTEN (pfile), "%ld", line);
- CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
- return;
- }
+ ip = cpp_file_buffer (pfile);
+ CPP_RESERVE (pfile, 10);
+ sprintf (CPP_PWRITTEN (pfile), "%u", CPP_BUF_LINE (pfile));
+ CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
+ return;
case T_DATE:
case T_TIME:
@@ -977,14 +974,17 @@ _cpp_macroexpand (pfile, hp)
int nargs;
DEFINITION *defn;
register U_CHAR *xbuf;
- long start_line, start_column;
+ unsigned int start_line, start_column;
+ cpp_buffer *ip;
int xbuf_len;
struct argdata *args = 0;
long old_written = CPP_WRITTEN (pfile);
int rest_args, rest_zero = 0;
register int i;
- cpp_buf_line_and_col (cpp_file_buffer (pfile), &start_line, &start_column);
+ ip = cpp_file_buffer (pfile);
+ start_line = CPP_BUF_LINE (ip);
+ start_column = CPP_BUF_COL (ip);
/* Check for and handle special symbols. */
if (hp->type != T_MACRO)
@@ -1005,7 +1005,7 @@ _cpp_macroexpand (pfile, hp)
if (nargs >= 0)
{
- enum cpp_token token;
+ enum cpp_ttype token;
args = (struct argdata *) alloca ((nargs + 1) * sizeof (struct argdata));
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index fb4d913..a23aa87 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -302,14 +302,14 @@ extern void _cpp_parse_name PARAMS ((cpp_reader *, int));
extern void _cpp_skip_rest_of_line PARAMS ((cpp_reader *));
extern void _cpp_skip_hspace PARAMS ((cpp_reader *));
extern int _cpp_parse_assertion PARAMS ((cpp_reader *));
-extern enum cpp_token _cpp_lex_token PARAMS ((cpp_reader *));
+extern enum cpp_ttype _cpp_lex_token PARAMS ((cpp_reader *));
extern long _cpp_read_and_prescan PARAMS ((cpp_reader *, cpp_buffer *,
int, size_t));
extern void _cpp_init_input_buffer PARAMS ((cpp_reader *));
extern void _cpp_grow_token_buffer PARAMS ((cpp_reader *, long));
-extern enum cpp_token _cpp_get_directive_token
+extern enum cpp_ttype _cpp_get_directive_token
PARAMS ((cpp_reader *));
-extern enum cpp_token _cpp_get_define_token
+extern enum cpp_ttype _cpp_get_define_token
PARAMS ((cpp_reader *));
/* In cpplib.c */
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index 0dd6ff7..e337592 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -124,7 +124,7 @@ cpp_scan_buffer (pfile)
cpp_reader *pfile;
{
cpp_buffer *buffer = CPP_BUFFER (pfile);
- enum cpp_token token;
+ enum cpp_ttype token;
if (CPP_OPTION (pfile, no_output))
{
long old_written = CPP_WRITTEN (pfile);
@@ -209,25 +209,6 @@ cpp_expand_to_buffer (pfile, buf, length)
CPP_NUL_TERMINATE (pfile);
}
-void
-cpp_buf_line_and_col (pbuf, linep, colp)
- register cpp_buffer *pbuf;
- long *linep, *colp;
-{
- if (pbuf)
- {
- *linep = pbuf->lineno;
- if (colp)
- *colp = pbuf->cur - pbuf->line_base;
- }
- else
- {
- *linep = 0;
- if (colp)
- *colp = 0;
- }
-}
-
/* Return the topmost cpp_buffer that corresponds to a file (not a macro). */
cpp_buffer *
@@ -248,11 +229,12 @@ static void
skip_block_comment (pfile)
cpp_reader *pfile;
{
- long line, col;
+ unsigned int line, col;
const U_CHAR *limit, *cur;
FORWARD(1);
- cpp_buf_line_and_col (CPP_BUFFER (pfile), &line, &col);
+ line = CPP_BUF_LINE (CPP_BUFFER (pfile));
+ col = CPP_BUF_COL (CPP_BUFFER (pfile));
limit = CPP_BUFFER (pfile)->rlimit;
cur = CPP_BUFFER (pfile)->cur;
@@ -531,10 +513,11 @@ skip_string (pfile, c)
cpp_reader *pfile;
int c;
{
- long start_line, start_column;
+ unsigned int start_line, start_column;
unsigned int null_count = 0;
- cpp_buf_line_and_col (cpp_file_buffer (pfile), &start_line, &start_column);
+ start_line = CPP_BUF_LINE (CPP_BUFFER (pfile));
+ start_column = CPP_BUF_COL (CPP_BUFFER (pfile));
while (1)
{
int cc = GETC();
@@ -716,12 +699,12 @@ _cpp_parse_assertion (pfile)
/* Get the next token, and add it to the text in pfile->token_buffer.
Return the kind of token we got. */
-enum cpp_token
+enum cpp_ttype
_cpp_lex_token (pfile)
cpp_reader *pfile;
{
register int c, c2, c3;
- enum cpp_token token;
+ enum cpp_ttype token;
get_next:
c = GETC();
@@ -1181,11 +1164,11 @@ maybe_macroexpand (pfile, written)
return 1;
}
-enum cpp_token
+enum cpp_ttype
cpp_get_token (pfile)
cpp_reader *pfile;
{
- enum cpp_token token;
+ enum cpp_ttype token;
long written = CPP_WRITTEN (pfile);
get_next:
@@ -1253,14 +1236,14 @@ cpp_get_token (pfile)
/* Like cpp_get_token, but skip spaces and comments. */
-enum cpp_token
+enum cpp_ttype
cpp_get_non_space_token (pfile)
cpp_reader *pfile;
{
int old_written = CPP_WRITTEN (pfile);
for (;;)
{
- enum cpp_token token = cpp_get_token (pfile);
+ enum cpp_ttype token = cpp_get_token (pfile);
if (token != CPP_COMMENT && token != CPP_HSPACE && token != CPP_VSPACE)
return token;
CPP_SET_WRITTEN (pfile, old_written);
@@ -1274,12 +1257,12 @@ cpp_get_non_space_token (pfile)
XXX This function will exist only till collect_expansion doesn't
need to see whitespace anymore, then it'll be merged with
_cpp_get_directive_token (below). */
-enum cpp_token
+enum cpp_ttype
_cpp_get_define_token (pfile)
cpp_reader *pfile;
{
long old_written;
- enum cpp_token token;
+ enum cpp_ttype token;
get_next:
old_written = CPP_WRITTEN (pfile);
@@ -1340,14 +1323,14 @@ _cpp_get_define_token (pfile)
/* Just like _cpp_get_define_token except that it discards horizontal
whitespace. */
-enum cpp_token
+enum cpp_ttype
_cpp_get_directive_token (pfile)
cpp_reader *pfile;
{
int old_written = CPP_WRITTEN (pfile);
for (;;)
{
- enum cpp_token token = _cpp_get_define_token (pfile);
+ enum cpp_ttype token = _cpp_get_define_token (pfile);
if (token != CPP_COMMENT && token != CPP_HSPACE)
return token;
CPP_SET_WRITTEN (pfile, old_written);
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index babd20e..2ad0288 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -157,7 +157,7 @@ _cpp_handle_directive (pfile)
unsigned int len;
U_CHAR *ident;
long old_written = CPP_WRITTEN (pfile);
- enum cpp_token tok;
+ enum cpp_ttype tok;
if (CPP_IS_MACRO_BUFFER (CPP_BUFFER (pfile)))
{
@@ -347,7 +347,7 @@ do_define (pfile)
int len;
int funlike = 0, empty = 0;
U_CHAR *sym;
- enum cpp_token token;
+ enum cpp_ttype token;
pfile->no_macro_expand++;
pfile->parsing_define_directive++;
@@ -467,7 +467,7 @@ _cpp_output_line_command (pfile, file_change)
cpp_reader *pfile;
enum file_change_code file_change;
{
- long line;
+ unsigned int line;
cpp_buffer *ip;
if (CPP_OPTION (pfile, no_line_commands)
@@ -475,7 +475,7 @@ _cpp_output_line_command (pfile, file_change)
return;
ip = cpp_file_buffer (pfile);
- cpp_buf_line_and_col (ip, &line, NULL);
+ line = ip->lineno;
/* If the current file has not changed, we omit the #line if it would
appear to be a no-op, and we output a few newlines instead
@@ -505,7 +505,7 @@ _cpp_output_line_command (pfile, file_change)
CPP_RESERVE (pfile, 4 * strlen (ip->nominal_fname) + 50);
CPP_PUTS_Q (pfile, "# ", 2);
- sprintf ((char *) CPP_PWRITTEN (pfile), "%ld ", line);
+ sprintf ((char *) CPP_PWRITTEN (pfile), "%u ", line);
CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
_cpp_quote_string (pfile, ip->nominal_fname);
@@ -540,7 +540,7 @@ parse_include (pfile, name)
const char *name;
{
long old_written = CPP_WRITTEN (pfile);
- enum cpp_token token;
+ enum cpp_ttype token;
int len;
pfile->parsing_include_directive++;
@@ -687,7 +687,7 @@ read_line_number (pfile, num)
{
long save_written = CPP_WRITTEN (pfile);
U_CHAR *p;
- enum cpp_token token = _cpp_get_directive_token (pfile);
+ enum cpp_ttype token = _cpp_get_directive_token (pfile);
CPP_SET_WRITTEN (pfile, save_written);
p = pfile->token_buffer + save_written;
@@ -716,7 +716,7 @@ do_line (pfile)
int new_lineno;
long old_written = CPP_WRITTEN (pfile);
enum file_change_code file_change = same_file;
- enum cpp_token token;
+ enum cpp_ttype token;
char *x;
token = _cpp_get_directive_token (pfile);
@@ -834,7 +834,7 @@ do_undef (pfile)
HASHNODE **slot;
U_CHAR *name;
long here = CPP_WRITTEN (pfile);
- enum cpp_token token;
+ enum cpp_ttype token;
pfile->no_macro_expand++;
token = _cpp_get_directive_token (pfile);
@@ -971,7 +971,7 @@ do_pragma (pfile)
long here, key;
U_CHAR *buf;
int pop;
- enum cpp_token token;
+ enum cpp_ttype token;
here = CPP_WRITTEN (pfile);
CPP_PUTS (pfile, "#pragma ", 8);
@@ -1052,7 +1052,7 @@ do_pragma_implementation (pfile)
{
/* Be quiet about `#pragma implementation' for a file only if it hasn't
been included yet. */
- enum cpp_token token;
+ enum cpp_ttype token;
long written = CPP_WRITTEN (pfile);
U_CHAR *name;
U_CHAR *copy;
@@ -1091,7 +1091,7 @@ do_pragma_poison (pfile)
HASHNODE **slot;
long written;
size_t len;
- enum cpp_token token;
+ enum cpp_ttype token;
int writeit;
unsigned long hash;
@@ -1168,7 +1168,7 @@ detect_if_not_defined (pfile)
if (pfile->only_seen_white == 2)
{
U_CHAR *ident;
- enum cpp_token token;
+ enum cpp_ttype token;
int base_offset;
int token_offset;
int need_rparen = 0;
@@ -1288,7 +1288,7 @@ parse_ifdef (pfile, name)
{
U_CHAR *ident;
unsigned int len;
- enum cpp_token token;
+ enum cpp_ttype token;
long old_written = CPP_WRITTEN (pfile);
int defined;
@@ -1496,7 +1496,7 @@ static int
skip_if_group (pfile)
cpp_reader *pfile;
{
- enum cpp_token token;
+ enum cpp_ttype token;
IF_STACK *save_if_stack = pfile->if_stack; /* don't pop past here */
long old_written;
int ret = 0;
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index c28cf3a..1465349 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -32,7 +32,7 @@ typedef struct cpp_reader cpp_reader;
typedef struct cpp_buffer cpp_buffer;
typedef struct cpp_options cpp_options;
-enum cpp_token
+enum cpp_ttype
{
CPP_EOF = -1,
CPP_OTHER = 0,
@@ -83,7 +83,6 @@ struct cpp_buffer
to record control macros. */
struct ihash *ihash;
- long lineno; /* Line number at CPP_LINE_BASE. */
parse_cleanup_t cleanup;
/* If the buffer is the expansion of a macro, this points to the
@@ -94,6 +93,9 @@ struct cpp_buffer
Used to prohibit unmatched #endif (etc) in an include file. */
struct if_stack *if_stack;
+ /* Line number at line_base (above). */
+ unsigned int lineno;
+
/* True if this is a header file included using <FILENAME>. */
char system_header_p;
char seen_eof;
@@ -322,16 +324,16 @@ struct cpp_reader
unsigned char *limit;
/* Error counter for exit code */
- int errors;
+ unsigned int errors;
/* Line where a newline was first seen in a string constant. */
- int multiline_string_line;
+ unsigned int multiline_string_line;
/* Current depth in #include directives that use <...>. */
- int system_include_depth;
+ unsigned int system_include_depth;
/* Current depth of buffer stack. */
- int buffer_stack_depth;
+ unsigned int buffer_stack_depth;
/* Hash table of macros and assertions. See cpphash.c */
struct htab *hashtab;
@@ -350,7 +352,7 @@ struct cpp_reader
struct if_stack *if_stack;
const unsigned char *potential_control_macro;
- long lineno;
+ unsigned int lineno;
/* Buffer of -M output. */
struct deps *deps;
@@ -414,20 +416,21 @@ struct cpp_reader
#define CPP_OPTION(PFILE, OPTION) ((PFILE)->opts.OPTION)
#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
+#define CPP_BUF_LINE(BUF) ((BUF)->lineno)
+#define CPP_BUF_COL(BUF) ((BUF)->cur - (BUF)->line_base)
/* Name under which this program was invoked. */
extern const char *progname;
extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
-extern enum cpp_token cpp_get_token PARAMS ((cpp_reader *));
-extern enum cpp_token cpp_get_non_space_token PARAMS ((cpp_reader *));
+extern enum cpp_ttype cpp_get_token PARAMS ((cpp_reader *));
+extern enum cpp_ttype cpp_get_non_space_token PARAMS ((cpp_reader *));
extern void cpp_reader_init PARAMS ((cpp_reader *));
extern int cpp_start_read PARAMS ((cpp_reader *, const char *));
extern void cpp_finish PARAMS ((cpp_reader *));
extern void cpp_cleanup PARAMS ((cpp_reader *PFILE));
-extern void cpp_buf_line_and_col PARAMS((cpp_buffer *, long *, long *));
extern cpp_buffer *cpp_file_buffer PARAMS((cpp_reader *));
extern void cpp_define PARAMS ((cpp_reader *, const char *));
extern void cpp_assert PARAMS ((cpp_reader *, const char *));
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
index 43d4c7b..2e85ebf 100644
--- a/gcc/cppmain.c
+++ b/gcc/cppmain.c
@@ -39,7 +39,7 @@ main (argc, argv)
char *p;
cpp_reader *pfile = &parse_in;
int argi = 1; /* Next argument to handle. */
- enum cpp_token kind;
+ enum cpp_ttype kind;
FILE *out;
const char *out_fname;
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index f6dae3a..35e7433 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -662,7 +662,7 @@ read_scan_file (in_fname, argc, argv)
/* Scan the macro expansion of "getchar();". */
for (;;)
{
- enum cpp_token token = cpp_get_token (&scan_in);
+ enum cpp_ttype token = cpp_get_token (&scan_in);
int length = CPP_WRITTEN (&scan_in) - old_written;
CPP_SET_WRITTEN (&scan_in, old_written);
if (token == CPP_EOF) /* Should not happen ... */
diff --git a/gcc/scan-decls.c b/gcc/scan-decls.c
index 0c10f94..a0b8de0 100644
--- a/gcc/scan-decls.c
+++ b/gcc/scan-decls.c
@@ -45,7 +45,7 @@ skip_to_closing_brace (pfile)
int nesting = 1;
for (;;)
{
- enum cpp_token token = cpp_get_token (pfile);
+ enum cpp_ttype token = cpp_get_token (pfile);
if (token == CPP_EOF)
break;
if (token == CPP_LBRACE)
@@ -90,7 +90,7 @@ scan_decls (pfile, argc, argv)
decl-specs, or prev_id_start marks the start of the declarator. */
int declarator_start;
int prev_id_start, prev_id_end = 0;
- enum cpp_token token;
+ enum cpp_ttype token;
new_statement:
CPP_SET_WRITTEN (pfile, 0);
@@ -135,8 +135,7 @@ scan_decls (pfile, argc, argv)
int nesting = 1;
int have_arg_list = 0;
cpp_buffer *fbuf = cpp_file_buffer (pfile);
- long func_lineno;
- cpp_buf_line_and_col (fbuf, &func_lineno, NULL);
+ unsigned int func_lineno = CPP_BUF_LINE (fbuf);
for (;;)
{
token = cpp_get_token (pfile);