+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>
* config/mips/mips.h (PTRDIFF_TYPE): Revert broken change;
#include "cpplib.h"
#include "intl.h"
-static void cpp_print_containing_files PARAMS ((cpp_reader *, cpp_buffer *));
-static void cpp_print_file_and_line PARAMS ((const char *, long, long));
-static void v_cpp_message PARAMS ((cpp_reader *, int,
+static void print_containing_files PARAMS ((cpp_reader *, cpp_buffer *));
+static void print_file_and_line PARAMS ((const char *, long, long));
+static void v_message PARAMS ((cpp_reader *, int,
const char *, long, long,
const char *, va_list));
commands which led to the current file. */
static void
-cpp_print_containing_files (pfile, ip)
+print_containing_files (pfile, ip)
cpp_reader *pfile;
cpp_buffer *ip;
{
}
static void
-cpp_print_file_and_line (filename, line, column)
+print_file_and_line (filename, line, column)
const char *filename;
long line, column;
{
1 for error, 0 for warning. */
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;
int is_error;
const char *file;
if (line == -1)
cpp_buf_line_and_col (ip, &line, &col);
- cpp_print_containing_files (pfile, ip);
- cpp_print_file_and_line (file, line, col);
+ print_containing_files (pfile, ip);
+ print_file_and_line (file, line, col);
}
else
fprintf (stderr, "%s: ", progname);
pfile->errors = CPP_FATAL_LIMIT;
break;
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);
msgid = va_arg (ap, const char *);
#endif
- v_cpp_message (pfile, 3, NULL, -1, -1, msgid, ap);
+ v_message (pfile, 3, NULL, -1, -1, msgid, ap);
va_end(ap);
}
msgid = va_arg (ap, const char *);
#endif
- v_cpp_message (pfile, 2, NULL, -1, -1, msgid, ap);
+ v_message (pfile, 2, NULL, -1, -1, msgid, ap);
va_end(ap);
}
if (CPP_OPTIONS (pfile)->inhibit_errors)
return;
- v_cpp_message (pfile, 1, NULL, -1, -1, msgid, ap);
+ v_message (pfile, 1, NULL, -1, -1, msgid, ap);
va_end(ap);
}
if (CPP_OPTIONS (pfile)->inhibit_errors)
return;
- v_cpp_message (pfile, 1, NULL, line, column, msgid, ap);
+ v_message (pfile, 1, NULL, line, column, msgid, ap);
va_end(ap);
}
if (CPP_OPTIONS (pfile)->inhibit_warnings)
return;
- v_cpp_message (pfile, 0, NULL, -1, -1, msgid, ap);
+ v_message (pfile, 0, NULL, -1, -1, msgid, ap);
va_end(ap);
}
if (CPP_OPTIONS (pfile)->inhibit_warnings)
return;
- v_cpp_message (pfile, 0, NULL, line, column, msgid, ap);
+ v_message (pfile, 0, NULL, line, column, msgid, ap);
va_end(ap);
}
: CPP_OPTIONS (pfile)->inhibit_warnings)
return;
- v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
+ v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
NULL, -1, -1, msgid, ap);
va_end(ap);
}
: CPP_OPTIONS (pfile)->inhibit_warnings)
return;
- v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
+ v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
NULL, line, column, msgid, ap);
va_end(ap);
}
: CPP_OPTIONS (pfile)->inhibit_warnings)
return;
- v_cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
+ v_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
file, line, col, msgid, 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.
This program is free software; you can redistribute it and/or modify it
#endif
#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)
#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)
/* Yield nonzero if adding two numbers with A's and B's signs can yield a
#define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
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 right_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT, 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 HOST_WIDEST_INT left_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT,
+ int, unsigned HOST_WIDEST_INT));
+static HOST_WIDEST_INT right_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT,
+ 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 cpp_lex PARAMS ((cpp_reader *, int));
-extern HOST_WIDEST_INT cpp_parse_expr PARAMS ((cpp_reader *));
-static HOST_WIDEST_INT cpp_parse_escape PARAMS ((cpp_reader *, U_CHAR **, HOST_WIDEST_INT));
+static HOST_WIDEST_INT parse_escape PARAMS ((cpp_reader *, U_CHAR **,
+ HOST_WIDEST_INT));
+static struct operation lex PARAMS ((cpp_reader *, int));
+
#define ERROR 299
#define OROR 300
#define SKIP_OPERAND 8
/*#define UNSIGNEDP 16*/
-struct operation {
- short op;
- char rprio; /* Priority of op (relative to it right operand). */
- char flags;
- char unsignedp; /* true if value should be treated as unsigned */
- HOST_WIDEST_INT value; /* The value logically "right" of op. */
+struct operation
+{
+ short op;
+ char rprio; /* Priority of op (relative to it right operand). */
+ char flags;
+ 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
int max_chars;
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;
-#endif
if (*ptr == 'L')
{
while (ptr < end)
{
-#ifndef MULTIBYTE_CHARS
c = *ptr++;
-#else
- ptr += mbtowc (&c, ptr, end - ptr);
-#endif
if (c == '\'' || c == '\0')
break;
else if (c == '\\')
{
- /* Hopefully valid assumption: if mbtowc returns a backslash,
- 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);
+ c = parse_escape (pfile, &ptr, mask);
if (width < HOST_BITS_PER_INT
&& (unsigned int) c >= (unsigned int)(1 << width))
cpp_pedwarn (pfile, "escape sequence out of range for character");
/* Read one token. */
static struct operation
-cpp_lex (pfile, skip_evaluation)
+lex (pfile, skip_evaluation)
cpp_reader *pfile;
int skip_evaluation;
{
after the zeros. A value of 0 does not mean end of string. */
static HOST_WIDEST_INT
-cpp_parse_escape (pfile, string_ptr, result_mask)
+parse_escape (pfile, string_ptr, result_mask)
cpp_reader *pfile;
U_CHAR **string_ptr;
HOST_WIDEST_INT result_mask;
Returns the value of the expression. */
HOST_WIDEST_INT
-cpp_parse_expr (pfile)
+_cpp_parse_expr (pfile)
cpp_reader *pfile;
{
/* The implementation is an operator precedence parser,
char flags = 0;
/* 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.
If the token is an operator, figure out its left and right
switch (op.op)
{
case NAME:
- cpp_ice (pfile, "cpp_lex returns a NAME");
+ cpp_ice (pfile, "lex returns a NAME");
goto syntax_error;
case INT: case CHAR:
goto set_value;
else
{
new_stack = (struct operation *) xmalloc (new_size);
- bcopy ((char *) stack, (char *) new_stack, old_size);
+ memcpy (new_stack, stack, old_size);
}
stack = new_stack;
top = (struct operation *) ((char *) new_stack + old_size);
#include "cpplib.h"
#include "intl.h"
-/* The entry points to this file are: find_include_file,
- cpp_read_file, finclude, include_hash, append_include_chain, and
- file_cleanup. file_cleanup is only called through
- CPP_BUFFER(pfile)->cleanup, so it's static anyway. */
-
+static struct include_hash *include_hash PARAMS ((cpp_reader *,
+ const char *, int));
static struct include_hash *redundant_include_p
PARAMS ((cpp_reader *,
struct include_hash *,
how?) and possibly preload the include hash. */
void
-merge_include_chains (opts)
+_cpp_merge_include_chains (opts)
struct cpp_options *opts;
{
struct file_name_list *prev, *cur, *other;
#include name (there are at least three ways this can happen). The
hash function could probably be improved a bit. */
-struct include_hash *
+static struct include_hash *
include_hash (pfile, fname, add)
cpp_reader *pfile;
const char *fname;
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
file_cleanup (pbuf, pfile)
cpp_buffer *pbuf;
*BEFORE is 1 if the file was included before (but needs to be read
again). */
int
-find_include_file (pfile, fname, search_start, ihash, before)
+_cpp_find_include_file (pfile, fname, search_start, ihash, before)
cpp_reader *pfile;
const char *fname;
struct file_name_list *search_start;
}
*before = 0;
*ihash = ih;
+ ih->name = NULL;
ih->nshort = xstrdup (fname);
ih->control_macro = NULL;
bcopy (l->name, name, l->nlen);
name[l->nlen] = '/';
strcpy (&name[l->nlen+1], fname);
- simplify_pathname (name);
+ _cpp_simplify_pathname (name);
if (CPP_OPTIONS (pfile)->remap)
name = remap_filename (pfile, name, l);
}
/* Open the file in nonblocking mode, so we don't get stuck if
- someone clever has asked cpp to process /dev/rmt0. finclude()
- will check that we have a real file to work with. Also take
- care not to acquire a controlling terminal by mistake (this can't
- happen on sane systems, but paranoia is a virtue). */
+ someone clever has asked cpp to process /dev/rmt0.
+ _cpp_read_include_file will check that we have a real file to
+ work with. Also take care not to acquire a controlling terminal
+ 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)
{
cpp_notice_from_errno (pfile, fname);
ih_fake->control_macro = 0;
ih_fake->buf = (char *)-1;
ih_fake->limit = 0;
- if (!finclude (pfile, f, ih_fake))
+ if (!_cpp_read_include_file (pfile, f, ih_fake))
goto failed_finclude;
return 1;
The caller is responsible for the cpp_push_buffer. */
int
-finclude (pfile, fd, ihash)
+_cpp_read_include_file (pfile, fd, ihash)
cpp_reader *pfile;
int fd;
struct include_hash *ihash;
of the string.
*/
void
-simplify_pathname (path)
+_cpp_simplify_pathname (path)
char *path;
{
char *from, *to;
Otherwise, compute the length by scanning the entire name. */
HASHNODE *
-cpp_lookup (pfile, name, len)
+_cpp_lookup (pfile, name, len)
cpp_reader *pfile;
const U_CHAR *name;
int len;
do_define when redefining macros. */
void
-free_definition (d)
+_cpp_free_definition (d)
DEFINITION *d;
{
struct reflist *ap, *nextap;
*/
void
-delete_macro (hp)
+_cpp_delete_macro (hp)
HASHNODE *hp;
{
if (hp->prev != NULL)
*hp->bucket_hdr = hp->next;
if (hp->type == T_MACRO)
- free_definition (hp->value.defn);
+ _cpp_free_definition (hp->value.defn);
free (hp);
}
Otherwise, compute the hash code. */
HASHNODE *
-cpp_install (pfile, name, len, type, value)
+_cpp_install (pfile, name, len, type, value)
cpp_reader *pfile;
const U_CHAR *name;
int len;
macro. */
DEFINITION *
-create_definition (pfile, funlike)
+_cpp_create_definition (pfile, funlike)
cpp_reader *pfile;
int funlike;
{
an argument list follows; arguments come from the input stack. */
void
-macroexpand (pfile, hp)
+_cpp_macroexpand (pfile, hp)
cpp_reader *pfile;
HASHNODE *hp;
{
/* Return zero if two DEFINITIONs are isomorphic. */
int
-compare_defs (pfile, d1, d2)
+_cpp_compare_defs (pfile, d1, d2)
cpp_reader *pfile;
DEFINITION *d1, *d2;
{
to be read back in again. */
void
-dump_definition (pfile, sym, len, defn)
+_cpp_dump_definition (pfile, sym, len, defn)
cpp_reader *pfile;
const U_CHAR *sym;
long len;
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 *));
-extern HASHNODE *cpp_lookup PARAMS ((cpp_reader *, const U_CHAR *, int));
-extern void free_definition PARAMS ((DEFINITION *));
-extern void delete_macro PARAMS ((HASHNODE *));
+extern HASHNODE *_cpp_lookup PARAMS ((cpp_reader *, const U_CHAR *, int));
+extern void _cpp_free_definition PARAMS ((DEFINITION *));
+extern void _cpp_delete_macro PARAMS ((HASHNODE *));
-extern DEFINITION *create_definition PARAMS ((cpp_reader *, int));
-extern int compare_defs PARAMS ((cpp_reader *, DEFINITION *,
+extern DEFINITION *_cpp_create_definition
+ PARAMS ((cpp_reader *, int));
+extern int _cpp_compare_defs PARAMS ((cpp_reader *, DEFINITION *,
DEFINITION *));
-extern void macroexpand PARAMS ((cpp_reader *, HASHNODE *));
-extern void dump_definition PARAMS ((cpp_reader *, const U_CHAR *, long,
+extern void _cpp_macroexpand PARAMS ((cpp_reader *, HASHNODE *));
+extern void _cpp_dump_definition PARAMS ((cpp_reader *, const U_CHAR *, long,
DEFINITION *));
#endif
static void initialize_standard_includes PARAMS ((cpp_reader *));
static void new_pending_define PARAMS ((struct cpp_options *,
const char *));
+static int handle_option PARAMS ((cpp_reader *, int, char **));
/* Fourth argument to append_include_chain: chain to use */
enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
struct stat st;
unsigned int len;
- simplify_pathname (dir);
+ _cpp_simplify_pathname (dir);
if (stat (dir, &st))
{
/* Dirs that don't exist are silently ignored. */
struct include_hash *next = imp->next;
free ((PTR) imp->name);
+ free ((PTR) imp->nshort);
free (imp);
imp = next;
}
for (i = HASHSIZE; --i >= 0;)
{
while (pfile->hashtab[i])
- delete_macro (pfile->hashtab[i]);
+ _cpp_delete_macro (pfile->hashtab[i]);
}
free (pfile->hashtab);
}
val = (b->flags & ULP) ? user_label_prefix : b->value;
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)
dump_special_to_buffer (pfile, b->name);
}
if (! opts->no_standard_includes)
initialize_standard_includes (pfile);
- merge_include_chains (opts);
+ _cpp_merge_include_chains (opts);
/* With -v, print the list of dirs to search. */
if (opts->verbose)
for (h = pfile->hashtab[i]; h; h = h->next)
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');
}
}
Can be called multiple times, to handle multiple sets of options.
Returns number of strings consumed. */
-int
-cpp_handle_option (pfile, argc, argv)
+static int
+handle_option (pfile, argc, argv)
cpp_reader *pfile;
int argc;
char **argv;
int 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)
break;
}
case CPP_BUMP_LINE must not be called. */
#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
const U_CHAR *id;
int len;
{
- HASHNODE *hp = cpp_lookup (pfile, id, len);
+ HASHNODE *hp = _cpp_lookup (pfile, id, len);
if (hp && hp->type == T_POISON)
{
cpp_error (pfile, "attempt to use poisoned `%s'", hp->name);
as an object-like macro if this happens, with a warning. */
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)
return 0;
- if ((hp = cpp_lookup (pfile, sym, len)) != NULL)
+ if ((hp = _cpp_lookup (pfile, sym, len)) != NULL)
{
int ok;
/* Redefining a macro is ok if the definitions are the same. */
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. */
else if (hp->type == T_CONST || hp->type == T_STDC)
ok = ! CPP_OPTIONS (pfile)->done_initializing;
{
/* Replace the old definition. */
if (hp->type == T_MACRO)
- free_definition (hp->value.defn);
+ _cpp_free_definition (hp->value.defn);
hp->type = T_MACRO;
hp->value.defn = def;
}
}
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
|| 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)
pass_thru_directive (sym, len, pfile, keyword);
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)
return 0;
if (angle_brackets)
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);
pfile->only_seen_white = 2;
}
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
need to pass through all effective #undef commands. */
{
if (hp->type != T_MACRO)
cpp_warning (pfile, "undefining `%s'", hp->name);
- delete_macro (hp);
+ _cpp_delete_macro (hp);
}
}
{
/* Be quiet about `#pragma implementation' for a file only if it hasn't
been included yet. */
- struct include_hash *ptr;
enum cpp_token token;
long written = CPP_WRITTEN (pfile);
U_CHAR *name;
name = pfile->token_buffer + written + 1;
copy = xstrdup (name);
copy[strlen(copy)] = '\0'; /* trim trailing quote */
-
- ptr = include_hash (pfile, copy, 0);
- if (ptr)
+
+ if (cpp_included (pfile, copy))
cpp_warning (pfile,
"`#pragma implementation' for `%s' appears after file is included",
copy);
p = pfile->token_buffer + written;
len = strlen (p);
- if ((hp = cpp_lookup (pfile, p, len)))
+ if ((hp = _cpp_lookup (pfile, p, len)))
{
if (hp->type != T_POISON)
{
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->type = T_POISON;
}
}
else
- cpp_install (pfile, p, len, T_POISON, 0);
+ _cpp_install (pfile, p, len, T_POISON, 0);
if (writeit)
CPP_PUTC (pfile, ' ');
}
long old_written = CPP_WRITTEN (pfile);
pfile->parsing_if_directive++;
- value = cpp_parse_expr (pfile);
+ value = _cpp_parse_expr (pfile);
pfile->parsing_if_directive--;
skip_rest_of_line (pfile);
return CPP_NAME;
ident = pfile->token_buffer + before_name_written;
ident_len = CPP_PWRITTEN (pfile) - ident;
- hp = cpp_lookup (pfile, ident, ident_len);
+ hp = _cpp_lookup (pfile, ident, ident_len);
if (!hp)
return CPP_NAME;
if (hp->type == T_DISABLED)
/* This is now known to be a macro call.
Expand the macro, reading arguments as needed,
and push the expansion on the input stack. */
- macroexpand (pfile, hp);
+ _cpp_macroexpand (pfile, hp);
CPP_SET_WRITTEN (pfile, before_name_written);
}
goto get_next;
thislen = strlen (sym);
baselen = index (sym, '(') - sym;
- this = cpp_lookup (pfile, sym, thislen);
+ this = _cpp_lookup (pfile, sym, thislen);
if (this)
{
cpp_warning (pfile, "`%s' re-asserted", sym);
goto error;
}
- base = cpp_lookup (pfile, sym, baselen);
+ base = _cpp_lookup (pfile, sym, baselen);
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)
{
/* Token clash - but with what?! */
goto error;
}
- this = cpp_install (pfile, sym, thislen, T_ASSERT,
+ this = _cpp_install (pfile, sym, thislen, T_ASSERT,
(char *)base->value.aschain);
base->value.aschain = this;
thislen = strlen (sym);
if (ret == 1)
{
- base = cpp_lookup (pfile, sym, thislen);
+ base = _cpp_lookup (pfile, sym, thislen);
if (! base)
goto error; /* It isn't an error to #undef what isn't #defined,
so it isn't an error to #unassert what isn't
for (this = base->value.aschain; this; this = next)
{
next = this->value.aschain;
- delete_macro (this);
+ _cpp_delete_macro (this);
}
- delete_macro (base);
+ _cpp_delete_macro (base);
}
else
{
baselen = index (sym, '(') - sym;
- base = cpp_lookup (pfile, sym, baselen);
+ base = _cpp_lookup (pfile, sym, baselen);
if (! base) goto error;
- this = cpp_lookup (pfile, sym, thislen);
+ this = _cpp_lookup (pfile, sym, thislen);
if (! this) goto error;
next = base;
next = next->value.aschain;
next->value.aschain = this->value.aschain;
- delete_macro (this);
+ _cpp_delete_macro (this);
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 */
typedef enum cpp_token (*parse_underflow_t) PARAMS((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 enum cpp_token cpp_get_token PARAMS ((cpp_reader *));
extern enum cpp_token cpp_get_non_space_token PARAMS ((cpp_reader *));
enum file_change_code));
/* In cppfiles.c */
-extern void simplify_pathname PARAMS ((char *));
-extern void merge_include_chains PARAMS ((struct cpp_options *));
-extern int find_include_file PARAMS ((cpp_reader *, const char *,
+extern int cpp_included PARAMS ((cpp_reader *, const char *));
+extern int cpp_read_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 include_hash **,
int *));
-extern int finclude PARAMS ((cpp_reader *, int,
+extern int _cpp_read_include_file PARAMS ((cpp_reader *, int,
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
}