Commit b0699dad by Zack Weinberg Committed by Zack Weinberg

cppfiles.c (_cpp_find_include_file): Make sure ih->name is initialized.

	* cppfiles.c (_cpp_find_include_file): Make sure ih->name is
	initialized.
	* cppinit.c (cpp_cleanup): Free imp->nshort also.

	* cpperror.c (cpp_print_containing_files,
	cpp_print_file_and_line, v_cpp_message): Rename to
	print_containing_files, print_file_and_line, and v_message.
	* cppexp.c (cpp_parse_expr, cpp_parse_escape, cpp_lex): Rename
	to _cpp_parse_expr, parse_escape, and lex.
	(parse_charconst): Remove broken multibyte support.
	* cppfiles.c (include_hash): Make static.
	(cpp_included): New function.
	(merge_include_chains, find_include_file, finclude,
	simplify_pathname): Rename to _cpp_merge_include_chains,
	_cpp_find_include_file, _cpp_read_include_file, and
	_cpp_simplify_pathname.
	* cpphash.c (cpp_lookup, free_definition, delete_macro,
	cpp_install, create_definition, macroexpand, compare_defs,
	dump_definition): Rename to _cpp_lookup, _cpp_free_definition,
	_cpp_delete_macro, _cpp_install, _cpp_create_definition,
	_cpp_macroexpand, _cpp_compare_defs, and _cpp_dump_definition.
	* cppinit.c (cpp_handle_option): Rename to handle_option, make
	static.
	* cpplib.c: Remove extern prototype of cpp_parse_expr.

	* cpphash.h: Update prototypes.
	* cpplib.h: Likewise.  Prototype _cpp_parse_expr here.

