Commit 6cf87ca4 by Zack Weinberg

* cpplib.h, cpphash.h, cppcharset.c, cpperror.c, cppexp.c

	* cppfiles.c, cpphash.c, cppinit.c, cpplex.c, cpplib.c
	* cppmacro.c, cpppch.c, cpptrad.c, cppspec.c: Convert to
	ISO C: new-style function declarations, no need for PARAMS,
	no special punctuation on indirect function calls, use string
	constant concatenation where convenient.

From-SVN: r68070
parent 82620aaf
2003-06-16 Zack Weinberg <zack@codesourcery.com>
* cpplib.h, cpphash.h, cppcharset.c, cpperror.c, cppexp.c
* cppfiles.c, cpphash.c, cppinit.c, cpplex.c, cpplib.c
* cppmacro.c, cpppch.c, cpptrad.c, cppspec.c: Convert to
ISO C: new-style function declarations, no need for PARAMS,
no special punctuation on indirect function calls, use string
constant concatenation where convenient.
2003-06-17 Andreas Jaeger <aj@suse.de>
* rtl.h: Remove declarations from coverage.h.
......@@ -16,11 +25,11 @@
* config/sparc/aout.h, config/sparc/biarch64.h, config/sparc/elf.h,
config/sparc/freebsd.h, config/sparc/linux.h, config/sparc/linux64.h,
config/sparc/lite.h, config/sparc/litecoff.h, config/sparc/liteelf.h,
config/sparc/netbsd-elf.h, config/sparc/openbsd.h,
config/sparc/netbsd-elf.h, config/sparc/openbsd.h,
config/sparc/rtemself.h, config/sparc/sol2-64.h,
config/sparc/sol2-bi.h, config/sparc/sol2-gas-bi.h,
config/sparc/sol2-gld-bi.h, config/sparc/sol2-gld.h,
config/sparc/sol2.h, config/sparc/sp64-aout.h,
config/sparc/sol2.h, config/sparc/sp64-aout.h,
config/sparc/sp64-elf.h, config/sparc/sp86x-elf.h,
config/sparc/sparc-protos.h, config/sparc/sysv4-only.h: Replace
"GNU compiler", "GNU CC" with "GCC".
......@@ -82,7 +91,7 @@
* builtin-attrs.def, builtin-attrs.def, builtins.c, cpplex.c,
cpplib.c, gencheck.c, gengenrtl.c, machmode.def, protoize.c: Don't
use macros from "symcat.h", instead rely on ISO C.
* system.h: Don't include "symcat.h".
* configure.in (AC_C_STRINGIZE): Delete.
* config.in, configure: Regenerate.
......
......@@ -25,7 +25,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "cpplib.h"
#include "cpphash.h"
static int ucn_valid_in_identifier PARAMS ((cpp_reader *, cppchar_t));
static int ucn_valid_in_identifier (cpp_reader *, cppchar_t);
/* [lex.charset]: The character designated by the universal character
name \UNNNNNNNN is that character whose character short name in
......@@ -52,10 +52,7 @@ static int ucn_valid_in_identifier PARAMS ((cpp_reader *, cppchar_t));
*/
cppchar_t
_cpp_valid_ucn (pfile, pstr, identifier_pos)
cpp_reader *pfile;
const uchar **pstr;
int identifier_pos;
_cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, int identifier_pos)
{
cppchar_t result, c;
unsigned int length;
......@@ -128,9 +125,7 @@ _cpp_valid_ucn (pfile, pstr, identifier_pos)
identifier. We assume C has already gone through the checks of
_cpp_valid_ucn. */
static int
ucn_valid_in_identifier (pfile, c)
cpp_reader *pfile;
cppchar_t c;
ucn_valid_in_identifier (cpp_reader *pfile, cppchar_t c)
{
/* None of the valid chars are outside the Basic Multilingual Plane (the
low 16 bits). */
......
......@@ -31,16 +31,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cpphash.h"
#include "intl.h"
static void print_location PARAMS ((cpp_reader *, unsigned int, unsigned int));
static void print_location (cpp_reader *, unsigned int, unsigned int);
/* Print the logical file location (LINE, COL) in preparation for a
diagnostic. Outputs the #include chain if it has changed. A line
of zero suppresses the include stack, and outputs the program name
instead. */
static void
print_location (pfile, line, col)
cpp_reader *pfile;
unsigned int line, col;
print_location (cpp_reader *pfile, unsigned int line, unsigned int col)
{
if (!pfile->buffer || line == 0)
fprintf (stderr, "%s: ", progname);
......@@ -72,10 +70,8 @@ print_location (pfile, line, col)
the correct place by default. Returns 0 if the error has been
suppressed. */
int
_cpp_begin_message (pfile, code, line, column)
cpp_reader *pfile;
int code;
unsigned int line, column;
_cpp_begin_message (cpp_reader *pfile, int code, unsigned int line,
unsigned int column)
{
int level = DL_EXTRACT (code);
......@@ -177,10 +173,7 @@ cpp_error_with_line (cpp_reader *pfile, int level,
}
void
cpp_errno (pfile, level, msgid)
cpp_reader *pfile;
int level;
const char *msgid;
cpp_errno (cpp_reader *pfile, int level, const char *msgid)
{
if (msgid[0] == '\0')
msgid = _("stdout");
......
......@@ -30,13 +30,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cpplib.h"
#include "cpphash.h"
static cpp_hashnode *alloc_node PARAMS ((hash_table *));
static cpp_hashnode *alloc_node (hash_table *);
/* Return an identifier node for hashtable.c. Used by cpplib except
when integrated with the C front ends. */
static cpp_hashnode *
alloc_node (table)
hash_table *table;
alloc_node (hash_table *table)
{
cpp_hashnode *node;
......@@ -49,9 +48,7 @@ alloc_node (table)
/* Set up the identifier hash table. Use TABLE if non-null, otherwise
create our own. */
void
_cpp_init_hashtable (pfile, table)
cpp_reader *pfile;
hash_table *table;
_cpp_init_hashtable (cpp_reader *pfile, hash_table *table)
{
struct spec_nodes *s;
......@@ -59,7 +56,7 @@ _cpp_init_hashtable (pfile, table)
{
pfile->our_hashtable = 1;
table = ht_create (13); /* 8K (=2^13) entries. */
table->alloc_node = (hashnode (*) PARAMS ((hash_table *))) alloc_node;
table->alloc_node = (hashnode (*) (hash_table *)) alloc_node;
gcc_obstack_init (&pfile->hash_ob);
}
......@@ -80,8 +77,7 @@ _cpp_init_hashtable (pfile, table)
/* Tear down the identifier hash table. */
void
_cpp_destroy_hashtable (pfile)
cpp_reader *pfile;
_cpp_destroy_hashtable (cpp_reader *pfile)
{
if (pfile->our_hashtable)
{
......@@ -93,10 +89,7 @@ _cpp_destroy_hashtable (pfile)
/* Returns the hash entry for the STR of length LEN, creating one
if necessary. */
cpp_hashnode *
cpp_lookup (pfile, str, len)
cpp_reader *pfile;
const unsigned char *str;
unsigned int len;
cpp_lookup (cpp_reader *pfile, const unsigned char *str, unsigned int len)
{
/* ht_lookup cannot return NULL. */
return CPP_HASHNODE (ht_lookup (pfile->hash_table, str, len, HT_ALLOC));
......@@ -104,10 +97,7 @@ cpp_lookup (pfile, str, len)
/* Determine whether the str STR, of length LEN, is a defined macro. */
int
cpp_defined (pfile, str, len)
cpp_reader *pfile;
const unsigned char *str;
int len;
cpp_defined (cpp_reader *pfile, const unsigned char *str, int len)
{
cpp_hashnode *node;
......@@ -120,10 +110,7 @@ cpp_defined (pfile, str, len)
/* For all nodes in the hashtable, callback CB with parameters PFILE,
the node, and V. */
void
cpp_forall_identifiers (pfile, cb, v)
cpp_reader *pfile;
cpp_cb cb;
void *v;
cpp_forall_identifiers (cpp_reader *pfile, cpp_cb cb, void *v)
{
/* We don't need a proxy since the hash table's identifier comes
first in cpp_hashnode. */
......
......@@ -27,10 +27,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "cpphash.h"
#include "mkdeps.h"
static void init_library PARAMS ((void));
static void mark_named_operators PARAMS ((cpp_reader *));
static void read_original_filename PARAMS ((cpp_reader *));
static void post_options PARAMS ((cpp_reader *));
static void init_library (void);
static void mark_named_operators (cpp_reader *);
static void read_original_filename (cpp_reader *);
static void post_options (cpp_reader *);
/* If we have designated initializers (GCC >2.7) these tables can be
initialized, constant data. Otherwise, they have to be filled in at
......@@ -47,7 +47,7 @@ __extension__ const uchar _cpp_trigraph_map[UCHAR_MAX + 1] = {
#else
#define TRIGRAPH_MAP uchar _cpp_trigraph_map[UCHAR_MAX + 1] = { 0 }; \
static void init_trigraph_map PARAMS ((void)) { \
static void init_trigraph_map (void) { \
unsigned char *x = _cpp_trigraph_map;
#define END }
......@@ -91,9 +91,7 @@ static const struct lang_flags lang_defaults[] =
/* Sets internal flags correctly for a given language. */
void
cpp_set_lang (pfile, lang)
cpp_reader *pfile;
enum c_lang lang;
cpp_set_lang (cpp_reader *pfile, enum c_lang lang)
{
const struct lang_flags *l = &lang_defaults[(int) lang];
......@@ -110,7 +108,7 @@ cpp_set_lang (pfile, lang)
/* Initialize library global state. */
static void
init_library ()
init_library (void)
{
static int initialized = 0;
......@@ -127,9 +125,7 @@ init_library ()
/* Initialize a cpp_reader structure. */
cpp_reader *
cpp_create_reader (lang, table)
enum c_lang lang;
hash_table *table;
cpp_create_reader (enum c_lang lang, hash_table *table)
{
cpp_reader *pfile;
......@@ -205,8 +201,7 @@ cpp_create_reader (lang, table)
/* Free resources used by PFILE. Accessing PFILE after this function
returns leads to undefined behavior. Returns the error count. */
void
cpp_destroy (pfile)
cpp_reader *pfile;
cpp_destroy (cpp_reader *pfile)
{
cpp_context *context, *contextn;
tokenrun *run, *runn;
......@@ -309,8 +304,7 @@ static const struct builtin operator_array[] =
/* Mark the C++ named operators in the hash table. */
static void
mark_named_operators (pfile)
cpp_reader *pfile;
mark_named_operators (cpp_reader *pfile)
{
const struct builtin *b;
......@@ -329,9 +323,7 @@ mark_named_operators (pfile)
macros, into the hash table. HOSTED is true if this is a hosted
environment. */
void
cpp_init_builtins (pfile, hosted)
cpp_reader *pfile;
int hosted;
cpp_init_builtins (cpp_reader *pfile, int hosted)
{
const struct builtin *b;
size_t n = ARRAY_SIZE (builtin_array);
......@@ -368,9 +360,8 @@ cpp_init_builtins (pfile, hosted)
/* Sanity-checks are dependent on command-line options, so it is
called as a subroutine of cpp_read_main_file (). */
#if ENABLE_CHECKING
static void sanity_checks PARAMS ((cpp_reader *));
static void sanity_checks (pfile)
cpp_reader *pfile;
static void sanity_checks (cpp_reader *);
static void sanity_checks (cpp_reader *pfile)
{
cppchar_t test = 0;
size_t max_precision = 2 * CHAR_BIT * sizeof (cpp_num_part);
......@@ -383,7 +374,8 @@ static void sanity_checks (pfile)
if (CPP_OPTION (pfile, precision) > max_precision)
cpp_error (pfile, DL_ICE,
"preprocessor arithmetic has maximum precision of %lu bits; target requires %lu bits",
"preprocessor arithmetic has maximum precision of %lu bits;"
" target requires %lu bits",
(unsigned long) max_precision,
(unsigned long) CPP_OPTION (pfile, precision));
......@@ -408,7 +400,8 @@ static void sanity_checks (pfile)
if (CPP_OPTION (pfile, wchar_precision) > BITS_PER_CPPCHAR_T)
cpp_error (pfile, DL_ICE,
"CPP on this host cannot handle wide character constants over %lu bits, but the target requires %lu bits",
"CPP on this host cannot handle wide character constants over"
" %lu bits, but the target requires %lu bits",
(unsigned long) BITS_PER_CPPCHAR_T,
(unsigned long) CPP_OPTION (pfile, wchar_precision));
}
......@@ -420,10 +413,7 @@ static void sanity_checks (pfile)
cpp_read_main_file(). If no targets have been added before
cpp_read_main_file(), then the default target is used. */
void
cpp_add_dependency_target (pfile, target, quote)
cpp_reader *pfile;
const char *target;
int quote;
cpp_add_dependency_target (cpp_reader *pfile, const char *target, int quote)
{
if (!pfile->deps)
pfile->deps = deps_init ();
......@@ -436,9 +426,7 @@ cpp_add_dependency_target (pfile, target, quote)
or stdin if it is the empty string. Return the original filename
on success (e.g. foo.i->foo.c), or NULL on failure. */
const char *
cpp_read_main_file (pfile, fname)
cpp_reader *pfile;
const char *fname;
cpp_read_main_file (cpp_reader *pfile, const char *fname)
{
sanity_checks (pfile);
......@@ -480,8 +468,7 @@ cpp_read_main_file (pfile, fname)
generate file_change callbacks, which the front ends must handle
appropriately given their state of initialization. */
static void
read_original_filename (pfile)
cpp_reader *pfile;
read_original_filename (cpp_reader *pfile)
{
const cpp_token *token, *token1;
......@@ -512,9 +499,7 @@ read_original_filename (pfile)
Maybe it should also reset state, such that you could call
cpp_start_read with a new filename to restart processing. */
int
cpp_finish (pfile, deps_stream)
cpp_reader *pfile;
FILE *deps_stream;
cpp_finish (cpp_reader *pfile, FILE *deps_stream)
{
/* Warn about unused macros before popping the final buffer. */
if (CPP_OPTION (pfile, warn_unused_macros))
......@@ -546,8 +531,7 @@ cpp_finish (pfile, deps_stream)
}
static void
post_options (pfile)
cpp_reader *pfile;
post_options (cpp_reader *pfile)
{
/* -Wtraditional is not useful in C++ mode. */
if (CPP_OPTION (pfile, cplusplus))
......
......@@ -24,16 +24,16 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "hashtab.h"
#include "mkdeps.h"
static int write_macdef PARAMS ((cpp_reader *, cpp_hashnode *, void *));
static int save_idents PARAMS ((cpp_reader *, cpp_hashnode *, void *));
static hashval_t hashmem PARAMS ((const void *, size_t));
static hashval_t cpp_string_hash PARAMS ((const void *));
static int cpp_string_eq PARAMS ((const void *, const void *));
static int count_defs PARAMS ((cpp_reader *, cpp_hashnode *, void *));
static int comp_hashnodes PARAMS ((const void *, const void *));
static int collect_ht_nodes PARAMS ((cpp_reader *, cpp_hashnode *, void *));
static int write_defs PARAMS ((cpp_reader *, cpp_hashnode *, void *));
static int save_macros PARAMS ((cpp_reader *, cpp_hashnode *, void *));
static int write_macdef (cpp_reader *, cpp_hashnode *, void *);
static int save_idents (cpp_reader *, cpp_hashnode *, void *);
static hashval_t hashmem (const void *, size_t);
static hashval_t cpp_string_hash (const void *);
static int cpp_string_eq (const void *, const void *);
static int count_defs (cpp_reader *, cpp_hashnode *, void *);
static int comp_hashnodes (const void *, const void *);
static int collect_ht_nodes (cpp_reader *, cpp_hashnode *, void *);
static int write_defs (cpp_reader *, cpp_hashnode *, void *);
static int save_macros (cpp_reader *, cpp_hashnode *, void *);
/* This structure represents a macro definition on disk. */
struct macrodef_struct
......@@ -47,10 +47,7 @@ struct macrodef_struct
Suitable for being called by cpp_forall_identifiers. */
static int
write_macdef (pfile, hn, file_p)
cpp_reader *pfile;
cpp_hashnode *hn;
void *file_p;
write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
{
FILE *f = (FILE *) file_p;
switch (hn->type)
......@@ -123,10 +120,7 @@ struct cpp_savedstate
put the definition in 'definedstrs'. */
static int
save_idents (pfile, hn, ss_p)
cpp_reader *pfile ATTRIBUTE_UNUSED;
cpp_hashnode *hn;
void *ss_p;
save_idents (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
{
struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p;
......@@ -158,9 +152,7 @@ save_idents (pfile, hn, ss_p)
/* Hash some memory in a generic way. */
static hashval_t
hashmem (p_p, sz)
const void *p_p;
size_t sz;
hashmem (const void *p_p, size_t sz)
{
const unsigned char *p = (const unsigned char *)p_p;
size_t i;
......@@ -175,8 +167,7 @@ hashmem (p_p, sz)
/* Hash a cpp string for the hashtable machinery. */
static hashval_t
cpp_string_hash (a_p)
const void *a_p;
cpp_string_hash (const void *a_p)
{
const struct cpp_string *a = (const struct cpp_string *) a_p;
return hashmem (a->text, a->len);
......@@ -185,9 +176,7 @@ cpp_string_hash (a_p)
/* Compare two cpp strings for the hashtable machinery. */
static int
cpp_string_eq (a_p, b_p)
const void *a_p;
const void *b_p;
cpp_string_eq (const void *a_p, const void *b_p)
{
const struct cpp_string *a = (const struct cpp_string *) a_p;
const struct cpp_string *b = (const struct cpp_string *) b_p;
......@@ -201,9 +190,7 @@ cpp_string_eq (a_p, b_p)
would be called when reading the precompiled header back in. */
int
cpp_save_state (r, f)
cpp_reader *r;
FILE *f;
cpp_save_state (cpp_reader *r, FILE *f)
{
/* Save the list of non-void identifiers for the dependency checking. */
r->savedstate = xmalloc (sizeof (struct cpp_savedstate));
......@@ -220,10 +207,7 @@ cpp_save_state (r, f)
/* Calculate the 'hashsize' field of the saved state. */
static int
count_defs (pfile, hn, ss_p)
cpp_reader *pfile ATTRIBUTE_UNUSED;
cpp_hashnode *hn;
void *ss_p;
count_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
{
struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p;
......@@ -262,10 +246,7 @@ count_defs (pfile, hn, ss_p)
/* Collect the identifiers into the state's string table. */
static int
write_defs (pfile, hn, ss_p)
cpp_reader *pfile ATTRIBUTE_UNUSED;
cpp_hashnode *hn;
void *ss_p;
write_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
{
struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p;
......@@ -305,9 +286,7 @@ write_defs (pfile, hn, ss_p)
/* Comparison function for qsort. The arguments point to pointers of
type ht_hashnode *. */
static int
comp_hashnodes (px, py)
const void *px;
const void *py;
comp_hashnodes (const void *px, const void *py)
{
cpp_hashnode *x = *(cpp_hashnode **) px;
cpp_hashnode *y = *(cpp_hashnode **) py;
......@@ -318,9 +297,7 @@ comp_hashnodes (px, py)
called after the PCH is ready to be saved. */
int
cpp_write_pch_deps (r, f)
cpp_reader *r;
FILE *f;
cpp_write_pch_deps (cpp_reader *r, FILE *f)
{
struct macrodef_struct z;
struct cpp_savedstate *const ss = r->savedstate;
......@@ -367,9 +344,7 @@ cpp_write_pch_deps (r, f)
cpp_read_state. */
int
cpp_write_pch_state (r, f)
cpp_reader *r;
FILE *f;
cpp_write_pch_state (cpp_reader *r, FILE *f)
{
struct macrodef_struct z;
......@@ -410,10 +385,8 @@ struct ht_node_list
/* Callback for collecting identifiers from hash table */
static int
collect_ht_nodes (pfile, hn, nl_p)
cpp_reader *pfile ATTRIBUTE_UNUSED;
cpp_hashnode *hn;
void *nl_p;
collect_ht_nodes (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn,
void *nl_p)
{
struct ht_node_list *const nl = (struct ht_node_list *)nl_p;
......@@ -446,10 +419,7 @@ collect_ht_nodes (pfile, hn, nl_p)
*/
int
cpp_valid_state (r, name, fd)
cpp_reader *r;
const char *name;
int fd;
cpp_valid_state (cpp_reader *r, const char *name, int fd)
{
struct macrodef_struct m;
size_t namebufsz = 256;
......@@ -583,10 +553,7 @@ struct save_macro_data
a PCH restore. */
static int
save_macros (r, h, data_p)
cpp_reader *r ATTRIBUTE_UNUSED;
cpp_hashnode *h;
void *data_p;
save_macros (cpp_reader *r ATTRIBUTE_UNUSED, cpp_hashnode *h, void *data_p)
{
struct save_macro_data *data = (struct save_macro_data *)data_p;
if (h->type != NT_VOID
......@@ -614,9 +581,7 @@ save_macros (r, h, data_p)
macros in 'data'. */
void
cpp_prepare_state (r, data)
cpp_reader *r;
struct save_macro_data **data;
cpp_prepare_state (cpp_reader *r, struct save_macro_data **data)
{
struct save_macro_data *d = xmalloc (sizeof (struct save_macro_data));
......@@ -632,11 +597,8 @@ cpp_prepare_state (r, data)
DEPNAME is passed to deps_restore. */
int
cpp_read_state (r, name, f, data)
cpp_reader *r;
const char *name;
FILE *f;
struct save_macro_data *data;
cpp_read_state (cpp_reader *r, const char *name, FILE *f,
struct save_macro_data *data)
{
struct macrodef_struct m;
size_t defnlen = 256;
......
......@@ -51,10 +51,8 @@ static const char *const known_suffixes[] =
/* Filter argc and argv before processing by the gcc driver proper. */
void
lang_specific_driver (in_argc, in_argv, in_added_libraries)
int *in_argc;
const char *const **in_argv;
int *in_added_libraries ATTRIBUTE_UNUSED;
lang_specific_driver (int *in_argc, const char *const **in_argv,
int *in_added_libraries ATTRIBUTE_UNUSED)
{
int argc = *in_argc;
const char *const *argv = *in_argv;
......@@ -203,7 +201,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
}
/* Called before linking. Returns 0 on success and -1 on failure. */
int lang_specific_pre_link ()
int lang_specific_pre_link (void)
{
return 0; /* Not used for cpp. */
}
......
......@@ -81,29 +81,24 @@ enum ls {ls_none = 0, /* Normal state. */
/* Lexing TODO: Maybe handle space in escaped newlines. Stop cpplex.c
from recognizing comments and directives during its lexing pass. */
static const uchar *skip_whitespace PARAMS ((cpp_reader *, const uchar *,
int));
static cpp_hashnode *lex_identifier PARAMS ((cpp_reader *, const uchar *));
static const uchar *copy_comment PARAMS ((cpp_reader *, const uchar *, int));
static void check_output_buffer PARAMS ((cpp_reader *, size_t));
static void push_replacement_text PARAMS ((cpp_reader *, cpp_hashnode *));
static bool scan_parameters PARAMS ((cpp_reader *, cpp_macro *));
static bool recursive_macro PARAMS ((cpp_reader *, cpp_hashnode *));
static void save_replacement_text PARAMS ((cpp_reader *, cpp_macro *,
unsigned int));
static void maybe_start_funlike PARAMS ((cpp_reader *, cpp_hashnode *,
const uchar *, struct fun_macro *));
static void save_argument PARAMS ((struct fun_macro *, size_t));
static void replace_args_and_push PARAMS ((cpp_reader *, struct fun_macro *));
static size_t canonicalize_text PARAMS ((uchar *, const uchar *, size_t,
uchar *));
static const uchar *skip_whitespace (cpp_reader *, const uchar *, int);
static cpp_hashnode *lex_identifier (cpp_reader *, const uchar *);
static const uchar *copy_comment (cpp_reader *, const uchar *, int);
static void check_output_buffer (cpp_reader *, size_t);
static void push_replacement_text (cpp_reader *, cpp_hashnode *);
static bool scan_parameters (cpp_reader *, cpp_macro *);
static bool recursive_macro (cpp_reader *, cpp_hashnode *);
static void save_replacement_text (cpp_reader *, cpp_macro *, unsigned int);
static void maybe_start_funlike (cpp_reader *, cpp_hashnode *, const uchar *,
struct fun_macro *);
static void save_argument (struct fun_macro *, size_t);
static void replace_args_and_push (cpp_reader *, struct fun_macro *);
static size_t canonicalize_text (uchar *, const uchar *, size_t, uchar *);
/* Ensures we have N bytes' space in the output buffer, and
reallocates it if not. */
static void
check_output_buffer (pfile, n)
cpp_reader *pfile;
size_t n;
check_output_buffer (cpp_reader *pfile, size_t n)
{
/* We might need two bytes to terminate an unterminated comment, and
one more to terminate the line with a NUL. */
......@@ -134,10 +129,7 @@ check_output_buffer (pfile, n)
Returns a pointer to the first character after the comment in the
input buffer. */
static const uchar *
copy_comment (pfile, cur, in_define)
cpp_reader *pfile;
const uchar *cur;
int in_define;
copy_comment (cpp_reader *pfile, const uchar *cur, int in_define)
{
bool unterminated, copy = false;
unsigned int from_line = pfile->line;
......@@ -197,10 +189,7 @@ copy_comment (pfile, cur, in_define)
Returns a pointer to the first character after the whitespace in
the input buffer. */
static const uchar *
skip_whitespace (pfile, cur, skip_comments)
cpp_reader *pfile;
const uchar *cur;
int skip_comments;
skip_whitespace (cpp_reader *pfile, const uchar *cur, int skip_comments)
{
uchar *out = pfile->out.cur;
......@@ -232,9 +221,7 @@ skip_whitespace (pfile, cur, skip_comments)
to point to a valid first character of an identifier. Returns
the hashnode, and updates out.cur. */
static cpp_hashnode *
lex_identifier (pfile, cur)
cpp_reader *pfile;
const uchar *cur;
lex_identifier (cpp_reader *pfile, const uchar *cur)
{
size_t len;
uchar *out = pfile->out.cur;
......@@ -256,10 +243,7 @@ lex_identifier (pfile, cur)
starting at START. The true buffer is restored upon calling
restore_buff(). */
void
_cpp_overlay_buffer (pfile, start, len)
cpp_reader *pfile;
const uchar *start;
size_t len;
_cpp_overlay_buffer (cpp_reader *pfile, const uchar *start, size_t len)
{
cpp_buffer *buffer = pfile->buffer;
......@@ -276,8 +260,7 @@ _cpp_overlay_buffer (pfile, start, len)
/* Restores a buffer overlaid by _cpp_overlay_buffer(). */
void
_cpp_remove_overlay (pfile)
cpp_reader *pfile;
_cpp_remove_overlay (cpp_reader *pfile)
{
cpp_buffer *buffer = pfile->overlaid_buffer;
......@@ -292,8 +275,7 @@ _cpp_remove_overlay (pfile)
/* Reads a logical line into the output buffer. Returns TRUE if there
is more text left in the buffer. */
bool
_cpp_read_logical_line_trad (pfile)
cpp_reader *pfile;
_cpp_read_logical_line_trad (cpp_reader *pfile)
{
do
{
......@@ -308,11 +290,7 @@ _cpp_read_logical_line_trad (pfile)
/* Set up state for finding the opening '(' of a function-like
macro. */
static void
maybe_start_funlike (pfile, node, start, macro)
cpp_reader *pfile;
cpp_hashnode *node;
const uchar *start;
struct fun_macro *macro;
maybe_start_funlike (cpp_reader *pfile, cpp_hashnode *node, const uchar *start, struct fun_macro *macro)
{
unsigned int n = node->value.macro->paramc + 1;
......@@ -327,9 +305,7 @@ maybe_start_funlike (pfile, node, start, macro)
/* Save the OFFSET of the start of the next argument to MACRO. */
static void
save_argument (macro, offset)
struct fun_macro *macro;
size_t offset;
save_argument (struct fun_macro *macro, size_t offset)
{
macro->argc++;
if (macro->argc <= macro->node->value.macro->paramc)
......@@ -344,9 +320,7 @@ save_argument (macro, offset)
MACRO, and we call save_replacement_text() every time we meet an
argument. */
bool
scan_out_logical_line (pfile, macro)
cpp_reader *pfile;
cpp_macro *macro;
scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
{
bool result = true;
cpp_context *context;
......@@ -683,9 +657,7 @@ scan_out_logical_line (pfile, macro)
the context stack. NODE is either object-like, or a function-like
macro with no arguments. */
static void
push_replacement_text (pfile, node)
cpp_reader *pfile;
cpp_hashnode *node;
push_replacement_text (cpp_reader *pfile, cpp_hashnode *node)
{
size_t len;
const uchar *text;
......@@ -713,9 +685,7 @@ push_replacement_text (pfile, node)
/* Returns TRUE if traditional macro recursion is detected. */
static bool
recursive_macro (pfile, node)
cpp_reader *pfile;
cpp_hashnode *node;
recursive_macro (cpp_reader *pfile, cpp_hashnode *node)
{
bool recursing = !!(node->flags & NODE_DISABLED);
......@@ -756,8 +726,7 @@ recursive_macro (pfile, node)
/* Return the length of the replacement text of a function-like or
object-like non-builtin macro. */
size_t
_cpp_replacement_text_len (macro)
const cpp_macro *macro;
_cpp_replacement_text_len (const cpp_macro *macro)
{
size_t len;
......@@ -787,9 +756,7 @@ _cpp_replacement_text_len (macro)
sufficient size. It is not NUL-terminated. The next character is
returned. */
uchar *
_cpp_copy_replacement_text (macro, dest)
const cpp_macro *macro;
uchar *dest;
_cpp_copy_replacement_text (const cpp_macro *macro, uchar *dest)
{
if (macro->fun_like && (macro->paramc != 0))
{
......@@ -823,9 +790,7 @@ _cpp_copy_replacement_text (macro, dest)
the context stack. NODE is either object-like, or a function-like
macro with no arguments. */
static void
replace_args_and_push (pfile, fmacro)
cpp_reader *pfile;
struct fun_macro *fmacro;
replace_args_and_push (cpp_reader *pfile, struct fun_macro *fmacro)
{
cpp_macro *macro = fmacro->node->value.macro;
......@@ -889,9 +854,7 @@ replace_args_and_push (pfile, fmacro)
duplicate parameter). On success, CUR (pfile->context) is just
past the closing parenthesis. */
static bool
scan_parameters (pfile, macro)
cpp_reader *pfile;
cpp_macro *macro;
scan_parameters (cpp_reader *pfile, cpp_macro *macro)
{
const uchar *cur = CUR (pfile->context) + 1;
bool ok;
......@@ -930,10 +893,8 @@ scan_parameters (pfile, macro)
ARG_INDEX, with zero indicating the end of the replacement
text. */
static void
save_replacement_text (pfile, macro, arg_index)
cpp_reader *pfile;
cpp_macro *macro;
unsigned int arg_index;
save_replacement_text (cpp_reader *pfile, cpp_macro *macro,
unsigned int arg_index)
{
size_t len = pfile->out.cur - pfile->out.base;
uchar *exp;
......@@ -981,9 +942,7 @@ save_replacement_text (pfile, macro, arg_index)
/* Analyze and save the replacement text of a macro. Returns true on
success. */
bool
_cpp_create_trad_definition (pfile, macro)
cpp_reader *pfile;
cpp_macro *macro;
_cpp_create_trad_definition (cpp_reader *pfile, cpp_macro *macro)
{
const uchar *cur;
uchar *limit;
......@@ -1040,11 +999,7 @@ _cpp_create_trad_definition (pfile, macro)
quote currently in effect is pointed to by PQUOTE, and is updated
by the function. Returns the number of bytes copied. */
static size_t
canonicalize_text (dest, src, len, pquote)
uchar *dest;
const uchar *src;
size_t len;
uchar *pquote;
canonicalize_text (uchar *dest, const uchar *src, size_t len, uchar *pquote)
{
uchar *orig_dest = dest;
uchar quote = *pquote;
......@@ -1078,8 +1033,8 @@ canonicalize_text (dest, src, len, pquote)
/* Returns true if MACRO1 and MACRO2 have expansions different other
than in the form of their whitespace. */
bool
_cpp_expansions_different_trad (macro1, macro2)
const cpp_macro *macro1, *macro2;
_cpp_expansions_different_trad (const cpp_macro *macro1,
const cpp_macro *macro2)
{
uchar *p1 = xmalloc (macro1->count + macro2->count);
uchar *p2 = p1 + macro1->count;
......
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