Commit 5d8ebbd8 by Neil Booth Committed by Neil Booth

cpperror.c: Update comments and copyright.

	* cpperror.c: Update comments and copyright.
	* cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c,
	cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly.

From-SVN: r48522
parent 518c1311
2002-01-03 Neil Booth <neil@daikokuya.demon.co.uk>
* cpperror.c: Update comments and copyright.
* cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c,
cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly.
2002-01-03 John David Anglin <dave@hiauly1.hia.nrc.ca> 2002-01-03 John David Anglin <dave@hiauly1.hia.nrc.ca>
* collect2.c (main): Use strcmp when testing for "-shared". * collect2.c (main): Use strcmp when testing for "-shared".
......
/* Default error handlers for CPP Library. /* Default error handlers for CPP Library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000 Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
Free Software Foundation, Inc. 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994. Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986 Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987 Adapted to ANSI C, Richard Stallman, Jan 1987
...@@ -36,6 +36,8 @@ static void print_location PARAMS ((cpp_reader *, unsigned int, unsigned int)); ...@@ -36,6 +36,8 @@ static void print_location PARAMS ((cpp_reader *, unsigned int, unsigned int));
#define v_message(msgid, ap) \ #define v_message(msgid, ap) \
do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0) do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0)
/* Print the logical file location (LINE, COL) in preparation for a
diagnostic. Outputs the #include chain if it has changed. */
static void static void
print_location (pfile, line, col) print_location (pfile, line, col)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -77,7 +79,6 @@ print_location (pfile, line, col) ...@@ -77,7 +79,6 @@ print_location (pfile, line, col)
counter, etc. LINE is the logical line number; zero means to print counter, etc. LINE is the logical line number; zero means to print
at the location of the previously lexed token, which tends to be the at the location of the previously lexed token, which tends to be the
correct place by default. Returns 0 if the error has been suppressed. */ correct place by default. Returns 0 if the error has been suppressed. */
int int
_cpp_begin_message (pfile, code, line, column) _cpp_begin_message (pfile, code, line, column)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -137,7 +138,6 @@ _cpp_begin_message (pfile, code, line, column) ...@@ -137,7 +138,6 @@ _cpp_begin_message (pfile, code, line, column)
/* For reporting internal errors. Prints "internal error: " for you, /* For reporting internal errors. Prints "internal error: " for you,
otherwise identical to cpp_fatal. */ otherwise identical to cpp_fatal. */
void void
cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...)) cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{ {
...@@ -156,7 +156,6 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...)) ...@@ -156,7 +156,6 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
(We do not exit, to support use of cpplib as a library. (We do not exit, to support use of cpplib as a library.
Instead, it is the caller's responsibility to check Instead, it is the caller's responsibility to check
CPP_FATAL_ERRORS. */ CPP_FATAL_ERRORS. */
void void
cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...)) cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{ {
...@@ -170,6 +169,7 @@ cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...)) ...@@ -170,6 +169,7 @@ cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
VA_CLOSE (ap); VA_CLOSE (ap);
} }
/* Print an error at the location of the previously lexed token. */
void void
cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{ {
...@@ -183,6 +183,7 @@ cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) ...@@ -183,6 +183,7 @@ cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
VA_CLOSE (ap); VA_CLOSE (ap);
} }
/* Print an error at a specific location. */
void void
cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column, cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
const char *msgid, ...)) const char *msgid, ...))
...@@ -208,6 +209,7 @@ cpp_error_from_errno (pfile, name) ...@@ -208,6 +209,7 @@ cpp_error_from_errno (pfile, name)
cpp_error (pfile, "%s: %s", name, xstrerror (errno)); cpp_error (pfile, "%s: %s", name, xstrerror (errno));
} }
/* Print a warning at the location of the previously lexed token. */
void void
cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{ {
...@@ -221,6 +223,7 @@ cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) ...@@ -221,6 +223,7 @@ cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
VA_CLOSE (ap); VA_CLOSE (ap);
} }
/* Print a warning at a specific location. */
void void
cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column, cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
const char *msgid, ...)) const char *msgid, ...))
...@@ -237,6 +240,7 @@ cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column, ...@@ -237,6 +240,7 @@ cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
VA_CLOSE (ap); VA_CLOSE (ap);
} }
/* Pedwarn at the location of the previously lexed token. */
void void
cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{ {
...@@ -250,6 +254,7 @@ cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...)) ...@@ -250,6 +254,7 @@ cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
VA_CLOSE (ap); VA_CLOSE (ap);
} }
/* Pedwarn at a specific location. */
void void
cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column, cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
const char *msgid, ...)) const char *msgid, ...))
...@@ -266,7 +271,7 @@ cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column, ...@@ -266,7 +271,7 @@ cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
VA_CLOSE (ap); VA_CLOSE (ap);
} }
/* Print an error message not associated with a file. */ /* Print an error message not associated with the translation unit. */
void void
cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...)) cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{ {
...@@ -282,6 +287,8 @@ cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...)) ...@@ -282,6 +287,8 @@ cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
VA_CLOSE (ap); VA_CLOSE (ap);
} }
/* Print an error message originating from ERRNO and not associated
with the translation unit. */
void void
cpp_notice_from_errno (pfile, name) cpp_notice_from_errno (pfile, name)
cpp_reader *pfile; cpp_reader *pfile;
......
/* Parse C expressions for cpplib. /* Parse C expressions for cpplib.
Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001 Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
Free Software Foundation. 2002 Free Software Foundation.
Contributed by Per Bothner, 1994. Contributed by Per Bothner, 1994.
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
...@@ -85,10 +85,9 @@ static const struct suffix vsuf_3[] = { ...@@ -85,10 +85,9 @@ static const struct suffix vsuf_3[] = {
}; };
#define Nsuff(tab) (sizeof tab / sizeof (struct suffix)) #define Nsuff(tab) (sizeof tab / sizeof (struct suffix))
/* Parse and convert an integer for #if. Accepts decimal, hex, or /* Parse and convert what is presumably an integer in TOK. Accepts
octal with or without size suffixes. Returned op is CPP_ERROR on decimal, hex, or octal with or without size suffixes. Returned op
error, otherwise it is a CPP_NUMBER. */ is CPP_ERROR on error, otherwise it is a CPP_NUMBER. */
static struct op static struct op
parse_number (pfile, tok) parse_number (pfile, tok)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -206,6 +205,7 @@ parse_number (pfile, tok) ...@@ -206,6 +205,7 @@ parse_number (pfile, tok)
return op; return op;
} }
/* Handle meeting "defined" in a preprocessor expression. */
static struct op static struct op
parse_defined (pfile) parse_defined (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -275,7 +275,6 @@ parse_defined (pfile) ...@@ -275,7 +275,6 @@ parse_defined (pfile)
(an interpreted preprocessing number or character constant, or the (an interpreted preprocessing number or character constant, or the
result of the "defined" or "#" operators), CPP_ERROR on error, result of the "defined" or "#" operators), CPP_ERROR on error,
CPP_EOF, or the type of an operator token. */ CPP_EOF, or the type of an operator token. */
static struct op static struct op
lex (pfile, skip_evaluation) lex (pfile, skip_evaluation)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -372,6 +371,7 @@ lex (pfile, skip_evaluation) ...@@ -372,6 +371,7 @@ lex (pfile, skip_evaluation)
return op; return op;
} }
/* Warn if appropriate on overflow. */
static void static void
integer_overflow (pfile) integer_overflow (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -380,6 +380,8 @@ integer_overflow (pfile) ...@@ -380,6 +380,8 @@ integer_overflow (pfile)
cpp_pedwarn (pfile, "integer overflow in preprocessor expression"); cpp_pedwarn (pfile, "integer overflow in preprocessor expression");
} }
/* Handle shifting A left by B bits. UNSIGNEDP is non-zero if A is
unsigned. */
static HOST_WIDEST_INT static HOST_WIDEST_INT
left_shift (pfile, a, unsignedp, b) left_shift (pfile, a, unsignedp, b)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -404,6 +406,8 @@ left_shift (pfile, a, unsignedp, b) ...@@ -404,6 +406,8 @@ left_shift (pfile, a, unsignedp, b)
} }
} }
/* Handle shifting A right by B bits. UNSIGNEDP is non-zero if A is
unsigned. */
static HOST_WIDEST_INT static HOST_WIDEST_INT
right_shift (pfile, a, unsignedp, b) right_shift (pfile, a, unsignedp, b)
cpp_reader *pfile ATTRIBUTE_UNUSED; cpp_reader *pfile ATTRIBUTE_UNUSED;
...@@ -547,7 +551,6 @@ op_to_prio[] = ...@@ -547,7 +551,6 @@ op_to_prio[] =
/* Parse and evaluate a C expression, reading from PFILE. /* Parse and evaluate a C expression, reading from PFILE.
Returns the truth value of the expression. */ Returns the truth value of the expression. */
int int
_cpp_parse_expr (pfile) _cpp_parse_expr (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -870,6 +873,7 @@ _cpp_parse_expr (pfile) ...@@ -870,6 +873,7 @@ _cpp_parse_expr (pfile)
return result; return result;
} }
/* Output OP as text for diagnostics. */
static const unsigned char * static const unsigned char *
op_as_text (pfile, op) op_as_text (pfile, op)
cpp_reader *pfile; cpp_reader *pfile;
......
/* Part of CPP library. (include file handling) /* Part of CPP library. (include file handling)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998,
1999, 2000, 2001 Free Software Foundation, Inc. 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994. Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986 Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987 Adapted to ANSI C, Richard Stallman, Jan 1987
...@@ -212,7 +212,6 @@ _cpp_fake_include (pfile, fname) ...@@ -212,7 +212,6 @@ _cpp_fake_include (pfile, fname)
Returns an include_file structure with an open file descriptor on Returns an include_file structure with an open file descriptor on
success, or NULL on failure. */ success, or NULL on failure. */
static struct include_file * static struct include_file *
open_file (pfile, filename) open_file (pfile, filename)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -276,7 +275,6 @@ open_file (pfile, filename) ...@@ -276,7 +275,6 @@ open_file (pfile, filename)
stack, unless there are errors, or the file is not re-included stack, unless there are errors, or the file is not re-included
because of e.g. multiple-include guards. Returns true if a buffer because of e.g. multiple-include guards. Returns true if a buffer
is stacked. */ is stacked. */
static bool static bool
stack_include_file (pfile, inc) stack_include_file (pfile, inc)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -351,7 +349,6 @@ stack_include_file (pfile, inc) ...@@ -351,7 +349,6 @@ stack_include_file (pfile, inc)
and block devices. and block devices.
FIXME: Flush file cache and try again if we run out of memory. */ FIXME: Flush file cache and try again if we run out of memory. */
static int static int
read_include_file (pfile, inc) read_include_file (pfile, inc)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -467,6 +464,7 @@ read_include_file (pfile, inc) ...@@ -467,6 +464,7 @@ read_include_file (pfile, inc)
return 1; return 1;
} }
/* Drop INC's buffer from memory, if we are unlikely to need it again. */
static void static void
purge_cache (inc) purge_cache (inc)
struct include_file *inc; struct include_file *inc;
...@@ -524,8 +522,7 @@ cpp_included (pfile, fname) ...@@ -524,8 +522,7 @@ cpp_included (pfile, fname)
un-openable), in which case an error code will be in errno. If un-openable), in which case an error code will be in errno. If
there is no include path to use it returns NO_INCLUDE_PATH, there is no include path to use it returns NO_INCLUDE_PATH,
otherwise an include_file structure. If this request originates otherwise an include_file structure. If this request originates
from a #include_next directive, set INCLUDE_NEXT to true. */ from a directive of TYPE #include_next, set INCLUDE_NEXT to true. */
static struct include_file * static struct include_file *
find_include_file (pfile, header, type) find_include_file (pfile, header, type)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -612,6 +609,7 @@ _cpp_report_missing_guards (pfile) ...@@ -612,6 +609,7 @@ _cpp_report_missing_guards (pfile)
(PTR) &banner); (PTR) &banner);
} }
/* Callback function for splay_tree_foreach(). */
static int static int
report_missing_guard (n, b) report_missing_guard (n, b)
splay_tree_node n; splay_tree_node n;
...@@ -633,7 +631,9 @@ report_missing_guard (n, b) ...@@ -633,7 +631,9 @@ report_missing_guard (n, b)
return 0; return 0;
} }
/* Create a dependency, or issue an error message as appropriate. */ /* Create a dependency for file FNAME, or issue an error message as
appropriate. ANGLE_BRACKETS is non-zero if the file was bracketed
like <..>. */
static void static void
handle_missing_header (pfile, fname, angle_brackets) handle_missing_header (pfile, fname, angle_brackets)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -679,8 +679,9 @@ handle_missing_header (pfile, fname, angle_brackets) ...@@ -679,8 +679,9 @@ handle_missing_header (pfile, fname, angle_brackets)
cpp_error_from_errno (pfile, fname); cpp_error_from_errno (pfile, fname);
} }
/* Handles #include-family directives, and the command line -imacros /* Handles #include-family directives (distinguished by TYPE),
and -include. Returns true if a buffer was stacked. */ including HEADER, and the command line -imacros and -include.
Returns true if a buffer was stacked. */
bool bool
_cpp_execute_include (pfile, header, type) _cpp_execute_include (pfile, header, type)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -746,8 +747,8 @@ _cpp_read_file (pfile, fname) ...@@ -746,8 +747,8 @@ _cpp_read_file (pfile, fname)
return stack_include_file (pfile, f); return stack_include_file (pfile, f);
} }
/* Do appropriate cleanup when a file buffer is popped off the input /* Do appropriate cleanup when a file INC's buffer is popped off the
stack. Push the next -include file, if any remain. */ input stack. Push the next -include file, if any remain. */
bool bool
_cpp_pop_file_buffer (pfile, inc) _cpp_pop_file_buffer (pfile, inc)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -841,7 +842,6 @@ search_from (pfile, type) ...@@ -841,7 +842,6 @@ search_from (pfile, type)
such as DOS. The format of the file name map file is just a series such as DOS. The format of the file name map file is just a series
of lines with two tokens on each line. The first token is the name of lines with two tokens on each line. The first token is the name
to map, and the second token is the actual name to use. */ to map, and the second token is the actual name to use. */
struct file_name_map struct file_name_map
{ {
struct file_name_map *map_next; struct file_name_map *map_next;
...@@ -852,8 +852,7 @@ struct file_name_map ...@@ -852,8 +852,7 @@ struct file_name_map
#define FILE_NAME_MAP_FILE "header.gcc" #define FILE_NAME_MAP_FILE "header.gcc"
/* Read a space delimited string of unlimited length from a stdio /* Read a space delimited string of unlimited length from a stdio
file. */ file F. */
static char * static char *
read_filename_string (ch, f) read_filename_string (ch, f)
int ch; int ch;
...@@ -884,7 +883,6 @@ read_filename_string (ch, f) ...@@ -884,7 +883,6 @@ read_filename_string (ch, f)
} }
/* This structure holds a linked list of file name maps, one per directory. */ /* This structure holds a linked list of file name maps, one per directory. */
struct file_name_map_list struct file_name_map_list
{ {
struct file_name_map_list *map_list_next; struct file_name_map_list *map_list_next;
...@@ -893,7 +891,6 @@ struct file_name_map_list ...@@ -893,7 +891,6 @@ struct file_name_map_list
}; };
/* Read the file name map file for DIRNAME. */ /* Read the file name map file for DIRNAME. */
static struct file_name_map * static struct file_name_map *
read_name_map (pfile, dirname) read_name_map (pfile, dirname)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1069,7 +1066,6 @@ remove_component_p (path) ...@@ -1069,7 +1066,6 @@ remove_component_p (path)
Guarantees no trailing slashes. All transforms reduce the length Guarantees no trailing slashes. All transforms reduce the length
of the string. Returns PATH. errno is 0 if no error occurred; of the string. Returns PATH. errno is 0 if no error occurred;
nonzero if an error occurred when using stat () or lstat (). */ nonzero if an error occurred when using stat () or lstat (). */
char * char *
_cpp_simplify_pathname (path) _cpp_simplify_pathname (path)
char *path; char *path;
......
/* Hash tables for the CPP library. /* Hash tables for the CPP library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998, Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
1999, 2000 Free Software Foundation, Inc. 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994. Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986 Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987 Adapted to ANSI C, Richard Stallman, Jan 1987
...@@ -32,7 +32,6 @@ static cpp_hashnode *alloc_node PARAMS ((hash_table *)); ...@@ -32,7 +32,6 @@ static cpp_hashnode *alloc_node PARAMS ((hash_table *));
/* Return an identifier node for hashtable.c. Used by cpplib except /* Return an identifier node for hashtable.c. Used by cpplib except
when integrated with the C front ends. */ when integrated with the C front ends. */
static cpp_hashnode * static cpp_hashnode *
alloc_node (table) alloc_node (table)
hash_table *table; hash_table *table;
...@@ -47,7 +46,6 @@ alloc_node (table) ...@@ -47,7 +46,6 @@ alloc_node (table)
/* Set up the identifier hash table. Use TABLE if non-null, otherwise /* Set up the identifier hash table. Use TABLE if non-null, otherwise
create our own. */ create our own. */
void void
_cpp_init_hashtable (pfile, table) _cpp_init_hashtable (pfile, table)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -81,7 +79,6 @@ _cpp_init_hashtable (pfile, table) ...@@ -81,7 +79,6 @@ _cpp_init_hashtable (pfile, table)
} }
/* Tear down the identifier hash table. */ /* Tear down the identifier hash table. */
void void
_cpp_destroy_hashtable (pfile) _cpp_destroy_hashtable (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -95,7 +92,6 @@ _cpp_destroy_hashtable (pfile) ...@@ -95,7 +92,6 @@ _cpp_destroy_hashtable (pfile)
/* Returns the hash entry for the STR of length LEN, creating one /* Returns the hash entry for the STR of length LEN, creating one
if necessary. */ if necessary. */
cpp_hashnode * cpp_hashnode *
cpp_lookup (pfile, str, len) cpp_lookup (pfile, str, len)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -107,7 +103,6 @@ cpp_lookup (pfile, str, len) ...@@ -107,7 +103,6 @@ cpp_lookup (pfile, str, len)
} }
/* Determine whether the str STR, of length LEN, is a defined macro. */ /* Determine whether the str STR, of length LEN, is a defined macro. */
int int
cpp_defined (pfile, str, len) cpp_defined (pfile, str, len)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -124,7 +119,6 @@ cpp_defined (pfile, str, len) ...@@ -124,7 +119,6 @@ cpp_defined (pfile, str, len)
/* For all nodes in the hashtable, callback CB with parameters PFILE, /* For all nodes in the hashtable, callback CB with parameters PFILE,
the node, and V. */ the node, and V. */
void void
cpp_forall_identifiers (pfile, cb, v) cpp_forall_identifiers (pfile, cb, v)
cpp_reader *pfile; cpp_reader *pfile;
......
/* Part of CPP library. /* Part of CPP library.
Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
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
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -43,7 +44,6 @@ struct directive; /* Deliberately incomplete. */ ...@@ -43,7 +44,6 @@ struct directive; /* Deliberately incomplete. */
#define CPP_STACK_MAX 200 #define CPP_STACK_MAX 200
/* A generic memory buffer, and operations on it. */ /* A generic memory buffer, and operations on it. */
typedef struct _cpp_buff _cpp_buff; typedef struct _cpp_buff _cpp_buff;
struct _cpp_buff struct _cpp_buff
{ {
...@@ -93,6 +93,7 @@ union utoken ...@@ -93,6 +93,7 @@ union utoken
const cpp_token **ptoken; const cpp_token **ptoken;
}; };
/* A "run" of tokens; part of a chain of runs. */
typedef struct tokenrun tokenrun; typedef struct tokenrun tokenrun;
struct tokenrun struct tokenrun
{ {
...@@ -167,6 +168,7 @@ struct spec_nodes ...@@ -167,6 +168,7 @@ struct spec_nodes
cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */ cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */
}; };
/* Represents the contents of a file cpplib has read in. */
struct cpp_buffer struct cpp_buffer
{ {
const unsigned char *cur; /* current position */ const unsigned char *cur; /* current position */
...@@ -224,7 +226,6 @@ struct cpp_buffer ...@@ -224,7 +226,6 @@ struct cpp_buffer
/* A cpp_reader encapsulates the "state" of a pre-processor run. /* A cpp_reader encapsulates the "state" of a pre-processor run.
Applying cpp_get_token repeatedly yields a stream of pre-processor Applying cpp_get_token repeatedly yields a stream of pre-processor
tokens. Usually, there is only one cpp_reader object active. */ tokens. Usually, there is only one cpp_reader object active. */
struct cpp_reader struct cpp_reader
{ {
/* Top of buffer stack. */ /* Top of buffer stack. */
......
...@@ -54,7 +54,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ...@@ -54,7 +54,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* A `struct pending_option' remembers one -D, -A, -U, -include, or /* A `struct pending_option' remembers one -D, -A, -U, -include, or
-imacros switch. */ -imacros switch. */
typedef void (* cl_directive_handler) PARAMS ((cpp_reader *, const char *)); typedef void (* cl_directive_handler) PARAMS ((cpp_reader *, const char *));
struct pending_option struct pending_option
{ {
...@@ -158,7 +157,6 @@ END ...@@ -158,7 +157,6 @@ END
/* Given a colon-separated list of file names PATH, /* Given a colon-separated list of file names PATH,
add all the names to the search path for include files. */ add all the names to the search path for include files. */
static void static void
path_include (pfile, list, path) path_include (pfile, list, path)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -200,7 +198,9 @@ path_include (pfile, list, path) ...@@ -200,7 +198,9 @@ path_include (pfile, list, path)
} }
/* Append DIR to include path PATH. DIR must be allocated on the /* Append DIR to include path PATH. DIR must be allocated on the
heap; this routine takes responsibility for freeing it. */ heap; this routine takes responsibility for freeing it. CXX_AWARE
is non-zero if the header contains extern "C" guards for C++,
otherwise it is zero. */
static void static void
append_include_chain (pfile, dir, path, cxx_aware) append_include_chain (pfile, dir, path, cxx_aware)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -331,11 +331,7 @@ remove_dup_dirs (pfile, head) ...@@ -331,11 +331,7 @@ remove_dup_dirs (pfile, head)
system, after. Remove duplicate dirs (as determined by system, after. Remove duplicate dirs (as determined by
INO_T_EQ()). The system_include and after_include chains are never INO_T_EQ()). The system_include and after_include chains are never
referred to again after this function; all access is through the referred to again after this function; all access is through the
bracket_include path. bracket_include path. */
For the future: Check if the directory is empty (but
how?) and possibly preload the include hash. */
static void static void
merge_include_chains (pfile) merge_include_chains (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -389,9 +385,8 @@ merge_include_chains (pfile) ...@@ -389,9 +385,8 @@ merge_include_chains (pfile)
CPP_OPTION (pfile, bracket_include) = brack; CPP_OPTION (pfile, bracket_include) = brack;
} }
/* Sets internal flags correctly for a given language, and defines /* A set of booleans indicating what CPP features each source language
macros if necessary. */ requires. */
struct lang_flags struct lang_flags
{ {
char c99; char c99;
...@@ -419,6 +414,7 @@ static const struct lang_flags lang_defaults[] = ...@@ -419,6 +414,7 @@ static const struct lang_flags lang_defaults[] =
/* ASM */ { 0, 0, 0, 1, 0, 0, 1, 0 } /* ASM */ { 0, 0, 0, 1, 0, 0, 1, 0 }
}; };
/* Sets internal flags correctly for a given language. */
static void static void
set_lang (pfile, lang) set_lang (pfile, lang)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -453,7 +449,6 @@ opt_comp (p1, p2) ...@@ -453,7 +449,6 @@ opt_comp (p1, p2)
/* init initializes library global state. It might not need to /* init initializes library global state. It might not need to
do anything depending on the platform and compiler. */ do anything depending on the platform and compiler. */
static void static void
init_library () init_library ()
{ {
...@@ -540,7 +535,7 @@ cpp_create_reader (lang) ...@@ -540,7 +535,7 @@ cpp_create_reader (lang)
} }
/* Free resources used by PFILE. Accessing PFILE after this function /* Free resources used by PFILE. Accessing PFILE after this function
returns leads to undefined behaviour. */ returns leads to undefined behaviour. Returns the error count. */
int int
cpp_destroy (pfile) cpp_destroy (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -613,7 +608,6 @@ cpp_destroy (pfile) ...@@ -613,7 +608,6 @@ cpp_destroy (pfile)
ULP value is the global user_label_prefix ULP value is the global user_label_prefix
Also, macros with CPLUS set in the flags field are entered only for C++. */ Also, macros with CPLUS set in the flags field are entered only for C++. */
struct builtin struct builtin
{ {
const U_CHAR *name; const U_CHAR *name;
...@@ -689,7 +683,7 @@ static const struct builtin builtin_array[] = ...@@ -689,7 +683,7 @@ static const struct builtin builtin_array[] =
builtin_array + sizeof(builtin_array)/sizeof(struct builtin) builtin_array + sizeof(builtin_array)/sizeof(struct builtin)
/* Subroutine of cpp_read_main_file; reads the builtins table above and /* Subroutine of cpp_read_main_file; reads the builtins table above and
enters the macros into the hash table. */ enters them, and language-specific macros, into the hash table. */
static void static void
init_builtins (pfile) init_builtins (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -865,7 +859,7 @@ init_standard_includes (pfile) ...@@ -865,7 +859,7 @@ init_standard_includes (pfile)
} }
} }
/* Pushes a -imacro and -include file given on the command line onto /* Pushes a command line -imacro and -include file indicated by P onto
the buffer stack. Returns non-zero if successful. */ the buffer stack. Returns non-zero if successful. */
static bool static bool
push_include (pfile, p) push_include (pfile, p)
...@@ -1126,6 +1120,7 @@ cpp_finish (pfile) ...@@ -1126,6 +1120,7 @@ cpp_finish (pfile)
_cpp_report_missing_guards (pfile); _cpp_report_missing_guards (pfile);
} }
/* Add a directive to be handled later in the initialization phase. */
static void static void
new_pending_directive (pend, text, handler) new_pending_directive (pend, text, handler)
struct cpp_pending *pend; struct cpp_pending *pend;
...@@ -1318,7 +1313,6 @@ parse_option (input) ...@@ -1318,7 +1313,6 @@ parse_option (input)
/* Handle one command-line option in (argc, argv). /* Handle one command-line option in (argc, argv).
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 int
cpp_handle_option (pfile, argc, argv) cpp_handle_option (pfile, argc, argv)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1871,6 +1865,7 @@ init_dependency_output (pfile) ...@@ -1871,6 +1865,7 @@ init_dependency_output (pfile)
} }
} }
/* Handle --help output. */
static void static void
print_help () print_help ()
{ {
......
/* CPP Library - lexical analysis. /* CPP Library - lexical analysis.
Copyright (C) 2000, 2001 Free Software Foundation, Inc. Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95. Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986 Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987 Adapted to ANSI C, Richard Stallman, Jan 1987
...@@ -97,7 +97,6 @@ static _cpp_buff *new_buff PARAMS ((size_t)); ...@@ -97,7 +97,6 @@ static _cpp_buff *new_buff PARAMS ((size_t));
Compares, the token TOKEN to the NUL-terminated string STRING. Compares, the token TOKEN to the NUL-terminated string STRING.
TOKEN must be a CPP_NAME. Returns 1 for equal, 0 for unequal. */ TOKEN must be a CPP_NAME. Returns 1 for equal, 0 for unequal. */
int int
cpp_ideq (token, string) cpp_ideq (token, string)
const cpp_token *token; const cpp_token *token;
...@@ -414,7 +413,6 @@ name_p (pfile, string) ...@@ -414,7 +413,6 @@ name_p (pfile, string)
Poisson-like). Second most common case is a new identifier, not Poisson-like). Second most common case is a new identifier, not
split and no dollar sign. The other possibilities are rare and split and no dollar sign. The other possibilities are rare and
have been relegated to parse_identifier_slow. */ have been relegated to parse_identifier_slow. */
static cpp_hashnode * static cpp_hashnode *
parse_identifier (pfile) parse_identifier (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -517,7 +515,9 @@ parse_identifier_slow (pfile, cur) ...@@ -517,7 +515,9 @@ parse_identifier_slow (pfile, cur)
ht_lookup (pfile->hash_table, obstack_finish (stack), len, HT_ALLOCED); ht_lookup (pfile->hash_table, obstack_finish (stack), len, HT_ALLOCED);
} }
/* Parse a number, skipping embedded backslash-newlines. */ /* Parse a number, beginning with character C, skipping embedded
backslash-newlines. LEADING_PERIOD is non-zero if there was a "."
before C. Place the result in NUMBER. */
static void static void
parse_number (pfile, number, c, leading_period) parse_number (pfile, number, c, leading_period)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1289,7 +1289,7 @@ _cpp_lex_direct (pfile) ...@@ -1289,7 +1289,7 @@ _cpp_lex_direct (pfile)
return result; return result;
} }
/* An upper bound on the number of bytes needed to spell a token, /* An upper bound on the number of bytes needed to spell TOKEN,
including preceding whitespace. */ including preceding whitespace. */
unsigned int unsigned int
cpp_token_len (token) cpp_token_len (token)
...@@ -1383,8 +1383,8 @@ cpp_spell_token (pfile, token, buffer) ...@@ -1383,8 +1383,8 @@ cpp_spell_token (pfile, token, buffer)
return buffer; return buffer;
} }
/* Returns a token as a null-terminated string. The string is /* Returns TOKEN spelt as a null-terminated string. The string is
temporary, and automatically freed later. Useful for diagnostics. */ freed when the reader is destroyed. Useful for diagnostics. */
unsigned char * unsigned char *
cpp_token_as_text (pfile, token) cpp_token_as_text (pfile, token)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1399,7 +1399,8 @@ cpp_token_as_text (pfile, token) ...@@ -1399,7 +1399,8 @@ cpp_token_as_text (pfile, token)
return start; return start;
} }
/* Used by C front ends. Should really move to using cpp_token_as_text. */ /* Used by C front ends, which really should move to using
cpp_token_as_text. */
const char * const char *
cpp_type2name (type) cpp_type2name (type)
enum cpp_ttype type; enum cpp_ttype type;
...@@ -1508,7 +1509,6 @@ _cpp_equiv_tokens (a, b) ...@@ -1508,7 +1509,6 @@ _cpp_equiv_tokens (a, b)
accidental token paste for output. For simplicity, it is accidental token paste for output. For simplicity, it is
conservative, and occasionally advises a space where one is not conservative, and occasionally advises a space where one is not
needed, e.g. "." and ".2". */ needed, e.g. "." and ".2". */
int int
cpp_avoid_paste (pfile, token1, token2) cpp_avoid_paste (pfile, token1, token2)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1689,7 +1689,6 @@ maybe_read_ucs (pfile, pstr, limit, pc) ...@@ -1689,7 +1689,6 @@ maybe_read_ucs (pfile, pstr, limit, pc)
interpret escapes that did not exist in traditional C. interpret escapes that did not exist in traditional C.
Handles all relevant diagnostics. */ Handles all relevant diagnostics. */
unsigned int unsigned int
cpp_parse_escape (pfile, pstr, limit, mask, traditional) cpp_parse_escape (pfile, pstr, limit, mask, traditional)
cpp_reader *pfile; cpp_reader *pfile;
......
/* CPP Library. (Directive handling.) /* CPP Library. (Directive handling.)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001 Free Software Foundation, Inc. 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95. Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986 Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987 Adapted to ANSI C, Richard Stallman, Jan 1987
...@@ -36,7 +36,6 @@ struct answer ...@@ -36,7 +36,6 @@ struct answer
/* Stack of conditionals currently in progress /* Stack of conditionals currently in progress
(including both successful and failing conditionals). */ (including both successful and failing conditionals). */
struct if_stack struct if_stack
{ {
struct if_stack *next; struct if_stack *next;
...@@ -263,7 +262,6 @@ end_directive (pfile, skip_line) ...@@ -263,7 +262,6 @@ end_directive (pfile, skip_line)
/* Output diagnostics for a directive DIR. INDENTED is non-zero if /* Output diagnostics for a directive DIR. INDENTED is non-zero if
the '#' was indented. */ the '#' was indented. */
static void static void
directive_diagnostics (pfile, dir, indented) directive_diagnostics (pfile, dir, indented)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -311,7 +309,6 @@ directive_diagnostics (pfile, dir, indented) ...@@ -311,7 +309,6 @@ directive_diagnostics (pfile, dir, indented)
to save unnecessarily exporting dtable etc. to cpplex.c. Returns to save unnecessarily exporting dtable etc. to cpplex.c. Returns
non-zero if the line of tokens has been handled, zero if we should non-zero if the line of tokens has been handled, zero if we should
continue processing the line. */ continue processing the line. */
int int
_cpp_handle_directive (pfile, indented) _cpp_handle_directive (pfile, indented)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -479,7 +476,7 @@ do_define (pfile) ...@@ -479,7 +476,7 @@ do_define (pfile)
} }
} }
/* Handle #undef. Marks the identifier NT_VOID in the hash table. */ /* Handle #undef. Mark the identifier NT_VOID in the hash table. */
static void static void
do_undef (pfile) do_undef (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -659,7 +656,6 @@ do_include_next (pfile) ...@@ -659,7 +656,6 @@ do_include_next (pfile)
/* Subroutine of do_line. Read possible flags after file name. LAST /* Subroutine of do_line. Read possible flags after file name. LAST
is the last flag seen; 0 if this is the first flag. Return the flag is the last flag seen; 0 if this is the first flag. Return the flag
if it is valid, 0 at the end of the directive. Otherwise complain. */ if it is valid, 0 at the end of the directive. Otherwise complain. */
static unsigned int static unsigned int
read_flag (pfile, last) read_flag (pfile, last)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -709,7 +705,6 @@ strtoul_for_line (str, len, nump) ...@@ -709,7 +705,6 @@ strtoul_for_line (str, len, nump)
/* Interpret #line command. /* Interpret #line command.
Note that the filename string (if any) is treated as if it were an Note that the filename string (if any) is treated as if it were an
include filename. That means no escape handling. */ include filename. That means no escape handling. */
static void static void
do_line (pfile) do_line (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -807,11 +802,8 @@ _cpp_do_file_change (pfile, reason, to_file, file_line, sysp) ...@@ -807,11 +802,8 @@ _cpp_do_file_change (pfile, reason, to_file, file_line, sysp)
(*pfile->cb.file_change) (pfile, pfile->map); (*pfile->cb.file_change) (pfile, pfile->map);
} }
/* /* Report a warning or error detected by the program we are
* Report a warning or error detected by the program we are processing. Use the directive's tokens in the error message. */
* processing. Use the directive's tokens in the error message.
*/
static void static void
do_diagnostic (pfile, code, print_dir) do_diagnostic (pfile, code, print_dir)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -844,7 +836,6 @@ do_warning (pfile) ...@@ -844,7 +836,6 @@ do_warning (pfile)
} }
/* Report program identification. */ /* Report program identification. */
static void static void
do_ident (pfile) do_ident (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1015,6 +1006,7 @@ do_pragma (pfile) ...@@ -1015,6 +1006,7 @@ do_pragma (pfile)
pfile->state.prevent_expansion--; pfile->state.prevent_expansion--;
} }
/* Handle #pragma once. */
static void static void
do_pragma_once (pfile) do_pragma_once (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1029,12 +1021,12 @@ do_pragma_once (pfile) ...@@ -1029,12 +1021,12 @@ do_pragma_once (pfile)
check_eol (pfile); check_eol (pfile);
} }
/* Handle #pragma poison, to poison one or more identifiers so that
the lexer produces a hard error for each subsequent usage. */
static void static void
do_pragma_poison (pfile) do_pragma_poison (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
/* Poison these symbols so that all subsequent usage produces an
error message. */
const cpp_token *tok; const cpp_token *tok;
cpp_hashnode *hp; cpp_hashnode *hp;
...@@ -1208,6 +1200,7 @@ do_sccs (pfile) ...@@ -1208,6 +1200,7 @@ do_sccs (pfile)
} }
#endif #endif
/* Handle #ifdef. */
static void static void
do_ifdef (pfile) do_ifdef (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1228,6 +1221,7 @@ do_ifdef (pfile) ...@@ -1228,6 +1221,7 @@ do_ifdef (pfile)
push_conditional (pfile, skip, T_IFDEF, 0); push_conditional (pfile, skip, T_IFDEF, 0);
} }
/* Handle #ifndef. */
static void static void
do_ifndef (pfile) do_ifndef (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1253,7 +1247,6 @@ do_ifndef (pfile) ...@@ -1253,7 +1247,6 @@ do_ifndef (pfile)
optimisations. If macro expansion occurs in the expression, we optimisations. If macro expansion occurs in the expression, we
cannot treat it as a controlling conditional, since the expansion cannot treat it as a controlling conditional, since the expansion
could change in the future. That is handled by cpp_get_token. */ could change in the future. That is handled by cpp_get_token. */
static void static void
do_if (pfile) do_if (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1269,7 +1262,6 @@ do_if (pfile) ...@@ -1269,7 +1262,6 @@ do_if (pfile)
/* Flip skipping state if appropriate and continue without changing /* Flip skipping state if appropriate and continue without changing
if_stack; this is so that the error message for missing #endif's if_stack; this is so that the error message for missing #endif's
etc. will point to the original #if. */ etc. will point to the original #if. */
static void static void
do_else (pfile) do_else (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1302,9 +1294,8 @@ do_else (pfile) ...@@ -1302,9 +1294,8 @@ do_else (pfile)
} }
} }
/* handle a #elif directive by not changing if_stack either. see the /* Handle a #elif directive by not changing if_stack either. See the
comment above do_else. */ comment above do_else. */
static void static void
do_elif (pfile) do_elif (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1341,7 +1332,6 @@ do_elif (pfile) ...@@ -1341,7 +1332,6 @@ do_elif (pfile)
} }
/* #endif pops the if stack and resets pfile->state.skipping. */ /* #endif pops the if stack and resets pfile->state.skipping. */
static void static void
do_endif (pfile) do_endif (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1370,10 +1360,10 @@ do_endif (pfile) ...@@ -1370,10 +1360,10 @@ do_endif (pfile)
} }
} }
/* Push an if_stack entry and set pfile->state.skipping accordingly. /* Push an if_stack entry for a preprocessor conditional, and set
If this is a #if or #ifndef, CMACRO is a potentially controlling pfile->state.skipping to SKIP. If TYPE indicates the conditional
macro - we need to check here that we are at the top of the file. */ is #if or #ifndef, CMACRO is a potentially controlling macro, and
we need to check here that we are at the top of the file. */
static void static void
push_conditional (pfile, skip, type, cmacro) push_conditional (pfile, skip, type, cmacro)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1400,10 +1390,10 @@ push_conditional (pfile, skip, type, cmacro) ...@@ -1400,10 +1390,10 @@ push_conditional (pfile, skip, type, cmacro)
buffer->if_stack = ifs; buffer->if_stack = ifs;
} }
/* Read the tokens of the answer into the macro pool. Only commit the /* Read the tokens of the answer into the macro pool, in a directive
memory if we intend it as permanent storage, i.e. the #assert case. of type TYPE. Only commit the memory if we intend it as permanent
Returns 0 on success. */ storage, i.e. the #assert case. Returns 0 on success, and sets
ANSWERP to point to the answer. */
static int static int
parse_answer (pfile, answerp, type) parse_answer (pfile, answerp, type)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1480,9 +1470,9 @@ parse_answer (pfile, answerp, type) ...@@ -1480,9 +1470,9 @@ parse_answer (pfile, answerp, type)
return 0; return 0;
} }
/* Parses an assertion, returning a pointer to the hash node of the /* Parses an assertion directive of type TYPE, returning a pointer to
predicate, or 0 on error. If an answer was supplied, it is placed the hash node of the predicate, or 0 on error. If an answer was
in ANSWERP, otherwise it is set to 0. */ supplied, it is placed in ANSWERP, otherwise it is set to 0. */
static cpp_hashnode * static cpp_hashnode *
parse_assertion (pfile, answerp, type) parse_assertion (pfile, answerp, type)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1516,7 +1506,7 @@ parse_assertion (pfile, answerp, type) ...@@ -1516,7 +1506,7 @@ parse_assertion (pfile, answerp, type)
return result; return result;
} }
/* Returns a pointer to the pointer to the answer in the answer chain, /* Returns a pointer to the pointer to CANDIDATE in the answer chain,
or a pointer to NULL if the answer is not in the chain. */ or a pointer to NULL if the answer is not in the chain. */
static struct answer ** static struct answer **
find_answer (node, candidate) find_answer (node, candidate)
...@@ -1564,6 +1554,7 @@ _cpp_test_assertion (pfile, value) ...@@ -1564,6 +1554,7 @@ _cpp_test_assertion (pfile, value)
return node == 0; return node == 0;
} }
/* Handle #assert. */
static void static void
do_assert (pfile) do_assert (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1596,6 +1587,7 @@ do_assert (pfile) ...@@ -1596,6 +1587,7 @@ do_assert (pfile)
} }
} }
/* Handle #unassert. */
static void static void
do_unassert (pfile) do_unassert (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1635,7 +1627,6 @@ do_unassert (pfile) ...@@ -1635,7 +1627,6 @@ do_unassert (pfile)
If STR is just an identifier, define it with value 1. If STR is just an identifier, define it with value 1.
If STR has anything after the identifier, then it should If STR has anything after the identifier, then it should
be identifier=definition. */ be identifier=definition. */
void void
cpp_define (pfile, str) cpp_define (pfile, str)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1826,6 +1817,7 @@ _cpp_pop_buffer (pfile) ...@@ -1826,6 +1817,7 @@ _cpp_pop_buffer (pfile)
obstack_free (&pfile->buffer_ob, buffer); obstack_free (&pfile->buffer_ob, buffer);
} }
/* Enter all recognised directives in the hash table. */
void void
_cpp_init_directives (pfile) _cpp_init_directives (pfile)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -1833,7 +1825,6 @@ _cpp_init_directives (pfile) ...@@ -1833,7 +1825,6 @@ _cpp_init_directives (pfile)
unsigned int i; unsigned int i;
cpp_hashnode *node; cpp_hashnode *node;
/* Register the directives. */
for (i = 0; i < (unsigned int) N_DIRECTIVES; i++) for (i = 0; i < (unsigned int) N_DIRECTIVES; i++)
{ {
node = cpp_lookup (pfile, dtable[i].name, dtable[i].length); node = cpp_lookup (pfile, dtable[i].name, dtable[i].length);
......
/* Definitions for CPP library. /* Definitions for CPP library.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Per Bothner, 1994-95. Written by Per Bothner, 1994-95.
...@@ -152,7 +152,7 @@ enum cpp_ttype ...@@ -152,7 +152,7 @@ enum cpp_ttype
enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99, enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99,
CLK_GNUCXX, CLK_CXX98, CLK_OBJC, CLK_OBJCXX, CLK_ASM}; CLK_GNUCXX, CLK_CXX98, CLK_OBJC, CLK_OBJCXX, CLK_ASM};
/* Payload of a NUMBER, FLOAT, STRING, or COMMENT token. */ /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct cpp_string struct cpp_string
{ {
unsigned int len; unsigned int len;
......
/* Part of CPP library. (Macro and #define handling.) /* Part of CPP library. (Macro and #define handling.)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998, Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
1999, 2000, 2001 Free Software Foundation, Inc. 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994. Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986 Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987 Adapted to ANSI C, Richard Stallman, Jan 1987
......
/* CPP main program, using CPP Library. /* CPP main program, using CPP Library.
Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001 Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Per Bothner, 1994-95. Written by Per Bothner, 1994-95.
......
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