From-SVN: r32390
parent 79e69af0
2000-03-07 Zack Weinberg <zack@wolery.cumb.org>
* cppfiles.c (_cpp_find_include_file): Make sure ih->name is
initialized.
* cppinit.c (cpp_cleanup): Free imp->nshort also.
* cpperror.c (cpp_print_containing_files,
cpp_print_file_and_line, v_cpp_message): Rename to
print_containing_files, print_file_and_line, and v_message.
* cppexp.c (cpp_parse_expr, cpp_parse_escape, cpp_lex): Rename
to _cpp_parse_expr, parse_escape, and lex.
(parse_charconst): Remove broken multibyte support.
* cppfiles.c (include_hash): Make static.
(cpp_included): New function.
(merge_include_chains, find_include_file, finclude,
simplify_pathname): Rename to _cpp_merge_include_chains,
_cpp_find_include_file, _cpp_read_include_file, and
_cpp_simplify_pathname.
* cpphash.c (cpp_lookup, free_definition, delete_macro,
cpp_install, create_definition, macroexpand, compare_defs,
dump_definition): Rename to _cpp_lookup, _cpp_free_definition,
_cpp_delete_macro, _cpp_install, _cpp_create_definition,
_cpp_macroexpand, _cpp_compare_defs, and _cpp_dump_definition.
* cppinit.c (cpp_handle_option): Rename to handle_option, make
static.
* cpplib.c: Remove extern prototype of cpp_parse_expr.
* cpphash.h: Update prototypes.
* cpplib.h: Likewise. Prototype _cpp_parse_expr here.
2000-03-07 Andrew Haley <aph@cygnus.com> 2000-03-07 Andrew Haley <aph@cygnus.com>
* config/mips/mips.h (PTRDIFF_TYPE): Revert broken change; * config/mips/mips.h (PTRDIFF_TYPE): Revert broken change;
......
...@@ -28,9 +28,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -28,9 +28,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cpplib.h" #include "cpplib.h"
#include "intl.h" #include "intl.h"
static void cpp_print_containing_files PARAMS ((cpp_reader *, cpp_buffer *)); static void print_containing_files PARAMS ((cpp_reader *, cpp_buffer *));
static void cpp_print_file_and_line PARAMS ((const char *, long, long)); static void print_file_and_line PARAMS ((const char *, long, long));
static void v_cpp_message PARAMS ((cpp_reader *, int, static void v_message PARAMS ((cpp_reader *, int,
const char *, long, long, const char *, long, long,
const char *, va_list)); const char *, va_list));
...@@ -38,7 +38,7 @@ static void v_cpp_message PARAMS ((cpp_reader *, int, ...@@ -38,7 +38,7 @@ static void v_cpp_message PARAMS ((cpp_reader *, int,
commands which led to the current file. */ commands which led to the current file. */
static void static void
cpp_print_containing_files (pfile, ip) print_containing_files (pfile, ip)
cpp_reader *pfile; cpp_reader *pfile;
cpp_buffer *ip; cpp_buffer *ip;
{ {
...@@ -86,7 +86,7 @@ cpp_print_containing_files (pfile, ip) ...@@ -86,7 +86,7 @@ cpp_print_containing_files (pfile, ip)
} }
static void static void
cpp_print_file_and_line (filename, line, column) print_file_and_line (filename, line, column)
const char *filename; const char *filename;
long line, column; long line, column;
{ {
...@@ -104,7 +104,7 @@ cpp_print_file_and_line (filename, line, column) ...@@ -104,7 +104,7 @@ cpp_print_file_and_line (filename, line, column)
1 for error, 0 for warning. */ 1 for error, 0 for warning. */
static void static void
v_cpp_message (pfile, is_error, file, line, col, msg, ap) v_message (pfile, is_error, file, line, col, msg, ap)
cpp_reader *pfile; cpp_reader *pfile;
int is_error; int is_error;
const char *file; const char *file;
...@@ -122,8 +122,8 @@ v_cpp_message (pfile, is_error, file, line, col, msg, ap) ...@@ -122,8 +122,8 @@ v_cpp_message (pfile, is_error, file, line, col, msg, ap)
if (line == -1) if (line == -1)
cpp_buf_line_and_col (ip, &line, &col); cpp_buf_line_and_col (ip, &line, &col);
cpp_print_containing_files (pfile, ip); print_containing_files (pfile, ip);
cpp_print_file_and_line (file, line, col); print_file_and_line (file, line, col);
} }
else else
fprintf (stderr, "%s: ", progname); fprintf (stderr, "%s: ", progname);
...@@ -145,7 +145,7 @@ v_cpp_message (pfile, is_error, file, line, col, msg, ap) ...@@ -145,7 +145,7 @@ v_cpp_message (pfile, is_error, file, line, col, msg, ap)
pfile->errors = CPP_FATAL_LIMIT; pfile->errors = CPP_FATAL_LIMIT;
break; break;
default: default:
cpp_ice (pfile, "bad is_error(%d) in v_cpp_message", is_error); cpp_ice (pfile, "bad is_error(%d) in v_message", is_error);
} }
vfprintf (stderr, _(msg), ap); vfprintf (stderr, _(msg), ap);
...@@ -173,7 +173,7 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...)) ...@@ -173,7 +173,7 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
msgid = va_arg (ap, const char *); msgid = va_arg (ap, const char *);
#endif #endif
v_cpp_message (pfile, 3, NULL, -1, -1, msgid, ap); v_message (pfile, 3, NULL, -1, -1, msgid, ap);
va_end(ap); va_end(ap);
} }
...@@ -199,7 +199,7 @@ cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...)) ...@@ -199,7 +199,7 @@ cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
msgid = va_arg (ap, const char *); msgid = va_arg (ap, const char *);
#endif #endif
v_cpp_message (pfile, 2, NULL, -1, -1, msgid, ap); v_message (pfile, 2, NULL, -1, -1, msgid, ap);
va_end(ap); va_end(ap);
} }
...@@ -222,7 +222,7 @@ cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) ...@@ -222,7 +222,7 @@ cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
if (CPP_OPTIONS (pfile)->inhibit_errors) if (CPP_OPTIONS (pfile)->inhibit_errors)
return; return;
v_cpp_message (pfile, 1, NULL, -1, -1, msgid, ap); v_message (pfile, 1, NULL, -1, -1, msgid, ap);
va_end(ap); va_end(ap);
} }
...@@ -250,7 +250,7 @@ cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column, ...@@ -250,7 +250,7 @@ cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
if (CPP_OPTIONS (pfile)->inhibit_errors) if (CPP_OPTIONS (pfile)->inhibit_errors)
return; return;
v_cpp_message (pfile, 1, NULL, line, column, msgid, ap); v_message (pfile, 1, NULL, line, column, msgid, ap);
va_end(ap); va_end(ap);
} }
...@@ -282,7 +282,7 @@ cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) ...@@ -282,7 +282,7 @@ cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
if (CPP_OPTIONS (pfile)->inhibit_warnings) if (CPP_OPTIONS (pfile)->inhibit_warnings)
return; return;
v_cpp_message (pfile, 0, NULL, -1, -1, msgid, ap); v_message (pfile, 0, NULL, -1, -1, msgid, ap);
va_end(ap); va_end(ap);
} }
...@@ -310,7 +310,7 @@ cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column, ...@@ -310,7 +310,7 @@ cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
if (CPP_OPTIONS (pfile)->inhibit_warnings) if (CPP_OPTIONS (pfile)->inhibit_warnings)
return; return;
v_cpp_message (pfile, 0, NULL, line, column, msgid, ap); v_message (pfile, 0, NULL, line, column, msgid, ap);
va_end(ap); va_end(ap);
} }
...@@ -335,7 +335,7 @@ cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) ...@@ -335,7 +335,7 @@ cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
: CPP_OPTIONS (pfile)->inhibit_warnings) : CPP_OPTIONS (pfile)->inhibit_warnings)
return; return;
v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors, v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
NULL, -1, -1, msgid, ap); NULL, -1, -1, msgid, ap);
va_end(ap); va_end(ap);
} }
...@@ -366,7 +366,7 @@ cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column, ...@@ -366,7 +366,7 @@ cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
: CPP_OPTIONS (pfile)->inhibit_warnings) : CPP_OPTIONS (pfile)->inhibit_warnings)
return; return;
v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors, v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
NULL, line, column, msgid, ap); NULL, line, column, msgid, ap);
va_end(ap); va_end(ap);
} }
...@@ -403,7 +403,7 @@ cpp_pedwarn_with_file_and_line VPARAMS ((cpp_reader *pfile, ...@@ -403,7 +403,7 @@ cpp_pedwarn_with_file_and_line VPARAMS ((cpp_reader *pfile,
: CPP_OPTIONS (pfile)->inhibit_warnings) : CPP_OPTIONS (pfile)->inhibit_warnings)
return; return;
v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors, v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
file, line, col, msgid, ap); file, line, col, msgid, ap);
va_end(ap); va_end(ap);
} }
......
/* Parse C expressions for CCCP. /* Parse C expressions for cpplib.
Copyright (C) 1987, 92, 94, 95, 97, 98, 1999, 2000 Free Software Foundation. Copyright (C) 1987, 92, 94, 95, 97, 98, 1999, 2000 Free Software Foundation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
...@@ -65,11 +65,11 @@ Written by Per Bothner 1994. */ ...@@ -65,11 +65,11 @@ Written by Per Bothner 1994. */
#endif #endif
#define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \ #define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \
? (~ (~ (HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \ ? (~(~(HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
: ~ (HOST_WIDEST_INT) 0) : ~ (HOST_WIDEST_INT) 0)
#define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \ #define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \
? ~ (~ (HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \ ? ~(~(HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
: ~ (HOST_WIDEST_INT) 0) : ~ (HOST_WIDEST_INT) 0)
/* Yield nonzero if adding two numbers with A's and B's signs can yield a /* Yield nonzero if adding two numbers with A's and B's signs can yield a
...@@ -77,14 +77,19 @@ Written by Per Bothner 1994. */ ...@@ -77,14 +77,19 @@ Written by Per Bothner 1994. */
#define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0) #define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
static void integer_overflow PARAMS ((cpp_reader *)); static void integer_overflow PARAMS ((cpp_reader *));
static HOST_WIDEST_INT left_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT, int, unsigned HOST_WIDEST_INT)); static HOST_WIDEST_INT left_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT,
static HOST_WIDEST_INT right_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT, int, unsigned HOST_WIDEST_INT)); int, unsigned HOST_WIDEST_INT));
static struct operation parse_number PARAMS ((cpp_reader *, U_CHAR *, U_CHAR *)); static HOST_WIDEST_INT right_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT,
static struct operation parse_charconst PARAMS ((cpp_reader *, U_CHAR *, U_CHAR *)); int, unsigned HOST_WIDEST_INT));
static struct operation parse_number PARAMS ((cpp_reader *, U_CHAR *,
U_CHAR *));
static struct operation parse_charconst PARAMS ((cpp_reader *, U_CHAR *,
U_CHAR *));
static struct operation parse_defined PARAMS ((cpp_reader *)); static struct operation parse_defined PARAMS ((cpp_reader *));
static struct operation cpp_lex PARAMS ((cpp_reader *, int)); static HOST_WIDEST_INT parse_escape PARAMS ((cpp_reader *, U_CHAR **,
extern HOST_WIDEST_INT cpp_parse_expr PARAMS ((cpp_reader *)); HOST_WIDEST_INT));
static HOST_WIDEST_INT cpp_parse_escape PARAMS ((cpp_reader *, U_CHAR **, HOST_WIDEST_INT)); static struct operation lex PARAMS ((cpp_reader *, int));
#define ERROR 299 #define ERROR 299
#define OROR 300 #define OROR 300
...@@ -107,12 +112,13 @@ static HOST_WIDEST_INT cpp_parse_escape PARAMS ((cpp_reader *, U_CHAR **, HOST_W ...@@ -107,12 +112,13 @@ static HOST_WIDEST_INT cpp_parse_escape PARAMS ((cpp_reader *, U_CHAR **, HOST_W
#define SKIP_OPERAND 8 #define SKIP_OPERAND 8
/*#define UNSIGNEDP 16*/ /*#define UNSIGNEDP 16*/
struct operation { struct operation
short op; {
char rprio; /* Priority of op (relative to it right operand). */ short op;
char flags; char rprio; /* Priority of op (relative to it right operand). */
char unsignedp; /* true if value should be treated as unsigned */ char flags;
HOST_WIDEST_INT value; /* The value logically "right" of op. */ char unsignedp; /* true if value should be treated as unsigned */
HOST_WIDEST_INT value; /* The value logically "right" of op. */
}; };
/* Parse and convert an integer for #if. Accepts decimal, hex, or octal /* Parse and convert an integer for #if. Accepts decimal, hex, or octal
...@@ -258,13 +264,7 @@ parse_charconst (pfile, start, end) ...@@ -258,13 +264,7 @@ parse_charconst (pfile, start, end)
int max_chars; int max_chars;
U_CHAR *ptr = start; U_CHAR *ptr = start;
/* FIXME: Should use reentrant multibyte functions. */
#ifdef MULTIBYTE_CHARS
wchar_t c = (wchar_t)-1;
(void) mbtowc (NULL_PTR, NULL_PTR, 0);
#else
int c = -1; int c = -1;
#endif
if (*ptr == 'L') if (*ptr == 'L')
{ {
...@@ -277,22 +277,12 @@ parse_charconst (pfile, start, end) ...@@ -277,22 +277,12 @@ parse_charconst (pfile, start, end)
while (ptr < end) while (ptr < end)
{ {
#ifndef MULTIBYTE_CHARS
c = *ptr++; c = *ptr++;
#else
ptr += mbtowc (&c, ptr, end - ptr);
#endif
if (c == '\'' || c == '\0') if (c == '\'' || c == '\0')
break; break;
else if (c == '\\') else if (c == '\\')
{ {
/* Hopefully valid assumption: if mbtowc returns a backslash, c = parse_escape (pfile, &ptr, mask);
we are in initial shift state. No valid escape-sequence
character can take us out of initial shift state or begin
an unshifted multibyte char, so cpp_parse_escape doesn't
need to know about multibyte chars. */
c = cpp_parse_escape (pfile, &ptr, mask);
if (width < HOST_BITS_PER_INT if (width < HOST_BITS_PER_INT
&& (unsigned int) c >= (unsigned int)(1 << width)) && (unsigned int) c >= (unsigned int)(1 << width))
cpp_pedwarn (pfile, "escape sequence out of range for character"); cpp_pedwarn (pfile, "escape sequence out of range for character");
...@@ -420,7 +410,7 @@ static const struct token tokentab2[] = { ...@@ -420,7 +410,7 @@ static const struct token tokentab2[] = {
/* Read one token. */ /* Read one token. */
static struct operation static struct operation
cpp_lex (pfile, skip_evaluation) lex (pfile, skip_evaluation)
cpp_reader *pfile; cpp_reader *pfile;
int skip_evaluation; int skip_evaluation;
{ {
...@@ -510,7 +500,7 @@ cpp_lex (pfile, skip_evaluation) ...@@ -510,7 +500,7 @@ cpp_lex (pfile, skip_evaluation)
after the zeros. A value of 0 does not mean end of string. */ after the zeros. A value of 0 does not mean end of string. */
static HOST_WIDEST_INT static HOST_WIDEST_INT
cpp_parse_escape (pfile, string_ptr, result_mask) parse_escape (pfile, string_ptr, result_mask)
cpp_reader *pfile; cpp_reader *pfile;
U_CHAR **string_ptr; U_CHAR **string_ptr;
HOST_WIDEST_INT result_mask; HOST_WIDEST_INT result_mask;
...@@ -681,7 +671,7 @@ right_shift (pfile, a, unsignedp, b) ...@@ -681,7 +671,7 @@ right_shift (pfile, a, unsignedp, b)
Returns the value of the expression. */ Returns the value of the expression. */
HOST_WIDEST_INT HOST_WIDEST_INT
cpp_parse_expr (pfile) _cpp_parse_expr (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
/* The implementation is an operator precedence parser, /* The implementation is an operator precedence parser,
...@@ -710,7 +700,7 @@ cpp_parse_expr (pfile) ...@@ -710,7 +700,7 @@ cpp_parse_expr (pfile)
char flags = 0; char flags = 0;
/* Read a token */ /* Read a token */
op = cpp_lex (pfile, skip_evaluation); op = lex (pfile, skip_evaluation);
/* See if the token is an operand, in which case go to set_value. /* See if the token is an operand, in which case go to set_value.
If the token is an operator, figure out its left and right If the token is an operator, figure out its left and right
...@@ -719,7 +709,7 @@ cpp_parse_expr (pfile) ...@@ -719,7 +709,7 @@ cpp_parse_expr (pfile)
switch (op.op) switch (op.op)
{ {
case NAME: case NAME:
cpp_ice (pfile, "cpp_lex returns a NAME"); cpp_ice (pfile, "lex returns a NAME");
goto syntax_error; goto syntax_error;
case INT: case CHAR: case INT: case CHAR:
goto set_value; goto set_value;
...@@ -1027,7 +1017,7 @@ cpp_parse_expr (pfile) ...@@ -1027,7 +1017,7 @@ cpp_parse_expr (pfile)
else else
{ {
new_stack = (struct operation *) xmalloc (new_size); new_stack = (struct operation *) xmalloc (new_size);
bcopy ((char *) stack, (char *) new_stack, old_size); memcpy (new_stack, stack, old_size);
} }
stack = new_stack; stack = new_stack;
top = (struct operation *) ((char *) new_stack + old_size); top = (struct operation *) ((char *) new_stack + old_size);
......
...@@ -29,11 +29,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -29,11 +29,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cpplib.h" #include "cpplib.h"
#include "intl.h" #include "intl.h"
/* The entry points to this file are: find_include_file, static struct include_hash *include_hash PARAMS ((cpp_reader *,
cpp_read_file, finclude, include_hash, append_include_chain, and const char *, int));
file_cleanup. file_cleanup is only called through
CPP_BUFFER(pfile)->cleanup, so it's static anyway. */
static struct include_hash *redundant_include_p static struct include_hash *redundant_include_p
PARAMS ((cpp_reader *, PARAMS ((cpp_reader *,
struct include_hash *, struct include_hash *,
...@@ -83,7 +80,7 @@ static void hack_vms_include_specification PARAMS ((char *)); ...@@ -83,7 +80,7 @@ static void hack_vms_include_specification PARAMS ((char *));
how?) and possibly preload the include hash. */ how?) and possibly preload the include hash. */
void void
merge_include_chains (opts) _cpp_merge_include_chains (opts)
struct cpp_options *opts; struct cpp_options *opts;
{ {
struct file_name_list *prev, *cur, *other; struct file_name_list *prev, *cur, *other;
...@@ -208,7 +205,7 @@ merge_include_chains (opts) ...@@ -208,7 +205,7 @@ merge_include_chains (opts)
#include name (there are at least three ways this can happen). The #include name (there are at least three ways this can happen). The
hash function could probably be improved a bit. */ hash function could probably be improved a bit. */
struct include_hash * static struct include_hash *
include_hash (pfile, fname, add) include_hash (pfile, fname, add)
cpp_reader *pfile; cpp_reader *pfile;
const char *fname; const char *fname;
...@@ -293,6 +290,19 @@ redundant_include_p (pfile, ihash, ilist) ...@@ -293,6 +290,19 @@ redundant_include_p (pfile, ihash, ilist)
return 0; return 0;
} }
/* Return 1 if the file named by FNAME has been included before in
any context, 0 otherwise. */
int
cpp_included (pfile, fname)
cpp_reader *pfile;
const char *fname;
{
struct include_hash *ptr;
ptr = include_hash (pfile, fname, 0);
return (ptr != NULL);
}
static int static int
file_cleanup (pbuf, pfile) file_cleanup (pbuf, pfile)
cpp_buffer *pbuf; cpp_buffer *pbuf;
...@@ -316,7 +326,7 @@ file_cleanup (pbuf, pfile) ...@@ -316,7 +326,7 @@ file_cleanup (pbuf, pfile)
*BEFORE is 1 if the file was included before (but needs to be read *BEFORE is 1 if the file was included before (but needs to be read
again). */ again). */
int int
find_include_file (pfile, fname, search_start, ihash, before) _cpp_find_include_file (pfile, fname, search_start, ihash, before)
cpp_reader *pfile; cpp_reader *pfile;
const char *fname; const char *fname;
struct file_name_list *search_start; struct file_name_list *search_start;
...@@ -362,6 +372,7 @@ find_include_file (pfile, fname, search_start, ihash, before) ...@@ -362,6 +372,7 @@ find_include_file (pfile, fname, search_start, ihash, before)
} }
*before = 0; *before = 0;
*ihash = ih; *ihash = ih;
ih->name = NULL;
ih->nshort = xstrdup (fname); ih->nshort = xstrdup (fname);
ih->control_macro = NULL; ih->control_macro = NULL;
...@@ -383,7 +394,7 @@ find_include_file (pfile, fname, search_start, ihash, before) ...@@ -383,7 +394,7 @@ find_include_file (pfile, fname, search_start, ihash, before)
bcopy (l->name, name, l->nlen); bcopy (l->name, name, l->nlen);
name[l->nlen] = '/'; name[l->nlen] = '/';
strcpy (&name[l->nlen+1], fname); strcpy (&name[l->nlen+1], fname);
simplify_pathname (name); _cpp_simplify_pathname (name);
if (CPP_OPTIONS (pfile)->remap) if (CPP_OPTIONS (pfile)->remap)
name = remap_filename (pfile, name, l); name = remap_filename (pfile, name, l);
...@@ -626,10 +637,11 @@ cpp_read_file (pfile, fname) ...@@ -626,10 +637,11 @@ cpp_read_file (pfile, fname)
} }
/* Open the file in nonblocking mode, so we don't get stuck if /* Open the file in nonblocking mode, so we don't get stuck if
someone clever has asked cpp to process /dev/rmt0. finclude() someone clever has asked cpp to process /dev/rmt0.
will check that we have a real file to work with. Also take _cpp_read_include_file will check that we have a real file to
care not to acquire a controlling terminal by mistake (this can't work with. Also take care not to acquire a controlling terminal
happen on sane systems, but paranoia is a virtue). */ by mistake (this can't happen on sane systems, but paranoia is a
virtue). */
else if ((f = open (fname, O_RDONLY|O_NONBLOCK|O_NOCTTY, 0666)) < 0) else if ((f = open (fname, O_RDONLY|O_NONBLOCK|O_NOCTTY, 0666)) < 0)
{ {
cpp_notice_from_errno (pfile, fname); cpp_notice_from_errno (pfile, fname);
...@@ -651,7 +663,7 @@ cpp_read_file (pfile, fname) ...@@ -651,7 +663,7 @@ cpp_read_file (pfile, fname)
ih_fake->control_macro = 0; ih_fake->control_macro = 0;
ih_fake->buf = (char *)-1; ih_fake->buf = (char *)-1;
ih_fake->limit = 0; ih_fake->limit = 0;
if (!finclude (pfile, f, ih_fake)) if (!_cpp_read_include_file (pfile, f, ih_fake))
goto failed_finclude; goto failed_finclude;
return 1; return 1;
...@@ -672,7 +684,7 @@ cpp_read_file (pfile, fname) ...@@ -672,7 +684,7 @@ cpp_read_file (pfile, fname)
The caller is responsible for the cpp_push_buffer. */ The caller is responsible for the cpp_push_buffer. */
int int
finclude (pfile, fd, ihash) _cpp_read_include_file (pfile, fd, ihash)
cpp_reader *pfile; cpp_reader *pfile;
int fd; int fd;
struct include_hash *ihash; struct include_hash *ihash;
...@@ -1245,7 +1257,7 @@ initialize_input_buffer (pfile, fd, st) ...@@ -1245,7 +1257,7 @@ initialize_input_buffer (pfile, fd, st)
of the string. of the string.
*/ */
void void
simplify_pathname (path) _cpp_simplify_pathname (path)
char *path; char *path;
{ {
char *from, *to; char *from, *to;
......
...@@ -116,7 +116,7 @@ hashf (s, len) ...@@ -116,7 +116,7 @@ hashf (s, len)
Otherwise, compute the length by scanning the entire name. */ Otherwise, compute the length by scanning the entire name. */
HASHNODE * HASHNODE *
cpp_lookup (pfile, name, len) _cpp_lookup (pfile, name, len)
cpp_reader *pfile; cpp_reader *pfile;
const U_CHAR *name; const U_CHAR *name;
int len; int len;
...@@ -147,7 +147,7 @@ cpp_lookup (pfile, name, len) ...@@ -147,7 +147,7 @@ cpp_lookup (pfile, name, len)
do_define when redefining macros. */ do_define when redefining macros. */
void void
free_definition (d) _cpp_free_definition (d)
DEFINITION *d; DEFINITION *d;
{ {
struct reflist *ap, *nextap; struct reflist *ap, *nextap;
...@@ -169,7 +169,7 @@ free_definition (d) ...@@ -169,7 +169,7 @@ free_definition (d)
*/ */
void void
delete_macro (hp) _cpp_delete_macro (hp)
HASHNODE *hp; HASHNODE *hp;
{ {
if (hp->prev != NULL) if (hp->prev != NULL)
...@@ -183,7 +183,7 @@ delete_macro (hp) ...@@ -183,7 +183,7 @@ delete_macro (hp)
*hp->bucket_hdr = hp->next; *hp->bucket_hdr = hp->next;
if (hp->type == T_MACRO) if (hp->type == T_MACRO)
free_definition (hp->value.defn); _cpp_free_definition (hp->value.defn);
free (hp); free (hp);
} }
...@@ -202,7 +202,7 @@ delete_macro (hp) ...@@ -202,7 +202,7 @@ delete_macro (hp)
Otherwise, compute the hash code. */ Otherwise, compute the hash code. */
HASHNODE * HASHNODE *
cpp_install (pfile, name, len, type, value) _cpp_install (pfile, name, len, type, value)
cpp_reader *pfile; cpp_reader *pfile;
const U_CHAR *name; const U_CHAR *name;
int len; int len;
...@@ -698,7 +698,7 @@ collect_formal_parameters (pfile) ...@@ -698,7 +698,7 @@ collect_formal_parameters (pfile)
macro. */ macro. */
DEFINITION * DEFINITION *
create_definition (pfile, funlike) _cpp_create_definition (pfile, funlike)
cpp_reader *pfile; cpp_reader *pfile;
int funlike; int funlike;
{ {
...@@ -959,7 +959,7 @@ special_symbol (hp, pfile) ...@@ -959,7 +959,7 @@ special_symbol (hp, pfile)
an argument list follows; arguments come from the input stack. */ an argument list follows; arguments come from the input stack. */
void void
macroexpand (pfile, hp) _cpp_macroexpand (pfile, hp)
cpp_reader *pfile; cpp_reader *pfile;
HASHNODE *hp; HASHNODE *hp;
{ {
...@@ -1484,7 +1484,7 @@ push_macro_expansion (pfile, xbuf, xbuf_len, hp) ...@@ -1484,7 +1484,7 @@ push_macro_expansion (pfile, xbuf, xbuf_len, hp)
/* Return zero if two DEFINITIONs are isomorphic. */ /* Return zero if two DEFINITIONs are isomorphic. */
int int
compare_defs (pfile, d1, d2) _cpp_compare_defs (pfile, d1, d2)
cpp_reader *pfile; cpp_reader *pfile;
DEFINITION *d1, *d2; DEFINITION *d1, *d2;
{ {
...@@ -1576,7 +1576,7 @@ comp_def_part (first, beg1, len1, beg2, len2, last) ...@@ -1576,7 +1576,7 @@ comp_def_part (first, beg1, len1, beg2, len2, last)
to be read back in again. */ to be read back in again. */
void void
dump_definition (pfile, sym, len, defn) _cpp_dump_definition (pfile, sym, len, defn)
cpp_reader *pfile; cpp_reader *pfile;
const U_CHAR *sym; const U_CHAR *sym;
long len; long len;
......
...@@ -92,17 +92,18 @@ struct hashnode { ...@@ -92,17 +92,18 @@ struct hashnode {
union hashval value; /* pointer to expansion, or whatever */ union hashval value; /* pointer to expansion, or whatever */
}; };
extern HASHNODE *cpp_install PARAMS ((cpp_reader *, const U_CHAR *, int, extern HASHNODE *_cpp_install PARAMS ((cpp_reader *, const U_CHAR *, int,
enum node_type, const char *)); enum node_type, const char *));
extern HASHNODE *cpp_lookup PARAMS ((cpp_reader *, const U_CHAR *, int)); extern HASHNODE *_cpp_lookup PARAMS ((cpp_reader *, const U_CHAR *, int));
extern void free_definition PARAMS ((DEFINITION *)); extern void _cpp_free_definition PARAMS ((DEFINITION *));
extern void delete_macro PARAMS ((HASHNODE *)); extern void _cpp_delete_macro PARAMS ((HASHNODE *));
extern DEFINITION *create_definition PARAMS ((cpp_reader *, int)); extern DEFINITION *_cpp_create_definition
extern int compare_defs PARAMS ((cpp_reader *, DEFINITION *, PARAMS ((cpp_reader *, int));
extern int _cpp_compare_defs PARAMS ((cpp_reader *, DEFINITION *,
DEFINITION *)); DEFINITION *));
extern void macroexpand PARAMS ((cpp_reader *, HASHNODE *)); extern void _cpp_macroexpand PARAMS ((cpp_reader *, HASHNODE *));
extern void dump_definition PARAMS ((cpp_reader *, const U_CHAR *, long, extern void _cpp_dump_definition PARAMS ((cpp_reader *, const U_CHAR *, long,
DEFINITION *)); DEFINITION *));
#endif #endif
...@@ -183,6 +183,7 @@ static void initialize_dependency_output PARAMS ((cpp_reader *)); ...@@ -183,6 +183,7 @@ static void initialize_dependency_output PARAMS ((cpp_reader *));
static void initialize_standard_includes PARAMS ((cpp_reader *)); static void initialize_standard_includes PARAMS ((cpp_reader *));
static void new_pending_define PARAMS ((struct cpp_options *, static void new_pending_define PARAMS ((struct cpp_options *,
const char *)); const char *));
static int handle_option PARAMS ((cpp_reader *, int, char **));
/* Fourth argument to append_include_chain: chain to use */ /* Fourth argument to append_include_chain: chain to use */
enum { QUOTE = 0, BRACKET, SYSTEM, AFTER }; enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
...@@ -293,7 +294,7 @@ append_include_chain (pfile, pend, dir, path, cxx_aware) ...@@ -293,7 +294,7 @@ append_include_chain (pfile, pend, dir, path, cxx_aware)
struct stat st; struct stat st;
unsigned int len; unsigned int len;
simplify_pathname (dir); _cpp_simplify_pathname (dir);
if (stat (dir, &st)) if (stat (dir, &st))
{ {
/* Dirs that don't exist are silently ignored. */ /* Dirs that don't exist are silently ignored. */
...@@ -428,6 +429,7 @@ cpp_cleanup (pfile) ...@@ -428,6 +429,7 @@ cpp_cleanup (pfile)
struct include_hash *next = imp->next; struct include_hash *next = imp->next;
free ((PTR) imp->name); free ((PTR) imp->name);
free ((PTR) imp->nshort);
free (imp); free (imp);
imp = next; imp = next;
} }
...@@ -437,7 +439,7 @@ cpp_cleanup (pfile) ...@@ -437,7 +439,7 @@ cpp_cleanup (pfile)
for (i = HASHSIZE; --i >= 0;) for (i = HASHSIZE; --i >= 0;)
{ {
while (pfile->hashtab[i]) while (pfile->hashtab[i])
delete_macro (pfile->hashtab[i]); _cpp_delete_macro (pfile->hashtab[i]);
} }
free (pfile->hashtab); free (pfile->hashtab);
} }
...@@ -507,7 +509,7 @@ initialize_builtins (pfile) ...@@ -507,7 +509,7 @@ initialize_builtins (pfile)
val = (b->flags & ULP) ? user_label_prefix : b->value; val = (b->flags & ULP) ? user_label_prefix : b->value;
len = strlen (b->name); len = strlen (b->name);
cpp_install (pfile, b->name, len, b->type, val); _cpp_install (pfile, b->name, len, b->type, val);
if ((b->flags & DUMP) && CPP_OPTIONS (pfile)->debug_output) if ((b->flags & DUMP) && CPP_OPTIONS (pfile)->debug_output)
dump_special_to_buffer (pfile, b->name); dump_special_to_buffer (pfile, b->name);
} }
...@@ -719,7 +721,7 @@ cpp_start_read (pfile, fname) ...@@ -719,7 +721,7 @@ cpp_start_read (pfile, fname)
if (! opts->no_standard_includes) if (! opts->no_standard_includes)
initialize_standard_includes (pfile); initialize_standard_includes (pfile);
merge_include_chains (opts); _cpp_merge_include_chains (opts);
/* With -v, print the list of dirs to search. */ /* With -v, print the list of dirs to search. */
if (opts->verbose) if (opts->verbose)
...@@ -876,7 +878,8 @@ cpp_finish (pfile) ...@@ -876,7 +878,8 @@ cpp_finish (pfile)
for (h = pfile->hashtab[i]; h; h = h->next) for (h = pfile->hashtab[i]; h; h = h->next)
if (h->type == T_MACRO) if (h->type == T_MACRO)
{ {
dump_definition (pfile, h->name, h->length, h->value.defn); _cpp_dump_definition (pfile, h->name, h->length,
h->value.defn);
CPP_PUTC (pfile, '\n'); CPP_PUTC (pfile, '\n');
} }
} }
...@@ -901,8 +904,8 @@ new_pending_define (opts, text) ...@@ -901,8 +904,8 @@ new_pending_define (opts, text)
Can be called multiple times, to handle multiple sets of options. Can be called multiple times, to handle multiple sets of options.
Returns number of strings consumed. */ Returns number of strings consumed. */
int static int
cpp_handle_option (pfile, argc, argv) handle_option (pfile, argc, argv)
cpp_reader *pfile; cpp_reader *pfile;
int argc; int argc;
char **argv; char **argv;
...@@ -1493,7 +1496,7 @@ cpp_handle_options (pfile, argc, argv) ...@@ -1493,7 +1496,7 @@ cpp_handle_options (pfile, argc, argv)
int strings_processed; int strings_processed;
for (i = 0; i < argc; i += strings_processed) for (i = 0; i < argc; i += strings_processed)
{ {
strings_processed = cpp_handle_option (pfile, argc - i, argv + i); strings_processed = handle_option (pfile, argc - i, argv + i);
if (strings_processed == 0) if (strings_processed == 0)
break; break;
} }
......
...@@ -41,10 +41,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ...@@ -41,10 +41,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
case CPP_BUMP_LINE must not be called. */ case CPP_BUMP_LINE must not be called. */
#define ACTIVE_MARK_P() (CPP_BUFFER (pfile)->mark != -1) #define ACTIVE_MARK_P() (CPP_BUFFER (pfile)->mark != -1)
/* External declarations. */
extern HOST_WIDEST_INT cpp_parse_expr PARAMS ((cpp_reader *));
/* `struct directive' defines one #-directive, including how to handle it. */ /* `struct directive' defines one #-directive, including how to handle it. */
struct directive struct directive
...@@ -259,7 +255,7 @@ cpp_defined (pfile, id, len) ...@@ -259,7 +255,7 @@ cpp_defined (pfile, id, len)
const U_CHAR *id; const U_CHAR *id;
int len; int len;
{ {
HASHNODE *hp = cpp_lookup (pfile, id, len); HASHNODE *hp = _cpp_lookup (pfile, id, len);
if (hp && hp->type == T_POISON) if (hp && hp->type == T_POISON)
{ {
cpp_error (pfile, "attempt to use poisoned `%s'", hp->name); cpp_error (pfile, "attempt to use poisoned `%s'", hp->name);
...@@ -686,17 +682,17 @@ do_define (pfile, keyword) ...@@ -686,17 +682,17 @@ do_define (pfile, keyword)
as an object-like macro if this happens, with a warning. */ as an object-like macro if this happens, with a warning. */
cpp_pedwarn (pfile, "missing white space after `#define %.*s'", len, sym); cpp_pedwarn (pfile, "missing white space after `#define %.*s'", len, sym);
def = create_definition (pfile, funlike); def = _cpp_create_definition (pfile, funlike);
if (def == 0) if (def == 0)
return 0; return 0;
if ((hp = cpp_lookup (pfile, sym, len)) != NULL) if ((hp = _cpp_lookup (pfile, sym, len)) != NULL)
{ {
int ok; int ok;
/* Redefining a macro is ok if the definitions are the same. */ /* Redefining a macro is ok if the definitions are the same. */
if (hp->type == T_MACRO) if (hp->type == T_MACRO)
ok = ! compare_defs (pfile, def, hp->value.defn); ok = ! _cpp_compare_defs (pfile, def, hp->value.defn);
/* Redefining a constant is ok with -D. */ /* Redefining a constant is ok with -D. */
else if (hp->type == T_CONST || hp->type == T_STDC) else if (hp->type == T_CONST || hp->type == T_STDC)
ok = ! CPP_OPTIONS (pfile)->done_initializing; ok = ! CPP_OPTIONS (pfile)->done_initializing;
...@@ -721,17 +717,17 @@ do_define (pfile, keyword) ...@@ -721,17 +717,17 @@ do_define (pfile, keyword)
{ {
/* Replace the old definition. */ /* Replace the old definition. */
if (hp->type == T_MACRO) if (hp->type == T_MACRO)
free_definition (hp->value.defn); _cpp_free_definition (hp->value.defn);
hp->type = T_MACRO; hp->type = T_MACRO;
hp->value.defn = def; hp->value.defn = def;
} }
} }
else else
cpp_install (pfile, sym, len, T_MACRO, (char *) def); _cpp_install (pfile, sym, len, T_MACRO, (char *) def);
if (CPP_OPTIONS (pfile)->debug_output if (CPP_OPTIONS (pfile)->debug_output
|| CPP_OPTIONS (pfile)->dump_macros == dump_definitions) || CPP_OPTIONS (pfile)->dump_macros == dump_definitions)
dump_definition (pfile, sym, len, def); _cpp_dump_definition (pfile, sym, len, def);
else if (CPP_OPTIONS (pfile)->dump_macros == dump_names) else if (CPP_OPTIONS (pfile)->dump_macros == dump_names)
pass_thru_directive (sym, len, pfile, keyword); pass_thru_directive (sym, len, pfile, keyword);
...@@ -1201,7 +1197,7 @@ do_include (pfile, keyword) ...@@ -1201,7 +1197,7 @@ do_include (pfile, keyword)
return 0; return 0;
} }
fd = find_include_file (pfile, ftok, search_start, &ihash, &before); fd = _cpp_find_include_file (pfile, ftok, search_start, &ihash, &before);
if (fd == -2) if (fd == -2)
return 0; return 0;
...@@ -1280,7 +1276,7 @@ do_include (pfile, keyword) ...@@ -1280,7 +1276,7 @@ do_include (pfile, keyword)
if (angle_brackets) if (angle_brackets)
pfile->system_include_depth++; /* Decremented in file_cleanup. */ pfile->system_include_depth++; /* Decremented in file_cleanup. */
if (finclude (pfile, fd, ihash)) if (_cpp_read_include_file (pfile, fd, ihash))
{ {
output_line_command (pfile, enter_file); output_line_command (pfile, enter_file);
pfile->only_seen_white = 2; pfile->only_seen_white = 2;
...@@ -1479,7 +1475,7 @@ do_undef (pfile, keyword) ...@@ -1479,7 +1475,7 @@ do_undef (pfile, keyword)
} }
CPP_SET_WRITTEN (pfile, here); CPP_SET_WRITTEN (pfile, here);
while ((hp = cpp_lookup (pfile, name, len)) != NULL) while ((hp = _cpp_lookup (pfile, name, len)) != NULL)
{ {
/* If we are generating additional info for debugging (with -g) we /* If we are generating additional info for debugging (with -g) we
need to pass through all effective #undef commands. */ need to pass through all effective #undef commands. */
...@@ -1491,7 +1487,7 @@ do_undef (pfile, keyword) ...@@ -1491,7 +1487,7 @@ do_undef (pfile, keyword)
{ {
if (hp->type != T_MACRO) if (hp->type != T_MACRO)
cpp_warning (pfile, "undefining `%s'", hp->name); cpp_warning (pfile, "undefining `%s'", hp->name);
delete_macro (hp); _cpp_delete_macro (hp);
} }
} }
...@@ -1705,7 +1701,6 @@ do_pragma_implementation (pfile) ...@@ -1705,7 +1701,6 @@ do_pragma_implementation (pfile)
{ {
/* Be quiet about `#pragma implementation' for a file only if it hasn't /* Be quiet about `#pragma implementation' for a file only if it hasn't
been included yet. */ been included yet. */
struct include_hash *ptr;
enum cpp_token token; enum cpp_token token;
long written = CPP_WRITTEN (pfile); long written = CPP_WRITTEN (pfile);
U_CHAR *name; U_CHAR *name;
...@@ -1723,9 +1718,8 @@ do_pragma_implementation (pfile) ...@@ -1723,9 +1718,8 @@ do_pragma_implementation (pfile)
name = pfile->token_buffer + written + 1; name = pfile->token_buffer + written + 1;
copy = xstrdup (name); copy = xstrdup (name);
copy[strlen(copy)] = '\0'; /* trim trailing quote */ copy[strlen(copy)] = '\0'; /* trim trailing quote */
ptr = include_hash (pfile, copy, 0); if (cpp_included (pfile, copy))
if (ptr)
cpp_warning (pfile, cpp_warning (pfile,
"`#pragma implementation' for `%s' appears after file is included", "`#pragma implementation' for `%s' appears after file is included",
copy); copy);
...@@ -1766,18 +1760,19 @@ do_pragma_poison (pfile) ...@@ -1766,18 +1760,19 @@ do_pragma_poison (pfile)
p = pfile->token_buffer + written; p = pfile->token_buffer + written;
len = strlen (p); len = strlen (p);
if ((hp = cpp_lookup (pfile, p, len))) if ((hp = _cpp_lookup (pfile, p, len)))
{ {
if (hp->type != T_POISON) if (hp->type != T_POISON)
{ {
cpp_warning (pfile, "poisoning existing macro `%s'", p); cpp_warning (pfile, "poisoning existing macro `%s'", p);
free_definition (hp->value.defn); if (hp->type == T_MACRO)
_cpp_free_definition (hp->value.defn);
hp->value.defn = 0; hp->value.defn = 0;
hp->type = T_POISON; hp->type = T_POISON;
} }
} }
else else
cpp_install (pfile, p, len, T_POISON, 0); _cpp_install (pfile, p, len, T_POISON, 0);
if (writeit) if (writeit)
CPP_PUTC (pfile, ' '); CPP_PUTC (pfile, ' ');
} }
...@@ -1952,7 +1947,7 @@ eval_if_expression (pfile) ...@@ -1952,7 +1947,7 @@ eval_if_expression (pfile)
long old_written = CPP_WRITTEN (pfile); long old_written = CPP_WRITTEN (pfile);
pfile->parsing_if_directive++; pfile->parsing_if_directive++;
value = cpp_parse_expr (pfile); value = _cpp_parse_expr (pfile);
pfile->parsing_if_directive--; pfile->parsing_if_directive--;
skip_rest_of_line (pfile); skip_rest_of_line (pfile);
...@@ -2683,7 +2678,7 @@ cpp_get_token (pfile) ...@@ -2683,7 +2678,7 @@ cpp_get_token (pfile)
return CPP_NAME; return CPP_NAME;
ident = pfile->token_buffer + before_name_written; ident = pfile->token_buffer + before_name_written;
ident_len = CPP_PWRITTEN (pfile) - ident; ident_len = CPP_PWRITTEN (pfile) - ident;
hp = cpp_lookup (pfile, ident, ident_len); hp = _cpp_lookup (pfile, ident, ident_len);
if (!hp) if (!hp)
return CPP_NAME; return CPP_NAME;
if (hp->type == T_DISABLED) if (hp->type == T_DISABLED)
...@@ -2751,7 +2746,7 @@ cpp_get_token (pfile) ...@@ -2751,7 +2746,7 @@ cpp_get_token (pfile)
/* This is now known to be a macro call. /* This is now known to be a macro call.
Expand the macro, reading arguments as needed, Expand the macro, reading arguments as needed,
and push the expansion on the input stack. */ and push the expansion on the input stack. */
macroexpand (pfile, hp); _cpp_macroexpand (pfile, hp);
CPP_SET_WRITTEN (pfile, before_name_written); CPP_SET_WRITTEN (pfile, before_name_written);
} }
goto get_next; goto get_next;
...@@ -3085,16 +3080,16 @@ do_assert (pfile, keyword) ...@@ -3085,16 +3080,16 @@ do_assert (pfile, keyword)
thislen = strlen (sym); thislen = strlen (sym);
baselen = index (sym, '(') - sym; baselen = index (sym, '(') - sym;
this = cpp_lookup (pfile, sym, thislen); this = _cpp_lookup (pfile, sym, thislen);
if (this) if (this)
{ {
cpp_warning (pfile, "`%s' re-asserted", sym); cpp_warning (pfile, "`%s' re-asserted", sym);
goto error; goto error;
} }
base = cpp_lookup (pfile, sym, baselen); base = _cpp_lookup (pfile, sym, baselen);
if (! base) if (! base)
base = cpp_install (pfile, sym, baselen, T_ASSERT, 0); base = _cpp_install (pfile, sym, baselen, T_ASSERT, 0);
else if (base->type != T_ASSERT) else if (base->type != T_ASSERT)
{ {
/* Token clash - but with what?! */ /* Token clash - but with what?! */
...@@ -3102,7 +3097,7 @@ do_assert (pfile, keyword) ...@@ -3102,7 +3097,7 @@ do_assert (pfile, keyword)
goto error; goto error;
} }
this = cpp_install (pfile, sym, thislen, T_ASSERT, this = _cpp_install (pfile, sym, thislen, T_ASSERT,
(char *)base->value.aschain); (char *)base->value.aschain);
base->value.aschain = this; base->value.aschain = this;
...@@ -3143,7 +3138,7 @@ do_unassert (pfile, keyword) ...@@ -3143,7 +3138,7 @@ do_unassert (pfile, keyword)
thislen = strlen (sym); thislen = strlen (sym);
if (ret == 1) if (ret == 1)
{ {
base = cpp_lookup (pfile, sym, thislen); base = _cpp_lookup (pfile, sym, thislen);
if (! base) if (! base)
goto error; /* It isn't an error to #undef what isn't #defined, goto error; /* It isn't an error to #undef what isn't #defined,
so it isn't an error to #unassert what isn't so it isn't an error to #unassert what isn't
...@@ -3152,16 +3147,16 @@ do_unassert (pfile, keyword) ...@@ -3152,16 +3147,16 @@ do_unassert (pfile, keyword)
for (this = base->value.aschain; this; this = next) for (this = base->value.aschain; this; this = next)
{ {
next = this->value.aschain; next = this->value.aschain;
delete_macro (this); _cpp_delete_macro (this);
} }
delete_macro (base); _cpp_delete_macro (base);
} }
else else
{ {
baselen = index (sym, '(') - sym; baselen = index (sym, '(') - sym;
base = cpp_lookup (pfile, sym, baselen); base = _cpp_lookup (pfile, sym, baselen);
if (! base) goto error; if (! base) goto error;
this = cpp_lookup (pfile, sym, thislen); this = _cpp_lookup (pfile, sym, thislen);
if (! this) goto error; if (! this) goto error;
next = base; next = base;
...@@ -3169,10 +3164,10 @@ do_unassert (pfile, keyword) ...@@ -3169,10 +3164,10 @@ do_unassert (pfile, keyword)
next = next->value.aschain; next = next->value.aschain;
next->value.aschain = this->value.aschain; next->value.aschain = this->value.aschain;
delete_macro (this); _cpp_delete_macro (this);
if (base->value.aschain == NULL) if (base->value.aschain == NULL)
delete_macro (base); /* Last answer for this predicate deleted. */ _cpp_delete_macro (base); /* Last answer for this predicate deleted. */
} }
pfile->limit = (unsigned char *) sym; /* Pop */ pfile->limit = (unsigned char *) sym; /* Pop */
......
...@@ -64,7 +64,6 @@ enum cpp_token ...@@ -64,7 +64,6 @@ enum cpp_token
typedef enum cpp_token (*parse_underflow_t) PARAMS((cpp_reader *)); typedef enum cpp_token (*parse_underflow_t) PARAMS((cpp_reader *));
typedef int (*parse_cleanup_t) PARAMS((cpp_buffer *, cpp_reader *)); typedef int (*parse_cleanup_t) PARAMS((cpp_buffer *, cpp_reader *));
extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **)); 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_token PARAMS ((cpp_reader *));
extern enum cpp_token cpp_get_non_space_token PARAMS ((cpp_reader *)); extern enum cpp_token cpp_get_non_space_token PARAMS ((cpp_reader *));
...@@ -694,16 +693,21 @@ extern void output_line_command PARAMS ((cpp_reader *, ...@@ -694,16 +693,21 @@ extern void output_line_command PARAMS ((cpp_reader *,
enum file_change_code)); enum file_change_code));
/* In cppfiles.c */ /* In cppfiles.c */
extern void simplify_pathname PARAMS ((char *)); extern int cpp_included PARAMS ((cpp_reader *, const char *));
extern void merge_include_chains PARAMS ((struct cpp_options *)); extern int cpp_read_file PARAMS ((cpp_reader *, const char *));
extern int find_include_file PARAMS ((cpp_reader *, const char *,
extern void _cpp_simplify_pathname PARAMS ((char *));
extern void _cpp_merge_include_chains PARAMS ((struct cpp_options *));
extern int _cpp_find_include_file PARAMS ((cpp_reader *, const char *,
struct file_name_list *, struct file_name_list *,
struct include_hash **, struct include_hash **,
int *)); int *));
extern int finclude PARAMS ((cpp_reader *, int, extern int _cpp_read_include_file PARAMS ((cpp_reader *, int,
struct include_hash *)); struct include_hash *));
extern int cpp_read_file PARAMS ((cpp_reader *, const char *));
extern struct include_hash *include_hash PARAMS ((cpp_reader *, const char *, int)); /* In cppexp.c */
extern HOST_WIDEST_INT _cpp_parse_expr PARAMS ((cpp_reader *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment