diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2003-06-17 06:17:44 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2003-06-17 06:17:44 +0000 |
commit | 6cf87ca4e574edb0bf2bcb2cf396adb6e040311d (patch) | |
tree | aba39e5edc2926935bd59dd4f66f9b3d59447d19 | |
parent | 82620aaf0b59eead65b65bbaa3db5606df4027f9 (diff) | |
download | gcc-6cf87ca4e574edb0bf2bcb2cf396adb6e040311d.zip gcc-6cf87ca4e574edb0bf2bcb2cf396adb6e040311d.tar.gz gcc-6cf87ca4e574edb0bf2bcb2cf396adb6e040311d.tar.bz2 |
* 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
-rw-r--r-- | gcc/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/cppcharset.c | 11 | ||||
-rw-r--r-- | gcc/cpperror.c | 17 | ||||
-rw-r--r-- | gcc/cppexp.c | 173 | ||||
-rw-r--r-- | gcc/cppfiles.c | 175 | ||||
-rw-r--r-- | gcc/cpphash.c | 29 | ||||
-rw-r--r-- | gcc/cpphash.h | 172 | ||||
-rw-r--r-- | gcc/cppinit.c | 60 | ||||
-rw-r--r-- | gcc/cpplex.c | 214 | ||||
-rw-r--r-- | gcc/cpplib.c | 396 | ||||
-rw-r--r-- | gcc/cpplib.h | 174 | ||||
-rw-r--r-- | gcc/cppmacro.c | 213 | ||||
-rw-r--r-- | gcc/cpppch.c | 94 | ||||
-rw-r--r-- | gcc/cppspec.c | 8 | ||||
-rw-r--r-- | gcc/cpptrad.c | 115 |
15 files changed, 656 insertions, 1210 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a8ce5fa..1bf4347 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +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. diff --git a/gcc/cppcharset.c b/gcc/cppcharset.c index b11e642..f506ba2 100644 --- a/gcc/cppcharset.c +++ b/gcc/cppcharset.c @@ -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). */ diff --git a/gcc/cpperror.c b/gcc/cpperror.c index 9f5a539..cb681f0 100644 --- a/gcc/cpperror.c +++ b/gcc/cpperror.c @@ -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"); diff --git a/gcc/cppexp.c b/gcc/cppexp.c index bb74d1a..16082ef 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -40,34 +40,31 @@ struct op /* Some simple utility routines on double integers. */ #define num_zerop(num) ((num.low | num.high) == 0) #define num_eq(num1, num2) (num1.low == num2.low && num1.high == num2.high) -static bool num_positive PARAMS ((cpp_num, size_t)); -static bool num_greater_eq PARAMS ((cpp_num, cpp_num, size_t)); -static cpp_num num_trim PARAMS ((cpp_num, size_t)); -static cpp_num num_part_mul PARAMS ((cpp_num_part, cpp_num_part)); - -static cpp_num num_unary_op PARAMS ((cpp_reader *, cpp_num, enum cpp_ttype)); -static cpp_num num_binary_op PARAMS ((cpp_reader *, cpp_num, cpp_num, - enum cpp_ttype)); -static cpp_num num_negate PARAMS ((cpp_num, size_t)); -static cpp_num num_bitwise_op PARAMS ((cpp_reader *, cpp_num, cpp_num, - enum cpp_ttype)); -static cpp_num num_inequality_op PARAMS ((cpp_reader *, cpp_num, cpp_num, - enum cpp_ttype)); -static cpp_num num_equality_op PARAMS ((cpp_reader *, cpp_num, cpp_num, - enum cpp_ttype)); -static cpp_num num_mul PARAMS ((cpp_reader *, cpp_num, cpp_num)); -static cpp_num num_div_op PARAMS ((cpp_reader *, cpp_num, cpp_num, - enum cpp_ttype)); -static cpp_num num_lshift PARAMS ((cpp_num, size_t, size_t)); -static cpp_num num_rshift PARAMS ((cpp_num, size_t, size_t)); - -static cpp_num append_digit PARAMS ((cpp_num, int, int, size_t)); -static cpp_num parse_defined PARAMS ((cpp_reader *)); -static cpp_num eval_token PARAMS ((cpp_reader *, const cpp_token *)); -static struct op *reduce PARAMS ((cpp_reader *, struct op *, enum cpp_ttype)); -static unsigned int interpret_float_suffix PARAMS ((const uchar *, size_t)); -static unsigned int interpret_int_suffix PARAMS ((const uchar *, size_t)); -static void check_promotion PARAMS ((cpp_reader *, const struct op *)); +static bool num_positive (cpp_num, size_t); +static bool num_greater_eq (cpp_num, cpp_num, size_t); +static cpp_num num_trim (cpp_num, size_t); +static cpp_num num_part_mul (cpp_num_part, cpp_num_part); + +static cpp_num num_unary_op (cpp_reader *, cpp_num, enum cpp_ttype); +static cpp_num num_binary_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype); +static cpp_num num_negate (cpp_num, size_t); +static cpp_num num_bitwise_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype); +static cpp_num num_inequality_op (cpp_reader *, cpp_num, cpp_num, + enum cpp_ttype); +static cpp_num num_equality_op (cpp_reader *, cpp_num, cpp_num, + enum cpp_ttype); +static cpp_num num_mul (cpp_reader *, cpp_num, cpp_num); +static cpp_num num_div_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype); +static cpp_num num_lshift (cpp_num, size_t, size_t); +static cpp_num num_rshift (cpp_num, size_t, size_t); + +static cpp_num append_digit (cpp_num, int, int, size_t); +static cpp_num parse_defined (cpp_reader *); +static cpp_num eval_token (cpp_reader *, const cpp_token *); +static struct op *reduce (cpp_reader *, struct op *, enum cpp_ttype); +static unsigned int interpret_float_suffix (const uchar *, size_t); +static unsigned int interpret_int_suffix (const uchar *, size_t); +static void check_promotion (cpp_reader *, const struct op *); /* Token type abuse to create unary plus and minus operators. */ #define CPP_UPLUS (CPP_LAST_CPP_OP + 1) @@ -84,9 +81,7 @@ static void check_promotion PARAMS ((cpp_reader *, const struct op *)); length LEN, possibly zero. Returns 0 for an invalid suffix, or a flag vector describing the suffix. */ static unsigned int -interpret_float_suffix (s, len) - const uchar *s; - size_t len; +interpret_float_suffix (const uchar *s, size_t len) { size_t f = 0, l = 0, i = 0; @@ -113,9 +108,7 @@ interpret_float_suffix (s, len) of length LEN, possibly zero. Returns 0 for an invalid suffix, or a flag vector describing the suffix. */ static unsigned int -interpret_int_suffix (s, len) - const uchar *s; - size_t len; +interpret_int_suffix (const uchar *s, size_t len) { size_t u, l, i; @@ -149,9 +142,7 @@ interpret_int_suffix (s, len) floating point, or invalid), radix (decimal, octal, hexadecimal), and type suffixes. */ unsigned int -cpp_classify_number (pfile, token) - cpp_reader *pfile; - const cpp_token *token; +cpp_classify_number (cpp_reader *pfile, const cpp_token *token) { const uchar *str = token->val.str.text; const uchar *limit; @@ -314,13 +305,11 @@ cpp_classify_number (pfile, token) of precision options->precision. We do not provide any interface for decimal->float conversion, - because the preprocessor doesn't need it and the floating point - handling in GCC proper is too ugly to speak of. */ + because the preprocessor doesn't need it and we don't want to + drag in GCC's floating point emulator. */ cpp_num -cpp_interpret_integer (pfile, token, type) - cpp_reader *pfile; - const cpp_token *token; - unsigned int type; +cpp_interpret_integer (cpp_reader *pfile, const cpp_token *token, + unsigned int type) { const uchar *p, *end; cpp_num result; @@ -403,13 +392,9 @@ cpp_interpret_integer (pfile, token, type) return result; } -/* Append DIGIT to NUM, a number of PRECISION bits being read in base - BASE. */ +/* Append DIGIT to NUM, a number of PRECISION bits being read in base BASE. */ static cpp_num -append_digit (num, digit, base, precision) - cpp_num num; - int digit, base; - size_t precision; +append_digit (cpp_num num, int digit, int base, size_t precision) { cpp_num result; unsigned int shift = 3 + (base == 16); @@ -458,8 +443,7 @@ append_digit (num, digit, base, precision) /* Handle meeting "defined" in a preprocessor expression. */ static cpp_num -parse_defined (pfile) - cpp_reader *pfile; +parse_defined (cpp_reader *pfile) { cpp_num result; int paren = 0; @@ -529,9 +513,7 @@ parse_defined (pfile) number or character constant, or the result of the "defined" or "#" operators). */ static cpp_num -eval_token (pfile, token) - cpp_reader *pfile; - const cpp_token *token; +eval_token (cpp_reader *pfile, const cpp_token *token) { cpp_num result; unsigned int temp; @@ -695,8 +677,7 @@ static const struct operator stored in the 'value' field of the stack element of the operator that precedes it. */ bool -_cpp_parse_expr (pfile) - cpp_reader *pfile; +_cpp_parse_expr (cpp_reader *pfile) { struct op *top = pfile->op_stack; unsigned int lex_count; @@ -838,10 +819,7 @@ _cpp_parse_expr (pfile) pushing operator OP. Returns NULL on error, otherwise the top of the stack. */ static struct op * -reduce (pfile, top, op) - cpp_reader *pfile; - struct op *top; - enum cpp_ttype op; +reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op) { unsigned int prio; @@ -985,8 +963,7 @@ reduce (pfile, top, op) /* Returns the position of the old top of stack after expansion. */ struct op * -_cpp_expand_op_stack (pfile) - cpp_reader *pfile; +_cpp_expand_op_stack (cpp_reader *pfile) { size_t old_size = (size_t) (pfile->op_limit - pfile->op_stack); size_t new_size = old_size * 2 + 20; @@ -1001,9 +978,7 @@ _cpp_expand_op_stack (pfile) /* Emits a warning if the effective sign of either operand of OP changes because of integer promotions. */ static void -check_promotion (pfile, op) - cpp_reader *pfile; - const struct op *op; +check_promotion (cpp_reader *pfile, const struct op *op) { if (op->value.unsignedp == op[-1].value.unsignedp) return; @@ -1023,9 +998,7 @@ check_promotion (pfile, op) /* Clears the unused high order bits of the number pointed to by PNUM. */ static cpp_num -num_trim (num, precision) - cpp_num num; - size_t precision; +num_trim (cpp_num num, size_t precision) { if (precision > PART_PRECISION) { @@ -1045,9 +1018,7 @@ num_trim (num, precision) /* True iff A (presumed signed) >= 0. */ static bool -num_positive (num, precision) - cpp_num num; - size_t precision; +num_positive (cpp_num num, size_t precision) { if (precision > PART_PRECISION) { @@ -1061,9 +1032,7 @@ num_positive (num, precision) /* Sign extend a number, with PRECISION significant bits and all others assumed clear, to fill out a cpp_num structure. */ cpp_num -cpp_num_sign_extend (num, precision) - cpp_num num; - size_t precision; +cpp_num_sign_extend (cpp_num num, size_t precision) { if (!num.unsignedp) { @@ -1087,9 +1056,7 @@ cpp_num_sign_extend (num, precision) /* Returns the negative of NUM. */ static cpp_num -num_negate (num, precision) - cpp_num num; - size_t precision; +num_negate (cpp_num num, size_t precision) { cpp_num copy; @@ -1106,9 +1073,7 @@ num_negate (num, precision) /* Returns true if A >= B. */ static bool -num_greater_eq (pa, pb, precision) - cpp_num pa, pb; - size_t precision; +num_greater_eq (cpp_num pa, cpp_num pb, size_t precision) { bool unsignedp; @@ -1131,10 +1096,8 @@ num_greater_eq (pa, pb, precision) /* Returns LHS OP RHS, where OP is a bit-wise operation. */ static cpp_num -num_bitwise_op (pfile, lhs, rhs, op) - cpp_reader *pfile ATTRIBUTE_UNUSED; - cpp_num lhs, rhs; - enum cpp_ttype op; +num_bitwise_op (cpp_reader *pfile ATTRIBUTE_UNUSED, + cpp_num lhs, cpp_num rhs, enum cpp_ttype op) { lhs.overflow = false; lhs.unsignedp = lhs.unsignedp || rhs.unsignedp; @@ -1162,10 +1125,8 @@ num_bitwise_op (pfile, lhs, rhs, op) /* Returns LHS OP RHS, where OP is an inequality. */ static cpp_num -num_inequality_op (pfile, lhs, rhs, op) - cpp_reader *pfile; - cpp_num lhs, rhs; - enum cpp_ttype op; +num_inequality_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, + enum cpp_ttype op) { bool gte = num_greater_eq (lhs, rhs, CPP_OPTION (pfile, precision)); @@ -1186,10 +1147,8 @@ num_inequality_op (pfile, lhs, rhs, op) /* Returns LHS OP RHS, where OP is == or !=. */ static cpp_num -num_equality_op (pfile, lhs, rhs, op) - cpp_reader *pfile ATTRIBUTE_UNUSED; - cpp_num lhs, rhs; - enum cpp_ttype op; +num_equality_op (cpp_reader *pfile ATTRIBUTE_UNUSED, + cpp_num lhs, cpp_num rhs, enum cpp_ttype op) { /* Work around a 3.0.4 bug; see PR 6950. */ bool eq = num_eq (lhs, rhs); @@ -1204,9 +1163,7 @@ num_equality_op (pfile, lhs, rhs, op) /* Shift NUM, of width PRECISION, right by N bits. */ static cpp_num -num_rshift (num, precision, n) - cpp_num num; - size_t precision, n; +num_rshift (cpp_num num, size_t precision, size_t n) { cpp_num_part sign_mask; @@ -1246,9 +1203,7 @@ num_rshift (num, precision, n) /* Shift NUM, of width PRECISION, left by N bits. */ static cpp_num -num_lshift (num, precision, n) - cpp_num num; - size_t precision, n; +num_lshift (cpp_num num, size_t precision, size_t n) { if (n >= precision) { @@ -1288,10 +1243,7 @@ num_lshift (num, precision, n) /* The four unary operators: +, -, ! and ~. */ static cpp_num -num_unary_op (pfile, num, op) - cpp_reader *pfile; - cpp_num num; - enum cpp_ttype op; +num_unary_op (cpp_reader *pfile, cpp_num num, enum cpp_ttype op) { switch (op) { @@ -1326,10 +1278,7 @@ num_unary_op (pfile, num, op) /* The various binary operators. */ static cpp_num -num_binary_op (pfile, lhs, rhs, op) - cpp_reader *pfile; - cpp_num lhs, rhs; - enum cpp_ttype op; +num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op) { cpp_num result; size_t precision = CPP_OPTION (pfile, precision); @@ -1411,8 +1360,7 @@ num_binary_op (pfile, lhs, rhs, op) /* Multiplies two unsigned cpp_num_parts to give a cpp_num. This cannot overflow. */ static cpp_num -num_part_mul (lhs, rhs) - cpp_num_part lhs, rhs; +num_part_mul (cpp_num_part lhs, cpp_num_part rhs) { cpp_num result; cpp_num_part middle[2], temp; @@ -1442,9 +1390,7 @@ num_part_mul (lhs, rhs) /* Multiply two preprocessing numbers. */ static cpp_num -num_mul (pfile, lhs, rhs) - cpp_reader *pfile; - cpp_num lhs, rhs; +num_mul (cpp_reader *pfile, cpp_num lhs, cpp_num rhs) { cpp_num result, temp; bool unsignedp = lhs.unsignedp || rhs.unsignedp; @@ -1494,10 +1440,7 @@ num_mul (pfile, lhs, rhs) /* Divide two preprocessing numbers, returning the answer or the remainder depending upon OP. */ static cpp_num -num_div_op (pfile, lhs, rhs, op) - cpp_reader *pfile; - cpp_num lhs, rhs; - enum cpp_ttype op; +num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op) { cpp_num result, sub; cpp_num_part mask; diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 5a284d4..cd6fd6c 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -86,31 +86,24 @@ struct include_file { #define NO_INCLUDE_PATH ((struct include_file *) -1) #define INCLUDE_PCH_P(F) (((F)->pch & 1) != 0) -static struct file_name_map *read_name_map - PARAMS ((cpp_reader *, const char *)); -static char *read_filename_string PARAMS ((int, FILE *)); -static char *remap_filename PARAMS ((cpp_reader *, char *, - struct cpp_path *)); -static struct cpp_path *search_from PARAMS ((cpp_reader *, - enum include_type)); -static struct include_file * - find_include_file PARAMS ((cpp_reader *, const char *, int, - enum include_type)); -static struct include_file *open_file PARAMS ((cpp_reader *, const char *)); -static struct include_file *validate_pch PARAMS ((cpp_reader *, - const char *, - const char *)); -static struct include_file *open_file_pch PARAMS ((cpp_reader *, - const char *)); -static int read_include_file PARAMS ((cpp_reader *, struct include_file *)); -static bool stack_include_file PARAMS ((cpp_reader *, struct include_file *)); -static void purge_cache PARAMS ((struct include_file *)); -static void destroy_node PARAMS ((splay_tree_value)); -static int report_missing_guard PARAMS ((splay_tree_node, void *)); -static splay_tree_node find_or_create_entry PARAMS ((cpp_reader *, - const char *)); -static void handle_missing_header PARAMS ((cpp_reader *, const char *, int)); -static int remove_component_p PARAMS ((const char *)); +static struct file_name_map *read_name_map (cpp_reader *, const char *); +static char *read_filename_string (int, FILE *); +static char *remap_filename (cpp_reader *, char *, struct cpp_path *); +static struct cpp_path *search_from (cpp_reader *, enum include_type); +static struct include_file *find_include_file (cpp_reader *, const char *, + int, enum include_type); +static struct include_file *open_file (cpp_reader *, const char *); +static struct include_file *validate_pch (cpp_reader *, const char *, + const char *); +static struct include_file *open_file_pch (cpp_reader *, const char *); +static int read_include_file (cpp_reader *, struct include_file *); +static bool stack_include_file (cpp_reader *, struct include_file *); +static void purge_cache (struct include_file *); +static void destroy_node (splay_tree_value); +static int report_missing_guard (splay_tree_node, void *); +static splay_tree_node find_or_create_entry (cpp_reader *, const char *); +static void handle_missing_header (cpp_reader *, const char *, int); +static int remove_component_p (const char *); /* Set up the splay tree we use to store information about all the file names seen in this compilation. We also have entries for each @@ -125,8 +118,7 @@ static int remove_component_p PARAMS ((const char *)); A node's value is a pointer to a struct include_file, and is never NULL. */ void -_cpp_init_includes (pfile) - cpp_reader *pfile; +_cpp_init_includes (cpp_reader *pfile) { pfile->all_include_files = splay_tree_new ((splay_tree_compare_fn) strcmp, @@ -136,16 +128,14 @@ _cpp_init_includes (pfile) /* Tear down the splay tree. */ void -_cpp_cleanup_includes (pfile) - cpp_reader *pfile; +_cpp_cleanup_includes (cpp_reader *pfile) { splay_tree_delete (pfile->all_include_files); } /* Free a node. The path string is automatically freed. */ static void -destroy_node (v) - splay_tree_value v; +destroy_node (splay_tree_value v) { struct include_file *f = (struct include_file *) v; @@ -158,8 +148,7 @@ destroy_node (v) /* Mark a file to not be reread (e.g. #import, read failure). */ void -_cpp_never_reread (file) - struct include_file *file; +_cpp_never_reread (struct include_file *file) { file->cmacro = NEVER_REREAD; } @@ -167,9 +156,7 @@ _cpp_never_reread (file) /* Lookup a filename, which is simplified after making a copy, and create an entry if none exists. */ static splay_tree_node -find_or_create_entry (pfile, fname) - cpp_reader *pfile; - const char *fname; +find_or_create_entry (cpp_reader *pfile, const char *fname) { splay_tree_node node; struct include_file *file; @@ -197,9 +184,7 @@ find_or_create_entry (pfile, fname) /* Enter a file name in the splay tree, for the sake of cpp_included. */ void -_cpp_fake_include (pfile, fname) - cpp_reader *pfile; - const char *fname; +_cpp_fake_include (cpp_reader *pfile, const char *fname) { find_or_create_entry (pfile, fname); } @@ -214,9 +199,7 @@ _cpp_fake_include (pfile, fname) Returns an include_file structure with an open file descriptor on success, or NULL on failure. */ static struct include_file * -open_file (pfile, filename) - cpp_reader *pfile; - const char *filename; +open_file (cpp_reader *pfile, const char *filename) { splay_tree_node nd = find_or_create_entry (pfile, filename); struct include_file *file = (struct include_file *) nd->value; @@ -281,10 +264,7 @@ open_file (pfile, filename) } static struct include_file * -validate_pch (pfile, filename, pchname) - cpp_reader *pfile; - const char *filename; - const char *pchname; +validate_pch (cpp_reader *pfile, const char *filename, const char *pchname) { struct include_file * file; @@ -316,9 +296,7 @@ validate_pch (pfile, filename, pchname) /* Like open_file, but also look for a precompiled header if (a) one exists and (b) it is valid. */ static struct include_file * -open_file_pch (pfile, filename) - cpp_reader *pfile; - const char *filename; +open_file_pch (cpp_reader *pfile, const char *filename) { if (filename[0] != '\0' && pfile->cb.valid_pch != NULL) @@ -377,9 +355,7 @@ open_file_pch (pfile, filename) because of e.g. multiple-include guards. Returns true if a buffer is stacked. */ static bool -stack_include_file (pfile, inc) - cpp_reader *pfile; - struct include_file *inc; +stack_include_file (cpp_reader *pfile, struct include_file *inc) { cpp_buffer *fp; int sysp; @@ -462,9 +438,7 @@ stack_include_file (pfile, inc) FIXME: Flush file cache and try again if we run out of memory. */ static int -read_include_file (pfile, inc) - cpp_reader *pfile; - struct include_file *inc; +read_include_file (cpp_reader *pfile, struct include_file *inc) { ssize_t size, offset, count; uchar *buf; @@ -555,8 +529,7 @@ read_include_file (pfile, inc) /* Drop INC's buffer from memory. */ static void -purge_cache (inc) - struct include_file *inc; +purge_cache (struct include_file *inc) { if (inc->buffer) { @@ -568,9 +541,7 @@ purge_cache (inc) /* 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; +cpp_included (cpp_reader *pfile, const char *fname) { struct cpp_path *path; char *name, *n; @@ -608,11 +579,8 @@ cpp_included (pfile, fname) otherwise an include_file structure. If this request originates from a directive of TYPE #include_next, set INCLUDE_NEXT to true. */ static struct include_file * -find_include_file (pfile, fname, angle_brackets, type) - cpp_reader *pfile; - const char *fname; - int angle_brackets; - enum include_type type; +find_include_file (cpp_reader *pfile, const char *fname, int angle_brackets, + enum include_type type) { struct cpp_path *path; struct include_file *file; @@ -676,9 +644,7 @@ find_include_file (pfile, fname, angle_brackets, type) see the details of a buffer. This is an exported interface because fix-header needs it. */ void -cpp_make_system_header (pfile, syshdr, externc) - cpp_reader *pfile; - int syshdr, externc; +cpp_make_system_header (cpp_reader *pfile, int syshdr, int externc) { int flags = 0; @@ -693,10 +659,8 @@ cpp_make_system_header (pfile, syshdr, externc) to achieve pseudo-file names like <built-in>. If REASON is LC_LEAVE, then NEW_NAME must be NULL. */ void -cpp_change_file (pfile, reason, new_name) - cpp_reader *pfile; - enum lc_reason reason; - const char *new_name; +cpp_change_file (cpp_reader *pfile, enum lc_reason reason, + const char *new_name) { _cpp_do_file_change (pfile, reason, new_name, 1, 0); } @@ -704,8 +668,7 @@ cpp_change_file (pfile, reason, new_name) /* Report on all files that might benefit from a multiple include guard. Triggered by -H. */ void -_cpp_report_missing_guards (pfile) - cpp_reader *pfile; +_cpp_report_missing_guards (cpp_reader *pfile) { int banner = 0; splay_tree_foreach (pfile->all_include_files, report_missing_guard, &banner); @@ -713,9 +676,7 @@ _cpp_report_missing_guards (pfile) /* Callback function for splay_tree_foreach(). */ static int -report_missing_guard (n, b) - splay_tree_node n; - void *b; +report_missing_guard (splay_tree_node n, void *b) { struct include_file *f = (struct include_file *) n->value; int *bannerp = (int *) b; @@ -737,10 +698,8 @@ report_missing_guard (n, b) appropriate. ANGLE_BRACKETS is nonzero if the file was bracketed like <..>. */ static void -handle_missing_header (pfile, fname, angle_brackets) - cpp_reader *pfile; - const char *fname; - int angle_brackets; +handle_missing_header (cpp_reader *pfile, const char *fname, + int angle_brackets) { bool print_dep = CPP_OPTION (pfile, deps.style) > (angle_brackets || pfile->map->sysp); @@ -761,11 +720,8 @@ handle_missing_header (pfile, fname, angle_brackets) including HEADER, and the command line -imacros and -include. Returns true if a buffer was stacked. */ bool -_cpp_execute_include (pfile, fname, angle_brackets, type) - cpp_reader *pfile; - const char *fname; - int angle_brackets; - enum include_type type; +_cpp_execute_include (cpp_reader *pfile, const char *fname, int angle_brackets, + enum include_type type) { bool stacked = false; struct include_file *inc; @@ -788,10 +744,8 @@ _cpp_execute_include (pfile, fname, angle_brackets, type) file. If it cannot be located or dated, return -1, if it is newer newer, return 1, otherwise 0. */ int -_cpp_compare_file_date (pfile, fname, angle_brackets) - cpp_reader *pfile; - const char *fname; - int angle_brackets; +_cpp_compare_file_date (cpp_reader *pfile, const char *fname, + int angle_brackets) { struct include_file *inc; @@ -813,9 +767,7 @@ _cpp_compare_file_date (pfile, fname, angle_brackets) FNAME is "", read standard input. Return true if a buffer was stacked. */ bool -_cpp_read_file (pfile, fname) - cpp_reader *pfile; - const char *fname; +_cpp_read_file (cpp_reader *pfile, const char *fname) { /* This uses open_file, because we don't allow a PCH to be used as the toplevel compilation (that would prevent re-compiling an @@ -834,9 +786,7 @@ _cpp_read_file (pfile, fname) /* Pushes the given file onto the buffer stack. Returns nonzero if successful. */ bool -cpp_push_include (pfile, filename) - cpp_reader *pfile; - const char *filename; +cpp_push_include (cpp_reader *pfile, const char *filename) { /* Make the command line directive take up a line. */ pfile->line++; @@ -846,9 +796,7 @@ cpp_push_include (pfile, filename) /* Do appropriate cleanup when a file INC's buffer is popped off the input stack. */ void -_cpp_pop_file_buffer (pfile, inc) - cpp_reader *pfile; - struct include_file *inc; +_cpp_pop_file_buffer (cpp_reader *pfile, struct include_file *inc) { /* Record the inclusion-preventing macro, which could be NULL meaning no controlling macro. */ @@ -868,9 +816,7 @@ _cpp_pop_file_buffer (pfile, inc) If we're handling -include or -imacros, use the "" chain, but with the preprocessor's cwd prepended. */ static struct cpp_path * -search_from (pfile, type) - cpp_reader *pfile; - enum include_type type; +search_from (cpp_reader *pfile, enum include_type type) { cpp_buffer *buffer = pfile->buffer; unsigned int dlen; @@ -933,9 +879,7 @@ struct file_name_map { /* Read a space delimited string of unlimited length from a stdio file F. */ static char * -read_filename_string (ch, f) - int ch; - FILE *f; +read_filename_string (int ch, FILE *f) { char *alloc, *set; int len; @@ -970,9 +914,7 @@ struct file_name_map_list { /* Read the file name map file for DIRNAME. */ static struct file_name_map * -read_name_map (pfile, dirname) - cpp_reader *pfile; - const char *dirname; +read_name_map (cpp_reader *pfile, const char *dirname) { struct file_name_map_list *map_list_ptr; char *name; @@ -1048,10 +990,7 @@ read_name_map (pfile, dirname) /* Remap an unsimplified path NAME based on the file_name_map (if any) for LOC. */ static char * -remap_filename (pfile, name, loc) - cpp_reader *pfile; - char *name; - struct cpp_path *loc; +remap_filename (cpp_reader *pfile, char *name, struct cpp_path *loc) { struct file_name_map *map; const char *from, *p; @@ -1106,10 +1045,8 @@ remap_filename (pfile, name, loc) If BRACKET does not lie in the QUOTE chain, it is set to QUOTE. */ void -cpp_set_include_chains (pfile, quote, bracket, quote_ignores_source_dir) - cpp_reader *pfile; - cpp_path *quote, *bracket; - int quote_ignores_source_dir; +cpp_set_include_chains (cpp_reader *pfile, cpp_path *quote, cpp_path *bracket, + int quote_ignores_source_dir) { pfile->quote_include = quote; pfile->bracket_include = quote; @@ -1132,8 +1069,7 @@ cpp_set_include_chains (pfile, quote, bracket, quote_ignores_source_dir) symlinks if we have it. If not, we can still catch errors with stat (). */ static int -remove_component_p (path) - const char *path; +remove_component_p (const char *path) { struct stat s; int result; @@ -1168,8 +1104,7 @@ remove_component_p (path) of the string. Returns PATH. errno is 0 if no error occurred; nonzero if an error occurred when using stat () or lstat (). */ void -cpp_simplify_path (path) - char *path ATTRIBUTE_UNUSED; +cpp_simplify_path (char *path ATTRIBUTE_UNUSED) { #ifndef VMS char *from, *to; diff --git a/gcc/cpphash.c b/gcc/cpphash.c index 018085a..01cd0a4 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -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. */ diff --git a/gcc/cpphash.h b/gcc/cpphash.h index f6dbb10..388d5c8 100644 --- a/gcc/cpphash.h +++ b/gcc/cpphash.h @@ -117,14 +117,13 @@ struct _cpp_buff unsigned char *base, *cur, *limit; }; -extern _cpp_buff *_cpp_get_buff PARAMS ((cpp_reader *, size_t)); -extern void _cpp_release_buff PARAMS ((cpp_reader *, _cpp_buff *)); -extern void _cpp_extend_buff PARAMS ((cpp_reader *, _cpp_buff **, size_t)); -extern _cpp_buff *_cpp_append_extend_buff PARAMS ((cpp_reader *, _cpp_buff *, - size_t)); -extern void _cpp_free_buff PARAMS ((_cpp_buff *)); -extern unsigned char *_cpp_aligned_alloc PARAMS ((cpp_reader *, size_t)); -extern unsigned char *_cpp_unaligned_alloc PARAMS ((cpp_reader *, size_t)); +extern _cpp_buff *_cpp_get_buff (cpp_reader *, size_t); +extern void _cpp_release_buff (cpp_reader *, _cpp_buff *); +extern void _cpp_extend_buff (cpp_reader *, _cpp_buff **, size_t); +extern _cpp_buff *_cpp_append_extend_buff (cpp_reader *, _cpp_buff *, size_t); +extern void _cpp_free_buff (_cpp_buff *); +extern unsigned char *_cpp_aligned_alloc (cpp_reader *, size_t); +extern unsigned char *_cpp_unaligned_alloc (cpp_reader *, size_t); #define BUFF_ROOM(BUFF) (size_t) ((BUFF)->limit - (BUFF)->cur) #define BUFF_FRONT(BUFF) ((BUFF)->cur) @@ -468,90 +467,79 @@ extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1]; #define CPP_WTRADITIONAL(PF) CPP_OPTION (PF, warn_traditional) /* In cpperror.c */ -extern int _cpp_begin_message PARAMS ((cpp_reader *, int, - unsigned int, unsigned int)); +extern int _cpp_begin_message (cpp_reader *, int, unsigned int, unsigned int); /* In cppmacro.c */ -extern void _cpp_free_definition PARAMS ((cpp_hashnode *)); -extern bool _cpp_create_definition PARAMS ((cpp_reader *, cpp_hashnode *)); -extern void _cpp_pop_context PARAMS ((cpp_reader *)); -extern void _cpp_push_text_context PARAMS ((cpp_reader *, cpp_hashnode *, - const uchar *, size_t)); -extern bool _cpp_save_parameter PARAMS ((cpp_reader *, cpp_macro *, - cpp_hashnode *)); -extern bool _cpp_arguments_ok PARAMS ((cpp_reader *, cpp_macro *, - const cpp_hashnode *, - unsigned int)); -extern const uchar *_cpp_builtin_macro_text PARAMS ((cpp_reader *, - cpp_hashnode *)); -int _cpp_warn_if_unused_macro PARAMS ((cpp_reader *, cpp_hashnode *, - void *)); +extern void _cpp_free_definition (cpp_hashnode *); +extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *); +extern void _cpp_pop_context (cpp_reader *); +extern void _cpp_push_text_context (cpp_reader *, cpp_hashnode *, + const uchar *, size_t); +extern bool _cpp_save_parameter (cpp_reader *, cpp_macro *, cpp_hashnode *); +extern bool _cpp_arguments_ok (cpp_reader *, cpp_macro *, const cpp_hashnode *, + unsigned int); +extern const uchar *_cpp_builtin_macro_text (cpp_reader *, cpp_hashnode *); +int _cpp_warn_if_unused_macro (cpp_reader *, cpp_hashnode *, void *); /* In cpphash.c */ -extern void _cpp_init_hashtable PARAMS ((cpp_reader *, hash_table *)); -extern void _cpp_destroy_hashtable PARAMS ((cpp_reader *)); +extern void _cpp_init_hashtable (cpp_reader *, hash_table *); +extern void _cpp_destroy_hashtable (cpp_reader *); /* In cppfiles.c */ -extern void _cpp_fake_include PARAMS ((cpp_reader *, const char *)); -extern void _cpp_never_reread PARAMS ((struct include_file *)); -extern bool _cpp_read_file PARAMS ((cpp_reader *, const char *)); -extern bool _cpp_execute_include PARAMS ((cpp_reader *, const char *, - int, enum include_type)); -extern int _cpp_compare_file_date PARAMS ((cpp_reader *, const char *, - int)); -extern void _cpp_report_missing_guards PARAMS ((cpp_reader *)); -extern void _cpp_init_includes PARAMS ((cpp_reader *)); -extern void _cpp_cleanup_includes PARAMS ((cpp_reader *)); -extern void _cpp_pop_file_buffer PARAMS ((cpp_reader *, - struct include_file *)); +extern void _cpp_fake_include (cpp_reader *, const char *); +extern void _cpp_never_reread (struct include_file *); +extern bool _cpp_read_file (cpp_reader *, const char *); +extern bool _cpp_execute_include (cpp_reader *, const char *, int, + enum include_type); +extern int _cpp_compare_file_date (cpp_reader *, const char *, int); +extern void _cpp_report_missing_guards (cpp_reader *); +extern void _cpp_init_includes (cpp_reader *); +extern void _cpp_cleanup_includes (cpp_reader *); +extern void _cpp_pop_file_buffer (cpp_reader *, struct include_file *); /* In cppexp.c */ -extern bool _cpp_parse_expr PARAMS ((cpp_reader *)); -extern struct op *_cpp_expand_op_stack PARAMS ((cpp_reader *)); +extern bool _cpp_parse_expr (cpp_reader *); +extern struct op *_cpp_expand_op_stack (cpp_reader *); /* In cpplex.c */ -extern void _cpp_process_line_notes PARAMS ((cpp_reader *, int)); -extern void _cpp_clean_line PARAMS ((cpp_reader *)); -extern bool _cpp_get_fresh_line PARAMS ((cpp_reader *)); -extern bool _cpp_skip_block_comment PARAMS ((cpp_reader *)); -extern cpp_token *_cpp_temp_token PARAMS ((cpp_reader *)); -extern const cpp_token *_cpp_lex_token PARAMS ((cpp_reader *)); -extern cpp_token *_cpp_lex_direct PARAMS ((cpp_reader *)); -extern int _cpp_equiv_tokens PARAMS ((const cpp_token *, - const cpp_token *)); -extern void _cpp_init_tokenrun PARAMS ((tokenrun *, unsigned int)); +extern void _cpp_process_line_notes (cpp_reader *, int); +extern void _cpp_clean_line (cpp_reader *); +extern bool _cpp_get_fresh_line (cpp_reader *); +extern bool _cpp_skip_block_comment (cpp_reader *); +extern cpp_token *_cpp_temp_token (cpp_reader *); +extern const cpp_token *_cpp_lex_token (cpp_reader *); +extern cpp_token *_cpp_lex_direct (cpp_reader *); +extern int _cpp_equiv_tokens (const cpp_token *, const cpp_token *); +extern void _cpp_init_tokenrun (tokenrun *, unsigned int); /* In cppinit.c. */ -extern void _cpp_maybe_push_include_file PARAMS ((cpp_reader *)); +extern void _cpp_maybe_push_include_file (cpp_reader *); /* In cpplib.c */ -extern int _cpp_test_assertion PARAMS ((cpp_reader *, unsigned int *)); -extern int _cpp_handle_directive PARAMS ((cpp_reader *, int)); -extern void _cpp_define_builtin PARAMS ((cpp_reader *, const char *)); -extern char ** _cpp_save_pragma_names PARAMS ((cpp_reader *)); -extern void _cpp_restore_pragma_names PARAMS ((cpp_reader *, char **)); -extern void _cpp_do__Pragma PARAMS ((cpp_reader *)); -extern void _cpp_init_directives PARAMS ((cpp_reader *)); -extern void _cpp_init_internal_pragmas PARAMS ((cpp_reader *)); -extern void _cpp_do_file_change PARAMS ((cpp_reader *, enum lc_reason, - const char *, - unsigned int, unsigned int)); -extern void _cpp_pop_buffer PARAMS ((cpp_reader *)); +extern int _cpp_test_assertion (cpp_reader *, unsigned int *); +extern int _cpp_handle_directive (cpp_reader *, int); +extern void _cpp_define_builtin (cpp_reader *, const char *); +extern char ** _cpp_save_pragma_names (cpp_reader *); +extern void _cpp_restore_pragma_names (cpp_reader *, char **); +extern void _cpp_do__Pragma (cpp_reader *); +extern void _cpp_init_directives (cpp_reader *); +extern void _cpp_init_internal_pragmas (cpp_reader *); +extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *, + unsigned int, unsigned int); +extern void _cpp_pop_buffer (cpp_reader *); /* In cpptrad.c. */ -extern bool scan_out_logical_line PARAMS ((cpp_reader *, cpp_macro *)); -extern bool _cpp_read_logical_line_trad PARAMS ((cpp_reader *)); -extern void _cpp_overlay_buffer PARAMS ((cpp_reader *pfile, const uchar *, - size_t)); -extern void _cpp_remove_overlay PARAMS ((cpp_reader *)); -extern bool _cpp_create_trad_definition PARAMS ((cpp_reader *, cpp_macro *)); -extern bool _cpp_expansions_different_trad PARAMS ((const cpp_macro *, - const cpp_macro *)); -extern uchar *_cpp_copy_replacement_text PARAMS ((const cpp_macro *, uchar *)); -extern size_t _cpp_replacement_text_len PARAMS ((const cpp_macro *)); +extern bool scan_out_logical_line (cpp_reader *, cpp_macro *); +extern bool _cpp_read_logical_line_trad (cpp_reader *); +extern void _cpp_overlay_buffer (cpp_reader *pfile, const uchar *, size_t); +extern void _cpp_remove_overlay (cpp_reader *); +extern bool _cpp_create_trad_definition (cpp_reader *, cpp_macro *); +extern bool _cpp_expansions_different_trad (const cpp_macro *, + const cpp_macro *); +extern uchar *_cpp_copy_replacement_text (const cpp_macro *, uchar *); +extern size_t _cpp_replacement_text_len (const cpp_macro *); /* In cppcharset.c. */ -cppchar_t _cpp_valid_ucn PARAMS ((cpp_reader *, const uchar **, - int identifer_p)); +cppchar_t _cpp_valid_ucn (cpp_reader *, const uchar **, int identifer_p); /* Utility routines and macros. */ #define DSC(str) (const uchar *)str, sizeof str - 1 @@ -563,55 +551,45 @@ cppchar_t _cpp_valid_ucn PARAMS ((cpp_reader *, const uchar **, /* These are inline functions instead of macros so we can get type checking. */ -static inline int ustrcmp PARAMS ((const uchar *, const uchar *)); -static inline int ustrncmp PARAMS ((const uchar *, const uchar *, - size_t)); -static inline size_t ustrlen PARAMS ((const uchar *)); -static inline uchar *uxstrdup PARAMS ((const uchar *)); -static inline uchar *ustrchr PARAMS ((const uchar *, int)); -static inline int ufputs PARAMS ((const uchar *, FILE *)); +static inline int ustrcmp (const uchar *, const uchar *); +static inline int ustrncmp (const uchar *, const uchar *, size_t); +static inline size_t ustrlen (const uchar *); +static inline uchar *uxstrdup (const uchar *); +static inline uchar *ustrchr (const uchar *, int); +static inline int ufputs (const uchar *, FILE *); static inline int -ustrcmp (s1, s2) - const uchar *s1, *s2; +ustrcmp (const uchar *s1, const uchar *s2) { return strcmp ((const char *)s1, (const char *)s2); } static inline int -ustrncmp (s1, s2, n) - const uchar *s1, *s2; - size_t n; +ustrncmp (const uchar *s1, const uchar *s2, size_t n) { return strncmp ((const char *)s1, (const char *)s2, n); } static inline size_t -ustrlen (s1) - const uchar *s1; +ustrlen (const uchar *s1) { return strlen ((const char *)s1); } static inline uchar * -uxstrdup (s1) - const uchar *s1; +uxstrdup (const uchar *s1) { return (uchar *) xstrdup ((const char *)s1); } static inline uchar * -ustrchr (s1, c) - const uchar *s1; - int c; +ustrchr (const uchar *s1, int c) { return (uchar *) strchr ((const char *)s1, c); } static inline int -ufputs (s, f) - const uchar *s; - FILE *f; +ufputs (const uchar *s, FILE *f) { return fputs ((const char *)s, f); } diff --git a/gcc/cppinit.c b/gcc/cppinit.c index e1d125e..1792ddd 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -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)) diff --git a/gcc/cpplex.c b/gcc/cpplex.c index c635743..6933e75 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -52,24 +52,23 @@ static const struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE }; #define TOKEN_SPELL(token) (token_spellings[(token)->type].category) #define TOKEN_NAME(token) (token_spellings[(token)->type].name) -static void add_line_note PARAMS ((cpp_buffer *, const uchar *, unsigned int)); -static int skip_line_comment PARAMS ((cpp_reader *)); -static void skip_whitespace PARAMS ((cpp_reader *, cppchar_t)); -static cpp_hashnode *lex_identifier PARAMS ((cpp_reader *, const uchar *)); -static void lex_number PARAMS ((cpp_reader *, cpp_string *)); -static bool forms_identifier_p PARAMS ((cpp_reader *, int)); -static void lex_string PARAMS ((cpp_reader *, cpp_token *, const uchar *)); -static void save_comment PARAMS ((cpp_reader *, cpp_token *, const uchar *, - cppchar_t)); -static void create_literal PARAMS ((cpp_reader *, cpp_token *, const uchar *, - unsigned int, enum cpp_ttype)); -static bool warn_in_comment PARAMS ((cpp_reader *, _cpp_line_note *)); -static int name_p PARAMS ((cpp_reader *, const cpp_string *)); -static cppchar_t maybe_read_ucn PARAMS ((cpp_reader *, const uchar **)); -static tokenrun *next_tokenrun PARAMS ((tokenrun *)); - -static unsigned int hex_digit_value PARAMS ((unsigned int)); -static _cpp_buff *new_buff PARAMS ((size_t)); +static void add_line_note (cpp_buffer *, const uchar *, unsigned int); +static int skip_line_comment (cpp_reader *); +static void skip_whitespace (cpp_reader *, cppchar_t); +static cpp_hashnode *lex_identifier (cpp_reader *, const uchar *); +static void lex_number (cpp_reader *, cpp_string *); +static bool forms_identifier_p (cpp_reader *, int); +static void lex_string (cpp_reader *, cpp_token *, const uchar *); +static void save_comment (cpp_reader *, cpp_token *, const uchar *, cppchar_t); +static void create_literal (cpp_reader *, cpp_token *, const uchar *, + unsigned int, enum cpp_ttype); +static bool warn_in_comment (cpp_reader *, _cpp_line_note *); +static int name_p (cpp_reader *, const cpp_string *); +static cppchar_t maybe_read_ucn (cpp_reader *, const uchar **); +static tokenrun *next_tokenrun (tokenrun *); + +static unsigned int hex_digit_value (unsigned int); +static _cpp_buff *new_buff (size_t); /* Utility routine: @@ -77,9 +76,7 @@ static _cpp_buff *new_buff PARAMS ((size_t)); Compares, the token TOKEN to the NUL-terminated string STRING. TOKEN must be a CPP_NAME. Returns 1 for equal, 0 for unequal. */ int -cpp_ideq (token, string) - const cpp_token *token; - const char *string; +cpp_ideq (const cpp_token *token, const char *string) { if (token->type != CPP_NAME) return 0; @@ -90,10 +87,7 @@ cpp_ideq (token, string) /* Record a note TYPE at byte POS into the current cleaned logical line. */ static void -add_line_note (buffer, pos, type) - cpp_buffer *buffer; - const uchar *pos; - unsigned int type; +add_line_note (cpp_buffer *buffer, const uchar *pos, unsigned int type) { if (buffer->notes_used == buffer->notes_cap) { @@ -110,8 +104,7 @@ add_line_note (buffer, pos, type) /* Returns with a logical line that contains no escaped newlines or trigraphs. This is a time-critical inner loop. */ void -_cpp_clean_line (pfile) - cpp_reader *pfile; +_cpp_clean_line (cpp_reader *pfile) { cpp_buffer *buffer; const uchar *s; @@ -184,9 +177,7 @@ _cpp_clean_line (pfile) /* Return true if the trigraph indicated by NOTE should be warned about in a comment. */ static bool -warn_in_comment (pfile, note) - cpp_reader *pfile; - _cpp_line_note *note; +warn_in_comment (cpp_reader *pfile, _cpp_line_note *note) { const uchar *p; @@ -214,9 +205,7 @@ warn_in_comment (pfile, note) /* Process the notes created by add_line_note as far as the current location. */ void -_cpp_process_line_notes (pfile, in_comment) - cpp_reader *pfile; - int in_comment; +_cpp_process_line_notes (cpp_reader *pfile, int in_comment) { cpp_buffer *buffer = pfile->buffer; @@ -275,8 +264,7 @@ _cpp_process_line_notes (pfile, in_comment) Buffer->cur points to the initial asterisk of the comment. */ bool -_cpp_skip_block_comment (pfile) - cpp_reader *pfile; +_cpp_skip_block_comment (cpp_reader *pfile) { cpp_buffer *buffer = pfile->buffer; cppchar_t c; @@ -324,8 +312,7 @@ _cpp_skip_block_comment (pfile) terminating newline. Handles escaped newlines. Returns nonzero if a multiline comment. */ static int -skip_line_comment (pfile) - cpp_reader *pfile; +skip_line_comment (cpp_reader *pfile) { cpp_buffer *buffer = pfile->buffer; unsigned int orig_line = pfile->line; @@ -339,9 +326,7 @@ skip_line_comment (pfile) /* Skips whitespace, saving the next non-whitespace character. */ static void -skip_whitespace (pfile, c) - cpp_reader *pfile; - cppchar_t c; +skip_whitespace (cpp_reader *pfile, cppchar_t c) { cpp_buffer *buffer = pfile->buffer; bool saw_NUL = false; @@ -374,9 +359,7 @@ skip_whitespace (pfile, c) /* See if the characters of a number token are valid in a name (no '.', '+' or '-'). */ static int -name_p (pfile, string) - cpp_reader *pfile; - const cpp_string *string; +name_p (cpp_reader *pfile, const cpp_string *string) { unsigned int i; @@ -390,9 +373,7 @@ name_p (pfile, string) /* Returns TRUE if the sequence starting at buffer->cur is invalid in an identifier. FIRST is TRUE if this starts an identifier. */ static bool -forms_identifier_p (pfile, first) - cpp_reader *pfile; - int first; +forms_identifier_p (cpp_reader *pfile, int first) { cpp_buffer *buffer = pfile->buffer; @@ -426,9 +407,7 @@ forms_identifier_p (pfile, first) /* Lex an identifier starting at BUFFER->CUR - 1. */ static cpp_hashnode * -lex_identifier (pfile, base) - cpp_reader *pfile; - const uchar *base; +lex_identifier (cpp_reader *pfile, const uchar *base) { cpp_hashnode *result; const uchar *cur; @@ -462,7 +441,8 @@ lex_identifier (pfile, base) if (result == pfile->spec_nodes.n__VA_ARGS__ && !pfile->state.va_args_ok) cpp_error (pfile, DL_PEDWARN, - "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro"); + "__VA_ARGS__ can only appear in the expansion" + " of a C99 variadic macro"); } return result; @@ -470,9 +450,7 @@ lex_identifier (pfile, base) /* Lex a number to NUMBER starting at BUFFER->CUR - 1. */ static void -lex_number (pfile, number) - cpp_reader *pfile; - cpp_string *number; +lex_number (cpp_reader *pfile, cpp_string *number) { const uchar *cur; const uchar *base; @@ -500,12 +478,8 @@ lex_number (pfile, number) /* Create a token of type TYPE with a literal spelling. */ static void -create_literal (pfile, token, base, len, type) - cpp_reader *pfile; - cpp_token *token; - const uchar *base; - unsigned int len; - enum cpp_ttype type; +create_literal (cpp_reader *pfile, cpp_token *token, const uchar *base, + unsigned int len, enum cpp_ttype type) { uchar *dest = _cpp_unaligned_alloc (pfile, len + 1); @@ -524,10 +498,7 @@ create_literal (pfile, token, base, len, type) The spelling is NUL-terminated, but it is not guaranteed that this is the first NUL since embedded NULs are preserved. */ static void -lex_string (pfile, token, base) - cpp_reader *pfile; - cpp_token *token; - const uchar *base; +lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base) { bool saw_NUL = false; const uchar *cur; @@ -573,11 +544,8 @@ lex_string (pfile, token, base) /* The stored comment includes the comment start and any terminator. */ static void -save_comment (pfile, token, from, type) - cpp_reader *pfile; - cpp_token *token; - const unsigned char *from; - cppchar_t type; +save_comment (cpp_reader *pfile, cpp_token *token, const unsigned char *from, + cppchar_t type) { unsigned char *buffer; unsigned int len, clen; @@ -617,9 +585,7 @@ save_comment (pfile, token, from, type) /* Allocate COUNT tokens for RUN. */ void -_cpp_init_tokenrun (run, count) - tokenrun *run; - unsigned int count; +_cpp_init_tokenrun (tokenrun *run, unsigned int count) { run->base = xnewvec (cpp_token, count); run->limit = run->base + count; @@ -628,8 +594,7 @@ _cpp_init_tokenrun (run, count) /* Returns the next tokenrun, or creates one if there is none. */ static tokenrun * -next_tokenrun (run) - tokenrun *run; +next_tokenrun (tokenrun *run) { if (run->next == NULL) { @@ -646,8 +611,7 @@ next_tokenrun (run) same as the last lexed token, so that diagnostics appear in the right place. */ cpp_token * -_cpp_temp_token (pfile) - cpp_reader *pfile; +_cpp_temp_token (cpp_reader *pfile) { cpp_token *old, *result; @@ -668,8 +632,7 @@ _cpp_temp_token (pfile) like directive handling, token lookahead, multiple include optimization and skipping. */ const cpp_token * -_cpp_lex_token (pfile) - cpp_reader *pfile; +_cpp_lex_token (cpp_reader *pfile) { cpp_token *result; @@ -701,7 +664,7 @@ _cpp_lex_token (pfile) && _cpp_handle_directive (pfile, result->flags & PREV_WHITE)) continue; if (pfile->cb.line_change && !pfile->state.skipping) - (*pfile->cb.line_change)(pfile, result, pfile->state.parsing_args); + pfile->cb.line_change (pfile, result, pfile->state.parsing_args); } /* We don't skip tokens in directives. */ @@ -722,8 +685,7 @@ _cpp_lex_token (pfile) /* Returns true if a fresh line has been loaded. */ bool -_cpp_get_fresh_line (pfile) - cpp_reader *pfile; +_cpp_get_fresh_line (cpp_reader *pfile) { /* We can't get a new line until we leave the current directive. */ if (pfile->state.in_directive) @@ -792,8 +754,7 @@ _cpp_get_fresh_line (pfile) otherwise returns to the start of the token buffer if permissible. Returns the location of the lexed token. */ cpp_token * -_cpp_lex_direct (pfile) - cpp_reader *pfile; +_cpp_lex_direct (cpp_reader *pfile) { cppchar_t c; cpp_buffer *buffer; @@ -1128,8 +1089,7 @@ _cpp_lex_direct (pfile) /* An upper bound on the number of bytes needed to spell TOKEN. Does not include preceding whitespace. */ unsigned int -cpp_token_len (token) - const cpp_token *token; +cpp_token_len (const cpp_token *token) { unsigned int len; @@ -1145,13 +1105,11 @@ cpp_token_len (token) /* Write the spelling of a token TOKEN to BUFFER. The buffer must already contain the enough space to hold the token's spelling. - Returns a pointer to the character after the last character - written. */ + Returns a pointer to the character after the last character written. + FIXME: Would be nice if we didn't need the PFILE argument. */ unsigned char * -cpp_spell_token (pfile, token, buffer) - cpp_reader *pfile; /* Would be nice to be rid of this... */ - const cpp_token *token; - unsigned char *buffer; +cpp_spell_token (cpp_reader *pfile, const cpp_token *token, + unsigned char *buffer) { switch (TOKEN_SPELL (token)) { @@ -1195,9 +1153,7 @@ cpp_spell_token (pfile, token, buffer) /* Returns TOKEN spelt as a null-terminated string. The string is freed when the reader is destroyed. Useful for diagnostics. */ unsigned char * -cpp_token_as_text (pfile, token) - cpp_reader *pfile; - const cpp_token *token; +cpp_token_as_text (cpp_reader *pfile, const cpp_token *token) { unsigned int len = cpp_token_len (token) + 1; unsigned char *start = _cpp_unaligned_alloc (pfile, len), *end; @@ -1211,8 +1167,7 @@ cpp_token_as_text (pfile, token) /* Used by C front ends, which really should move to using cpp_token_as_text. */ const char * -cpp_type2name (type) - enum cpp_ttype type; +cpp_type2name (enum cpp_ttype type) { return (const char *) token_spellings[type].name; } @@ -1221,9 +1176,7 @@ cpp_type2name (type) Separated from cpp_spell_token for efficiency - to avoid stdio double-buffering. */ void -cpp_output_token (token, fp) - const cpp_token *token; - FILE *fp; +cpp_output_token (const cpp_token *token, FILE *fp) { switch (TOKEN_SPELL (token)) { @@ -1264,8 +1217,7 @@ cpp_output_token (token, fp) /* Compare two tokens. */ int -_cpp_equiv_tokens (a, b) - const cpp_token *a, *b; +_cpp_equiv_tokens (const cpp_token *a, const cpp_token *b) { if (a->type == b->type && a->flags == b->flags) switch (TOKEN_SPELL (a)) @@ -1291,9 +1243,8 @@ _cpp_equiv_tokens (a, b) conservative, and occasionally advises a space where one is not needed, e.g. "." and ".2". */ int -cpp_avoid_paste (pfile, token1, token2) - cpp_reader *pfile; - const cpp_token *token1, *token2; +cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1, + const cpp_token *token2) { enum cpp_ttype a = token1->type, b = token2->type; cppchar_t c; @@ -1349,9 +1300,7 @@ cpp_avoid_paste (pfile, token1, token2) character, to FP. Leading whitespace is removed. If there are macros, special token padding is not performed. */ void -cpp_output_line (pfile, fp) - cpp_reader *pfile; - FILE *fp; +cpp_output_line (cpp_reader *pfile, FILE *fp) { const cpp_token *token; @@ -1369,8 +1318,7 @@ cpp_output_line (pfile, fp) /* Returns the value of a hexadecimal digit. */ static unsigned int -hex_digit_value (c) - unsigned int c; +hex_digit_value (unsigned int c) { if (hex_p (c)) return hex_value (c); @@ -1380,9 +1328,7 @@ hex_digit_value (c) /* Read a possible universal character name starting at *PSTR. */ static cppchar_t -maybe_read_ucn (pfile, pstr) - cpp_reader *pfile; - const uchar **pstr; +maybe_read_ucn (cpp_reader *pfile, const uchar **pstr) { cppchar_t result, c = (*pstr)[-1]; @@ -1411,11 +1357,8 @@ maybe_read_ucn (pfile, pstr) if the escape sequence is part of a wide character constant or string literal. Handles all relevant diagnostics. */ cppchar_t -cpp_parse_escape (pfile, pstr, limit, wide) - cpp_reader *pfile; - const unsigned char **pstr; - const unsigned char *limit; - int wide; +cpp_parse_escape (cpp_reader *pfile, const unsigned char **pstr, + const unsigned char *limit, int wide) { /* Values of \a \b \e \f \n \r \t \v respectively. */ static const uchar ascii[] = { 7, 8, 27, 12, 10, 13, 9, 11 }; @@ -1555,7 +1498,8 @@ cpp_parse_escape (pfile, pstr, limit, wide) if (c > mask) { - cpp_error (pfile, DL_PEDWARN, "escape sequence out of range for its type"); + cpp_error (pfile, DL_PEDWARN, + "escape sequence out of range for its type"); c &= mask; } @@ -1569,11 +1513,8 @@ cpp_parse_escape (pfile, pstr, limit, wide) characters seen, and UNSIGNEDP to a variable that indicates whether the result has signed type. */ cppchar_t -cpp_interpret_charconst (pfile, token, pchars_seen, unsignedp) - cpp_reader *pfile; - const cpp_token *token; - unsigned int *pchars_seen; - int *unsignedp; +cpp_interpret_charconst (cpp_reader *pfile, const cpp_token *token, + unsigned int *pchars_seen, int *unsignedp) { const unsigned char *str, *limit; unsigned int chars_seen = 0; @@ -1678,8 +1619,7 @@ cpp_interpret_charconst (pfile, token, pchars_seen, unsignedp) /* Create a new allocation buffer. Place the control block at the end of the buffer, so that buffer overflows will cause immediate chaos. */ static _cpp_buff * -new_buff (len) - size_t len; +new_buff (size_t len) { _cpp_buff *result; unsigned char *base; @@ -1699,9 +1639,7 @@ new_buff (len) /* Place a chain of unwanted allocation buffers on the free list. */ void -_cpp_release_buff (pfile, buff) - cpp_reader *pfile; - _cpp_buff *buff; +_cpp_release_buff (cpp_reader *pfile, _cpp_buff *buff) { _cpp_buff *end = buff; @@ -1713,9 +1651,7 @@ _cpp_release_buff (pfile, buff) /* Return a free buffer of size at least MIN_SIZE. */ _cpp_buff * -_cpp_get_buff (pfile, min_size) - cpp_reader *pfile; - size_t min_size; +_cpp_get_buff (cpp_reader *pfile, size_t min_size) { _cpp_buff *result, **p; @@ -1744,10 +1680,7 @@ _cpp_get_buff (pfile, min_size) the excess bytes to the new buffer. Chains the new buffer after BUFF, and returns the new buffer. */ _cpp_buff * -_cpp_append_extend_buff (pfile, buff, min_extra) - cpp_reader *pfile; - _cpp_buff *buff; - size_t min_extra; +_cpp_append_extend_buff (cpp_reader *pfile, _cpp_buff *buff, size_t min_extra) { size_t size = EXTENDED_BUFF_SIZE (buff, min_extra); _cpp_buff *new_buff = _cpp_get_buff (pfile, size); @@ -1763,10 +1696,7 @@ _cpp_append_extend_buff (pfile, buff, min_extra) Chains the new buffer before the buffer pointed to by BUFF, and updates the pointer to point to the new buffer. */ void -_cpp_extend_buff (pfile, pbuff, min_extra) - cpp_reader *pfile; - _cpp_buff **pbuff; - size_t min_extra; +_cpp_extend_buff (cpp_reader *pfile, _cpp_buff **pbuff, size_t min_extra) { _cpp_buff *new_buff, *old_buff = *pbuff; size_t size = EXTENDED_BUFF_SIZE (old_buff, min_extra); @@ -1793,9 +1723,7 @@ _cpp_free_buff (buff) /* Allocate permanent, unaligned storage of length LEN. */ unsigned char * -_cpp_unaligned_alloc (pfile, len) - cpp_reader *pfile; - size_t len; +_cpp_unaligned_alloc (cpp_reader *pfile, size_t len) { _cpp_buff *buff = pfile->u_buff; unsigned char *result = buff->cur; @@ -1823,9 +1751,7 @@ _cpp_unaligned_alloc (pfile, len) All existing other uses clearly fit this restriction: storing registered pragmas during initialization. */ unsigned char * -_cpp_aligned_alloc (pfile, len) - cpp_reader *pfile; - size_t len; +_cpp_aligned_alloc (cpp_reader *pfile, size_t len) { _cpp_buff *buff = pfile->a_buff; unsigned char *result = buff->cur; diff --git a/gcc/cpplib.c b/gcc/cpplib.c index f80c292..af32705 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -45,11 +45,11 @@ struct if_stack const cpp_hashnode *mi_cmacro;/* macro name for #ifndef around entire file */ bool skip_elses; /* Can future #else / #elif be skipped? */ bool was_skipping; /* If were skipping on entry. */ - int type; /* Most recent conditional, for diagnostics. */ + int type; /* Most recent conditional for diagnostics. */ }; /* Contains a registered pragma or pragma namespace. */ -typedef void (*pragma_cb) PARAMS ((cpp_reader *)); +typedef void (*pragma_cb) (cpp_reader *); struct pragma_entry { struct pragma_entry *next; @@ -82,7 +82,7 @@ struct pragma_entry #define EXPAND (1 << 4) /* Defines one #-directive, including how to handle it. */ -typedef void (*directive_handler) PARAMS ((cpp_reader *)); +typedef void (*directive_handler) (cpp_reader *); typedef struct directive directive; struct directive { @@ -95,51 +95,44 @@ struct directive /* Forward declarations. */ -static void skip_rest_of_line PARAMS ((cpp_reader *)); -static void check_eol PARAMS ((cpp_reader *)); -static void start_directive PARAMS ((cpp_reader *)); -static void prepare_directive_trad PARAMS ((cpp_reader *)); -static void end_directive PARAMS ((cpp_reader *, int)); -static void directive_diagnostics - PARAMS ((cpp_reader *, const directive *, int)); -static void run_directive PARAMS ((cpp_reader *, int, - const char *, size_t)); -static char *glue_header_name PARAMS ((cpp_reader *)); -static const char *parse_include PARAMS ((cpp_reader *, int *)); -static void push_conditional PARAMS ((cpp_reader *, int, int, - const cpp_hashnode *)); -static unsigned int read_flag PARAMS ((cpp_reader *, unsigned int)); -static uchar *dequote_string PARAMS ((cpp_reader *, const uchar *, - unsigned int)); -static int strtoul_for_line PARAMS ((const uchar *, unsigned int, - unsigned long *)); -static void do_diagnostic PARAMS ((cpp_reader *, int, int)); -static cpp_hashnode *lex_macro_node PARAMS ((cpp_reader *)); -static void do_include_common PARAMS ((cpp_reader *, enum include_type)); -static struct pragma_entry *lookup_pragma_entry - PARAMS ((struct pragma_entry *, const cpp_hashnode *pragma)); -static struct pragma_entry *insert_pragma_entry - PARAMS ((cpp_reader *, struct pragma_entry **, const cpp_hashnode *, - pragma_cb)); -static int count_registered_pragmas PARAMS ((struct pragma_entry *)); -static char ** save_registered_pragmas - PARAMS ((struct pragma_entry *, char **)); -static char ** restore_registered_pragmas - PARAMS ((cpp_reader *, struct pragma_entry *, char **)); -static void do_pragma_once PARAMS ((cpp_reader *)); -static void do_pragma_poison PARAMS ((cpp_reader *)); -static void do_pragma_system_header PARAMS ((cpp_reader *)); -static void do_pragma_dependency PARAMS ((cpp_reader *)); -static void do_linemarker PARAMS ((cpp_reader *)); -static const cpp_token *get_token_no_padding PARAMS ((cpp_reader *)); -static const cpp_token *get__Pragma_string PARAMS ((cpp_reader *)); -static void destringize_and_run PARAMS ((cpp_reader *, const cpp_string *)); -static int parse_answer PARAMS ((cpp_reader *, struct answer **, int)); -static cpp_hashnode *parse_assertion PARAMS ((cpp_reader *, struct answer **, - int)); -static struct answer ** find_answer PARAMS ((cpp_hashnode *, - const struct answer *)); -static void handle_assertion PARAMS ((cpp_reader *, const char *, int)); +static void skip_rest_of_line (cpp_reader *); +static void check_eol (cpp_reader *); +static void start_directive (cpp_reader *); +static void prepare_directive_trad (cpp_reader *); +static void end_directive (cpp_reader *, int); +static void directive_diagnostics (cpp_reader *, const directive *, int); +static void run_directive (cpp_reader *, int, const char *, size_t); +static char *glue_header_name (cpp_reader *); +static const char *parse_include (cpp_reader *, int *); +static void push_conditional (cpp_reader *, int, int, const cpp_hashnode *); +static unsigned int read_flag (cpp_reader *, unsigned int); +static uchar *dequote_string (cpp_reader *, const uchar *, unsigned int); +static int strtoul_for_line (const uchar *, unsigned int, unsigned long *); +static void do_diagnostic (cpp_reader *, int, int); +static cpp_hashnode *lex_macro_node (cpp_reader *); +static void do_include_common (cpp_reader *, enum include_type); +static struct pragma_entry *lookup_pragma_entry (struct pragma_entry *, + const cpp_hashnode *); +static struct pragma_entry *insert_pragma_entry (cpp_reader *, + struct pragma_entry **, + const cpp_hashnode *, + pragma_cb); +static int count_registered_pragmas (struct pragma_entry *); +static char ** save_registered_pragmas (struct pragma_entry *, char **); +static char ** restore_registered_pragmas (cpp_reader *, struct pragma_entry *, + char **); +static void do_pragma_once (cpp_reader *); +static void do_pragma_poison (cpp_reader *); +static void do_pragma_system_header (cpp_reader *); +static void do_pragma_dependency (cpp_reader *); +static void do_linemarker (cpp_reader *); +static const cpp_token *get_token_no_padding (cpp_reader *); +static const cpp_token *get__Pragma_string (cpp_reader *); +static void destringize_and_run (cpp_reader *, const cpp_string *); +static int parse_answer (cpp_reader *, struct answer **, int); +static cpp_hashnode *parse_assertion (cpp_reader *, struct answer **, int); +static struct answer ** find_answer (cpp_hashnode *, const struct answer *); +static void handle_assertion (cpp_reader *, const char *, int); /* This is the table of directive handlers. It is ordered by frequency of occurrence; the numbers at the end are directive @@ -174,7 +167,7 @@ D(sccs, T_SCCS, EXTENSION, 0) /* 0 SVR4? */ /* Use the table to generate a series of prototypes, an enum for the directive names, and an array of directive handlers. */ -#define D(name, t, o, f) static void do_##name PARAMS ((cpp_reader *)); +#define D(name, t, o, f) static void do_##name (cpp_reader *); DIRECTIVE_TABLE #undef D @@ -208,8 +201,7 @@ static const directive linemarker_dir = /* Skip any remaining tokens in a directive. */ static void -skip_rest_of_line (pfile) - cpp_reader *pfile; +skip_rest_of_line (cpp_reader *pfile) { /* Discard all stacked contexts. */ while (pfile->context->prev) @@ -223,8 +215,7 @@ skip_rest_of_line (pfile) /* Ensure there are no stray tokens at the end of a directive. */ static void -check_eol (pfile) - cpp_reader *pfile; +check_eol (cpp_reader *pfile) { if (! SEEN_EOL () && _cpp_lex_token (pfile)->type != CPP_EOF) cpp_error (pfile, DL_PEDWARN, "extra tokens at end of #%s directive", @@ -233,8 +224,7 @@ check_eol (pfile) /* Called when entering a directive, _Pragma or command-line directive. */ static void -start_directive (pfile) - cpp_reader *pfile; +start_directive (cpp_reader *pfile) { /* Setup in-directive state. */ pfile->state.in_directive = 1; @@ -246,9 +236,7 @@ start_directive (pfile) /* Called when leaving a directive, _Pragma or command-line directive. */ static void -end_directive (pfile, skip_line) - cpp_reader *pfile; - int skip_line; +end_directive (cpp_reader *pfile, int skip_line) { if (CPP_OPTION (pfile, traditional)) { @@ -279,8 +267,7 @@ end_directive (pfile, skip_line) /* Prepare to handle the directive in pfile->directive. */ static void -prepare_directive_trad (pfile) - cpp_reader *pfile; +prepare_directive_trad (cpp_reader *pfile) { if (pfile->directive != &dtable[T_DEFINE]) { @@ -308,10 +295,7 @@ prepare_directive_trad (pfile) /* Output diagnostics for a directive DIR. INDENTED is nonzero if the '#' was indented. */ static void -directive_diagnostics (pfile, dir, indented) - cpp_reader *pfile; - const directive *dir; - int indented; +directive_diagnostics (cpp_reader *pfile, const directive *dir, int indented) { /* Issue -pedantic warnings for extensions. */ if (CPP_PEDANTIC (pfile) @@ -347,9 +331,7 @@ directive_diagnostics (pfile, dir, indented) nonzero if the line of tokens has been handled, zero if we should continue processing the line. */ int -_cpp_handle_directive (pfile, indented) - cpp_reader *pfile; - int indented; +_cpp_handle_directive (cpp_reader *pfile, int indented) { const directive *dir = 0; const cpp_token *dname; @@ -439,7 +421,7 @@ _cpp_handle_directive (pfile, indented) prepare_directive_trad (pfile); if (dir) - (*pfile->directive->handler) (pfile); + pfile->directive->handler (pfile); else if (skip == 0) _cpp_backup_tokens (pfile, 1); @@ -456,11 +438,7 @@ _cpp_handle_directive (pfile, indented) /* Directive handler wrapper used by the command line option processor. BUF is \n terminated. */ static void -run_directive (pfile, dir_no, buf, count) - cpp_reader *pfile; - int dir_no; - const char *buf; - size_t count; +run_directive (cpp_reader *pfile, int dir_no, const char *buf, size_t count) { cpp_push_buffer (pfile, (const uchar *) buf, count, /* from_stage3 */ true, 1); @@ -476,7 +454,7 @@ run_directive (pfile, dir_no, buf, count) pfile->directive = &dtable[dir_no]; if (CPP_OPTION (pfile, traditional)) prepare_directive_trad (pfile); - (void) (*pfile->directive->handler) (pfile); + pfile->directive->handler (pfile); end_directive (pfile, 1); if (dir_no == T_PRAGMA) pfile->buffer->inc = NULL; @@ -486,8 +464,7 @@ run_directive (pfile, dir_no, buf, count) /* Checks for validity the macro name in #define, #undef, #ifdef and #ifndef directives. */ static cpp_hashnode * -lex_macro_node (pfile) - cpp_reader *pfile; +lex_macro_node (cpp_reader *pfile) { const cpp_token *token = _cpp_lex_token (pfile); @@ -523,8 +500,7 @@ lex_macro_node (pfile) /* Process a #define directive. Most work is done in cppmacro.c. */ static void -do_define (pfile) - cpp_reader *pfile; +do_define (cpp_reader *pfile) { cpp_hashnode *node = lex_macro_node (pfile); @@ -537,14 +513,13 @@ do_define (pfile) if (_cpp_create_definition (pfile, node)) if (pfile->cb.define) - (*pfile->cb.define) (pfile, pfile->directive_line, node); + pfile->cb.define (pfile, pfile->directive_line, node); } } /* Handle #undef. Mark the identifier NT_VOID in the hash table. */ static void -do_undef (pfile) - cpp_reader *pfile; +do_undef (cpp_reader *pfile) { cpp_hashnode *node = lex_macro_node (pfile); @@ -553,7 +528,7 @@ do_undef (pfile) if (node && node->type == NT_MACRO) { if (pfile->cb.undef) - (*pfile->cb.undef) (pfile, pfile->directive_line, node); + pfile->cb.undef (pfile, pfile->directive_line, node); if (node->flags & NODE_WARN) cpp_error (pfile, DL_WARNING, "undefining \"%s\"", NODE_NAME (node)); @@ -570,8 +545,7 @@ do_undef (pfile) as an h-char-sequence (< ... >); we are looking at the first token after the <. Returns a malloced filename. */ static char * -glue_header_name (pfile) - cpp_reader *pfile; +glue_header_name (cpp_reader *pfile) { const cpp_token *token; char *buffer; @@ -614,9 +588,7 @@ glue_header_name (pfile) #pragma dependency. The string is malloced and the caller should free it. Returns NULL on error. */ static const char * -parse_include (pfile, pangle_brackets) - cpp_reader *pfile; - int *pangle_brackets; +parse_include (cpp_reader *pfile, int *pangle_brackets) { char *fname; const cpp_token *header; @@ -655,9 +627,7 @@ parse_include (pfile, pangle_brackets) /* Handle #include, #include_next and #import. */ static void -do_include_common (pfile, type) - cpp_reader *pfile; - enum include_type type; +do_include_common (cpp_reader *pfile, enum include_type type) { const char *fname; int angle_brackets; @@ -675,8 +645,8 @@ do_include_common (pfile, type) skip_rest_of_line (pfile); if (pfile->cb.include) - (*pfile->cb.include) (pfile, pfile->directive_line, - pfile->directive->name, fname, angle_brackets); + pfile->cb.include (pfile, pfile->directive_line, + pfile->directive->name, fname, angle_brackets); _cpp_execute_include (pfile, fname, angle_brackets, type); } @@ -685,15 +655,13 @@ do_include_common (pfile, type) } static void -do_include (pfile) - cpp_reader *pfile; +do_include (cpp_reader *pfile) { do_include_common (pfile, IT_INCLUDE); } static void -do_import (pfile) - cpp_reader *pfile; +do_import (cpp_reader *pfile) { if (CPP_OPTION (pfile, warn_import)) { @@ -706,8 +674,7 @@ do_import (pfile) } static void -do_include_next (pfile) - cpp_reader *pfile; +do_include_next (cpp_reader *pfile) { enum include_type type = IT_INCLUDE_NEXT; @@ -727,9 +694,7 @@ do_include_next (pfile) flag if it is valid, 0 at the end of the directive. Otherwise complain. */ static unsigned int -read_flag (pfile, last) - cpp_reader *pfile; - unsigned int last; +read_flag (cpp_reader *pfile, unsigned int last) { const cpp_token *token = _cpp_lex_token (pfile); @@ -753,10 +718,7 @@ read_flag (pfile, last) which has a NUL terminator and all escape sequences converted to their equivalents. Temporary, hopefully. */ static uchar * -dequote_string (pfile, str, len) - cpp_reader *pfile; - const uchar *str; - unsigned int len; +dequote_string (cpp_reader *pfile, const uchar *str, unsigned int len) { uchar *result = _cpp_unaligned_alloc (pfile, len + 1); uchar *dst = result; @@ -779,10 +741,7 @@ dequote_string (pfile, str, len) of length LEN, to binary; store it in NUMP, and return 0 if the number was well-formed, 1 if not. Temporary, hopefully. */ static int -strtoul_for_line (str, len, nump) - const uchar *str; - unsigned int len; - unsigned long *nump; +strtoul_for_line (const uchar *str, unsigned int len, long unsigned int *nump) { unsigned long reg = 0; uchar c; @@ -802,8 +761,7 @@ strtoul_for_line (str, len, nump) Note that the filename string (if any) is a true string constant (escapes are interpreted), unlike in #line. */ static void -do_line (pfile) - cpp_reader *pfile; +do_line (cpp_reader *pfile) { const cpp_token *token; const char *new_file = pfile->map->to_file; @@ -850,8 +808,7 @@ do_line (pfile) different syntax and semantics from #line: Flags are allowed, and we never complain about the line number being too big. */ static void -do_linemarker (pfile) - cpp_reader *pfile; +do_linemarker (cpp_reader *pfile) { const cpp_token *token; const char *new_file = pfile->map->to_file; @@ -921,27 +878,21 @@ do_linemarker (pfile) header, 2 for a system header that needs to be extern "C" protected, and zero otherwise. */ void -_cpp_do_file_change (pfile, reason, to_file, file_line, sysp) - cpp_reader *pfile; - enum lc_reason reason; - const char *to_file; - unsigned int file_line; - unsigned int sysp; +_cpp_do_file_change (cpp_reader *pfile, enum lc_reason reason, + const char *to_file, unsigned int file_line, + unsigned int sysp) { pfile->map = add_line_map (&pfile->line_maps, reason, sysp, pfile->line, to_file, file_line); if (pfile->cb.file_change) - (*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 processing. Use the directive's tokens in the error message. */ static void -do_diagnostic (pfile, code, print_dir) - cpp_reader *pfile; - int code; - int print_dir; +do_diagnostic (cpp_reader *pfile, int code, int print_dir) { if (_cpp_begin_message (pfile, code, pfile->cur_token[-1].line, @@ -956,15 +907,13 @@ do_diagnostic (pfile, code, print_dir) } static void -do_error (pfile) - cpp_reader *pfile; +do_error (cpp_reader *pfile) { do_diagnostic (pfile, DL_ERROR, 1); } static void -do_warning (pfile) - cpp_reader *pfile; +do_warning (cpp_reader *pfile) { /* We want #warning diagnostics to be emitted in system headers too. */ do_diagnostic (pfile, DL_WARNING_SYSHDR, 1); @@ -972,15 +921,14 @@ do_warning (pfile) /* Report program identification. */ static void -do_ident (pfile) - cpp_reader *pfile; +do_ident (cpp_reader *pfile) { const cpp_token *str = cpp_get_token (pfile); if (str->type != CPP_STRING) cpp_error (pfile, DL_ERROR, "invalid #ident directive"); else if (pfile->cb.ident) - (*pfile->cb.ident) (pfile, pfile->directive_line, &str->val.str); + pfile->cb.ident (pfile, pfile->directive_line, &str->val.str); check_eol (pfile); } @@ -989,9 +937,7 @@ do_ident (pfile) matching entry, or NULL if none is found. The returned entry could be the start of a namespace chain, or a pragma. */ static struct pragma_entry * -lookup_pragma_entry (chain, pragma) - struct pragma_entry *chain; - const cpp_hashnode *pragma; +lookup_pragma_entry (struct pragma_entry *chain, const cpp_hashnode *pragma) { while (chain && chain->pragma != pragma) chain = chain->next; @@ -1003,11 +949,8 @@ lookup_pragma_entry (chain, pragma) singly-linked CHAIN. If handler is NULL, it is a namespace, otherwise it is a pragma and its handler. */ static struct pragma_entry * -insert_pragma_entry (pfile, chain, pragma, handler) - cpp_reader *pfile; - struct pragma_entry **chain; - const cpp_hashnode *pragma; - pragma_cb handler; +insert_pragma_entry (cpp_reader *pfile, struct pragma_entry **chain, + const cpp_hashnode *pragma, pragma_cb handler) { struct pragma_entry *new; @@ -1034,11 +977,8 @@ insert_pragma_entry (pfile, chain, pragma, handler) goes in the global namespace. HANDLER is the handler it will call, which must be non-NULL. */ void -cpp_register_pragma (pfile, space, name, handler) - cpp_reader *pfile; - const char *space; - const char *name; - pragma_cb handler; +cpp_register_pragma (cpp_reader *pfile, const char *space, const char *name, + pragma_cb handler) { struct pragma_entry **chain = &pfile->pragmas; struct pragma_entry *entry; @@ -1080,8 +1020,7 @@ cpp_register_pragma (pfile, space, name, handler) /* Register the pragmas the preprocessor itself handles. */ void -_cpp_init_internal_pragmas (pfile) - cpp_reader *pfile; +_cpp_init_internal_pragmas (cpp_reader *pfile) { /* Pragmas in the global namespace. */ cpp_register_pragma (pfile, 0, "once", do_pragma_once); @@ -1095,8 +1034,7 @@ _cpp_init_internal_pragmas (pfile) /* Return the number of registered pragmas in PE. */ static int -count_registered_pragmas (pe) - struct pragma_entry *pe; +count_registered_pragmas (struct pragma_entry *pe) { int ct = 0; for (; pe != NULL; pe = pe->next) @@ -1112,9 +1050,7 @@ count_registered_pragmas (pe) and return a pointer to the next free space in SD. */ static char ** -save_registered_pragmas (pe, sd) - struct pragma_entry *pe; - char **sd; +save_registered_pragmas (struct pragma_entry *pe, char **sd) { for (; pe != NULL; pe = pe->next) { @@ -1131,8 +1067,7 @@ save_registered_pragmas (pe, sd) registered pragmas. */ char ** -_cpp_save_pragma_names (pfile) - cpp_reader *pfile; +_cpp_save_pragma_names (cpp_reader *pfile) { int ct = count_registered_pragmas (pfile->pragmas); char **result = xnewvec (char *, ct); @@ -1144,10 +1079,8 @@ _cpp_save_pragma_names (pfile) and return a pointer to the next unused name in SD. */ static char ** -restore_registered_pragmas (pfile, pe, sd) - cpp_reader *pfile; - struct pragma_entry *pe; - char **sd; +restore_registered_pragmas (cpp_reader *pfile, struct pragma_entry *pe, + char **sd) { for (; pe != NULL; pe = pe->next) { @@ -1163,9 +1096,7 @@ restore_registered_pragmas (pfile, pe, sd) /* Restore the names of the registered pragmas from SAVED. */ void -_cpp_restore_pragma_names (pfile, saved) - cpp_reader *pfile; - char **saved; +_cpp_restore_pragma_names (cpp_reader *pfile, char **saved) { (void) restore_registered_pragmas (pfile, pfile->pragmas, saved); free (saved); @@ -1177,8 +1108,7 @@ _cpp_restore_pragma_names (pfile, saved) expansion happens for other pragmas is implementation defined. This implementation never macro-expands the text after #pragma. */ static void -do_pragma (pfile) - cpp_reader *pfile; +do_pragma (cpp_reader *pfile) { const struct pragma_entry *p = NULL; const cpp_token *token; @@ -1207,14 +1137,14 @@ do_pragma (pfile) themselves. Stand-alone CPP must ignore us, otherwise it will prefix the directive with spaces, hence the 1. Ugh. */ if (pfile->cb.line_change) - (*pfile->cb.line_change)(pfile, token, 1); + pfile->cb.line_change (pfile, token, 1); if (p) - (*p->u.handler) (pfile); + p->u.handler (pfile); else if (pfile->cb.def_pragma) { _cpp_backup_tokens (pfile, count); - (*pfile->cb.def_pragma) (pfile, pfile->directive_line); + pfile->cb.def_pragma (pfile, pfile->directive_line); } pfile->state.prevent_expansion--; @@ -1222,8 +1152,7 @@ do_pragma (pfile) /* Handle #pragma once. */ static void -do_pragma_once (pfile) - cpp_reader *pfile; +do_pragma_once (cpp_reader *pfile) { if (CPP_OPTION (pfile, warn_deprecated)) cpp_error (pfile, DL_WARNING, "#pragma once is obsolete"); @@ -1239,8 +1168,7 @@ do_pragma_once (pfile) /* Handle #pragma GCC poison, to poison one or more identifiers so that the lexer produces a hard error for each subsequent usage. */ static void -do_pragma_poison (pfile) - cpp_reader *pfile; +do_pragma_poison (cpp_reader *pfile) { const cpp_token *tok; cpp_hashnode *hp; @@ -1277,8 +1205,7 @@ do_pragma_poison (pfile) system include directory. To prevent abuse, it is rejected in the primary source file. */ static void -do_pragma_system_header (pfile) - cpp_reader *pfile; +do_pragma_system_header (cpp_reader *pfile) { cpp_buffer *buffer = pfile->buffer; @@ -1297,8 +1224,7 @@ do_pragma_system_header (pfile) file. Issue a diagnostic, if the specified file is newer. We use this to determine if a fixed header should be refixed. */ static void -do_pragma_dependency (pfile) - cpp_reader *pfile; +do_pragma_dependency (cpp_reader *pfile) { const char *fname; int angle_brackets, ordering; @@ -1325,8 +1251,7 @@ do_pragma_dependency (pfile) /* Get a token but skip padding. */ static const cpp_token * -get_token_no_padding (pfile) - cpp_reader *pfile; +get_token_no_padding (cpp_reader *pfile) { for (;;) { @@ -1339,8 +1264,7 @@ get_token_no_padding (pfile) /* Check syntax is "(string-literal)". Returns the string on success, or NULL on failure. */ static const cpp_token * -get__Pragma_string (pfile) - cpp_reader *pfile; +get__Pragma_string (cpp_reader *pfile) { const cpp_token *string; @@ -1360,9 +1284,7 @@ get__Pragma_string (pfile) /* Destringize IN into a temporary buffer, by removing the first \ of \" and \\ sequences, and process the result as a #pragma directive. */ static void -destringize_and_run (pfile, in) - cpp_reader *pfile; - const cpp_string *in; +destringize_and_run (cpp_reader *pfile, const cpp_string *in) { const unsigned char *src, *limit; char *dest, *result; @@ -1417,13 +1339,12 @@ destringize_and_run (pfile, in) Getting the line markers is a little tricky. */ if (pfile->cb.line_change) - (*pfile->cb.line_change) (pfile, pfile->cur_token, false); + pfile->cb.line_change (pfile, pfile->cur_token, false); } /* Handle the _Pragma operator. */ void -_cpp_do__Pragma (pfile) - cpp_reader *pfile; +_cpp_do__Pragma (cpp_reader *pfile) { const cpp_token *string = get__Pragma_string (pfile); @@ -1434,17 +1355,15 @@ _cpp_do__Pragma (pfile) "_Pragma takes a parenthesized string literal"); } -/* Just ignore #sccs on all systems. */ +/* Ignore #sccs on all systems. */ static void -do_sccs (pfile) - cpp_reader *pfile ATTRIBUTE_UNUSED; +do_sccs (cpp_reader *pfile ATTRIBUTE_UNUSED) { } /* Handle #ifdef. */ static void -do_ifdef (pfile) - cpp_reader *pfile; +do_ifdef (cpp_reader *pfile) { int skip = 1; @@ -1465,8 +1384,7 @@ do_ifdef (pfile) /* Handle #ifndef. */ static void -do_ifndef (pfile) - cpp_reader *pfile; +do_ifndef (cpp_reader *pfile) { int skip = 1; const cpp_hashnode *node = 0; @@ -1492,8 +1410,7 @@ do_ifndef (pfile) cannot treat it as a controlling conditional, since the expansion could change in the future. That is handled by cpp_get_token. */ static void -do_if (pfile) - cpp_reader *pfile; +do_if (cpp_reader *pfile) { int skip = 1; @@ -1507,8 +1424,7 @@ do_if (pfile) if_stack; this is so that the error message for missing #endif's etc. will point to the original #if. */ static void -do_else (pfile) - cpp_reader *pfile; +do_else (cpp_reader *pfile) { cpp_buffer *buffer = pfile->buffer; struct if_stack *ifs = buffer->if_stack; @@ -1541,8 +1457,7 @@ do_else (pfile) /* Handle a #elif directive by not changing if_stack either. See the comment above do_else. */ static void -do_elif (pfile) - cpp_reader *pfile; +do_elif (cpp_reader *pfile) { cpp_buffer *buffer = pfile->buffer; struct if_stack *ifs = buffer->if_stack; @@ -1577,8 +1492,7 @@ do_elif (pfile) /* #endif pops the if stack and resets pfile->state.skipping. */ static void -do_endif (pfile) - cpp_reader *pfile; +do_endif (cpp_reader *pfile) { cpp_buffer *buffer = pfile->buffer; struct if_stack *ifs = buffer->if_stack; @@ -1609,11 +1523,8 @@ do_endif (pfile) 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 -push_conditional (pfile, skip, type, cmacro) - cpp_reader *pfile; - int skip; - int type; - const cpp_hashnode *cmacro; +push_conditional (cpp_reader *pfile, int skip, int type, + const cpp_hashnode *cmacro) { struct if_stack *ifs; cpp_buffer *buffer = pfile->buffer; @@ -1639,10 +1550,7 @@ push_conditional (pfile, skip, type, cmacro) storage, i.e. the #assert case. Returns 0 on success, and sets ANSWERP to point to the answer. */ static int -parse_answer (pfile, answerp, type) - cpp_reader *pfile; - struct answer **answerp; - int type; +parse_answer (cpp_reader *pfile, struct answer **answerp, int type) { const cpp_token *paren; struct answer *answer; @@ -1718,10 +1626,7 @@ parse_answer (pfile, answerp, type) the hash node of the predicate, or 0 on error. If an answer was supplied, it is placed in ANSWERP, otherwise it is set to 0. */ static cpp_hashnode * -parse_assertion (pfile, answerp, type) - cpp_reader *pfile; - struct answer **answerp; - int type; +parse_assertion (cpp_reader *pfile, struct answer **answerp, int type) { cpp_hashnode *result = 0; const cpp_token *predicate; @@ -1753,9 +1658,7 @@ parse_assertion (pfile, answerp, type) /* 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. */ static struct answer ** -find_answer (node, candidate) - cpp_hashnode *node; - const struct answer *candidate; +find_answer (cpp_hashnode *node, const struct answer *candidate) { unsigned int i; struct answer **result; @@ -1782,9 +1685,7 @@ find_answer (node, candidate) nonzero on failure, zero on success. On success, the result of the test is written into VALUE, otherwise the value 0. */ int -_cpp_test_assertion (pfile, value) - cpp_reader *pfile; - unsigned int *value; +_cpp_test_assertion (cpp_reader *pfile, unsigned int *value) { struct answer *answer; cpp_hashnode *node; @@ -1807,8 +1708,7 @@ _cpp_test_assertion (pfile, value) /* Handle #assert. */ static void -do_assert (pfile) - cpp_reader *pfile; +do_assert (cpp_reader *pfile) { struct answer *new_answer; cpp_hashnode *node; @@ -1841,8 +1741,7 @@ do_assert (pfile) /* Handle #unassert. */ static void -do_unassert (pfile) - cpp_reader *pfile; +do_unassert (cpp_reader *pfile) { cpp_hashnode *node; struct answer *answer; @@ -1880,9 +1779,7 @@ do_unassert (pfile) If STR has anything after the identifier, then it should be identifier=definition. */ void -cpp_define (pfile, str) - cpp_reader *pfile; - const char *str; +cpp_define (cpp_reader *pfile, const char *str) { char *buf, *p; size_t count; @@ -1910,9 +1807,7 @@ cpp_define (pfile, str) /* Slight variant of the above for use by initialize_builtins. */ void -_cpp_define_builtin (pfile, str) - cpp_reader *pfile; - const char *str; +_cpp_define_builtin (cpp_reader *pfile, const char *str) { size_t len = strlen (str); char *buf = alloca (len + 1); @@ -1923,9 +1818,7 @@ _cpp_define_builtin (pfile, str) /* Process MACRO as if it appeared as the body of an #undef. */ void -cpp_undef (pfile, macro) - cpp_reader *pfile; - const char *macro; +cpp_undef (cpp_reader *pfile, const char *macro) { size_t len = strlen (macro); char *buf = alloca (len + 1); @@ -1936,28 +1829,21 @@ cpp_undef (pfile, macro) /* Process the string STR as if it appeared as the body of a #assert. */ void -cpp_assert (pfile, str) - cpp_reader *pfile; - const char *str; +cpp_assert (cpp_reader *pfile, const char *str) { handle_assertion (pfile, str, T_ASSERT); } /* Process STR as if it appeared as the body of an #unassert. */ void -cpp_unassert (pfile, str) - cpp_reader *pfile; - const char *str; +cpp_unassert (cpp_reader *pfile, const char *str) { handle_assertion (pfile, str, T_UNASSERT); } /* Common code for cpp_assert (-A) and cpp_unassert (-A-). */ static void -handle_assertion (pfile, str, type) - cpp_reader *pfile; - const char *str; - int type; +handle_assertion (cpp_reader *pfile, const char *str, int type) { size_t count = strlen (str); const char *p = strchr (str, '='); @@ -1980,41 +1866,35 @@ handle_assertion (pfile, str, type) /* The number of errors for a given reader. */ unsigned int -cpp_errors (pfile) - cpp_reader *pfile; +cpp_errors (cpp_reader *pfile) { return pfile->errors; } /* The options structure. */ cpp_options * -cpp_get_options (pfile) - cpp_reader *pfile; +cpp_get_options (cpp_reader *pfile) { return &pfile->opts; } /* The callbacks structure. */ cpp_callbacks * -cpp_get_callbacks (pfile) - cpp_reader *pfile; +cpp_get_callbacks (cpp_reader *pfile) { return &pfile->cb; } /* The line map set. */ const struct line_maps * -cpp_get_line_maps (pfile) - cpp_reader *pfile; +cpp_get_line_maps (cpp_reader *pfile) { return &pfile->line_maps; } /* Copy the given callbacks structure to our own. */ void -cpp_set_callbacks (pfile, cb) - cpp_reader *pfile; - cpp_callbacks *cb; +cpp_set_callbacks (cpp_reader *pfile, cpp_callbacks *cb) { pfile->cb = *cb; } @@ -2023,12 +1903,8 @@ cpp_set_callbacks (pfile, cb) doesn't fail. It does not generate a file change call back; that is the responsibility of the caller. */ cpp_buffer * -cpp_push_buffer (pfile, buffer, len, from_stage3, return_at_eof) - cpp_reader *pfile; - const uchar *buffer; - size_t len; - int from_stage3; - int return_at_eof; +cpp_push_buffer (cpp_reader *pfile, const uchar *buffer, size_t len, + int from_stage3, int return_at_eof) { cpp_buffer *new = xobnew (&pfile->buffer_ob, cpp_buffer); @@ -2049,8 +1925,7 @@ cpp_push_buffer (pfile, buffer, len, from_stage3, return_at_eof) /* Pops a single buffer, with a file change call-back if appropriate. Then pushes the next -include file, if any remain. */ void -_cpp_pop_buffer (pfile) - cpp_reader *pfile; +_cpp_pop_buffer (cpp_reader *pfile) { cpp_buffer *buffer = pfile->buffer; struct include_file *inc = buffer->inc; @@ -2086,8 +1961,7 @@ _cpp_pop_buffer (pfile) /* Enter all recognized directives in the hash table. */ void -_cpp_init_directives (pfile) - cpp_reader *pfile; +_cpp_init_directives (cpp_reader *pfile) { unsigned int i; cpp_hashnode *node; diff --git a/gcc/cpplib.h b/gcc/cpplib.h index 4514252..0d74003 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -375,16 +375,16 @@ struct cpp_options struct cpp_callbacks { /* Called when a new line of preprocessed output is started. */ - void (*line_change) PARAMS ((cpp_reader *, const cpp_token *, int)); - void (*file_change) PARAMS ((cpp_reader *, const struct line_map *)); - void (*include) PARAMS ((cpp_reader *, unsigned int, - const unsigned char *, const char *, int)); - void (*define) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); - void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); - void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *)); - void (*def_pragma) PARAMS ((cpp_reader *, unsigned int)); - int (*valid_pch) PARAMS ((cpp_reader *, const char *, int)); - void (*read_pch) PARAMS ((cpp_reader *, const char *, int, const char *)); + void (*line_change) (cpp_reader *, const cpp_token *, int); + void (*file_change) (cpp_reader *, const struct line_map *); + void (*include) (cpp_reader *, unsigned int, const unsigned char *, + const char *, int); + void (*define) (cpp_reader *, unsigned int, cpp_hashnode *); + void (*undef) (cpp_reader *, unsigned int, cpp_hashnode *); + void (*ident) (cpp_reader *, unsigned int, const cpp_string *); + void (*def_pragma) (cpp_reader *, unsigned int); + int (*valid_pch) (cpp_reader *, const char *, int); + void (*read_pch) (cpp_reader *, const char *, int, const char *); }; /* Chain of directories to look for include files in. */ @@ -494,91 +494,83 @@ struct cpp_hashnode GTY(()) pointer. Otherwise you should pass in an initialized hash table that cpplib will share; this technique is used by the C front ends. */ -extern cpp_reader *cpp_create_reader PARAMS ((enum c_lang, struct ht *)); +extern cpp_reader *cpp_create_reader (enum c_lang, struct ht *); /* Call this to change the selected language standard (e.g. because of command line options). */ -extern void cpp_set_lang PARAMS ((cpp_reader *, enum c_lang)); +extern void cpp_set_lang (cpp_reader *, enum c_lang); /* Add a dependency TARGET. Quote it for "make" if QUOTE. Can be called any number of times before cpp_read_main_file(). If no targets have been added before cpp_read_main_file(), then the default target is used. */ -extern void cpp_add_dependency_target PARAMS ((cpp_reader *, - const char * target, - int quote)); +extern void cpp_add_dependency_target (cpp_reader *, const char *, int); /* Set the include paths. */ -extern void cpp_set_include_chains PARAMS ((cpp_reader *, cpp_path *, - cpp_path *, int)); +extern void cpp_set_include_chains (cpp_reader *, cpp_path *, cpp_path *, int); /* Call these to get pointers to the options and callback structures for a given reader. These pointers are good until you call cpp_finish on that reader. You can either edit the callbacks through the pointer returned from cpp_get_callbacks, or set them with cpp_set_callbacks. */ -extern cpp_options *cpp_get_options PARAMS ((cpp_reader *)); -extern const struct line_maps *cpp_get_line_maps PARAMS ((cpp_reader *)); -extern cpp_callbacks *cpp_get_callbacks PARAMS ((cpp_reader *)); -extern void cpp_set_callbacks PARAMS ((cpp_reader *, cpp_callbacks *)); +extern cpp_options *cpp_get_options (cpp_reader *); +extern const struct line_maps *cpp_get_line_maps (cpp_reader *); +extern cpp_callbacks *cpp_get_callbacks (cpp_reader *); +extern void cpp_set_callbacks (cpp_reader *, cpp_callbacks *); /* This function reads the file, but does not start preprocessing. It returns the name of the original file; this is the same as the input file, except for preprocessed input. This will generate at least one file change callback, and possibly a line change callback too. If there was an error opening the file, it returns NULL. */ -extern const char *cpp_read_main_file PARAMS ((cpp_reader *, const char *)); +extern const char *cpp_read_main_file (cpp_reader *, const char *); /* Set up built-ins like __FILE__. */ -extern void cpp_init_builtins PARAMS ((cpp_reader *, int)); +extern void cpp_init_builtins (cpp_reader *, int); /* Call this to finish preprocessing. If you requested dependency generation, pass an open stream to write the information to, otherwise NULL. It is your responsibility to close the stream. Returns cpp_errors (pfile). */ -extern int cpp_finish PARAMS ((cpp_reader *, FILE *deps_stream)); +extern int cpp_finish (cpp_reader *, FILE *deps_stream); /* Call this to release the handle at the end of preprocessing. Any use of the handle after this function returns is invalid. Returns cpp_errors (pfile). */ -extern void cpp_destroy PARAMS ((cpp_reader *)); +extern void cpp_destroy (cpp_reader *); /* Error count. */ -extern unsigned int cpp_errors PARAMS ((cpp_reader *)); - -extern unsigned int cpp_token_len PARAMS ((const cpp_token *)); -extern unsigned char *cpp_token_as_text PARAMS ((cpp_reader *, - const cpp_token *)); -extern unsigned char *cpp_spell_token PARAMS ((cpp_reader *, const cpp_token *, - unsigned char *)); -extern void cpp_register_pragma PARAMS ((cpp_reader *, - const char *, const char *, - void (*) PARAMS ((cpp_reader *)))); - -extern int cpp_avoid_paste PARAMS ((cpp_reader *, const cpp_token *, - const cpp_token *)); -extern const cpp_token *cpp_get_token PARAMS ((cpp_reader *)); -extern const unsigned char *cpp_macro_definition PARAMS ((cpp_reader *, - const cpp_hashnode *)); -extern void _cpp_backup_tokens PARAMS ((cpp_reader *, unsigned int)); +extern unsigned int cpp_errors (cpp_reader *); + +extern unsigned int cpp_token_len (const cpp_token *); +extern unsigned char *cpp_token_as_text (cpp_reader *, const cpp_token *); +extern unsigned char *cpp_spell_token (cpp_reader *, const cpp_token *, + unsigned char *); +extern void cpp_register_pragma (cpp_reader *, const char *, const char *, + void (*) (cpp_reader *)); +extern int cpp_avoid_paste (cpp_reader *, const cpp_token *, + const cpp_token *); +extern const cpp_token *cpp_get_token (cpp_reader *); +extern const unsigned char *cpp_macro_definition (cpp_reader *, + const cpp_hashnode *); +extern void _cpp_backup_tokens (cpp_reader *, unsigned int); /* Evaluate a CPP_CHAR or CPP_WCHAR token. */ -extern cppchar_t -cpp_interpret_charconst PARAMS ((cpp_reader *, const cpp_token *, - unsigned int *, int *)); +extern cppchar_t cpp_interpret_charconst (cpp_reader *, const cpp_token *, + unsigned int *, int *); /* Used to register macros and assertions, perhaps from the command line. The text is the same as the command line argument. */ -extern void cpp_define PARAMS ((cpp_reader *, const char *)); -extern void cpp_assert PARAMS ((cpp_reader *, const char *)); -extern void cpp_undef PARAMS ((cpp_reader *, const char *)); -extern void cpp_unassert PARAMS ((cpp_reader *, const char *)); +extern void cpp_define (cpp_reader *, const char *); +extern void cpp_assert (cpp_reader *, const char *); +extern void cpp_undef (cpp_reader *, const char *); +extern void cpp_unassert (cpp_reader *, const char *); -extern cpp_buffer *cpp_push_buffer PARAMS ((cpp_reader *, - const unsigned char *, size_t, - int, int)); -extern int cpp_defined PARAMS ((cpp_reader *, const unsigned char *, int)); +extern cpp_buffer *cpp_push_buffer (cpp_reader *, const unsigned char *, + size_t, int, int); +extern int cpp_defined (cpp_reader *, const unsigned char *, int); /* A preprocessing number. Code assumes that any unused high bits of the double integer are set to zero. */ @@ -619,15 +611,15 @@ struct cpp_num /* Classify a CPP_NUMBER token. The return value is a combination of the flags from the above sets. */ -extern unsigned cpp_classify_number PARAMS ((cpp_reader *, const cpp_token *)); +extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *); /* Evaluate a token classified as category CPP_N_INTEGER. */ -extern cpp_num cpp_interpret_integer PARAMS ((cpp_reader *, const cpp_token *, - unsigned int type)); +extern cpp_num cpp_interpret_integer (cpp_reader *, const cpp_token *, + unsigned int type); /* Sign extend a number, with PRECISION significant bits and all others assumed clear, to fill out a cpp_num structure. */ -cpp_num cpp_num_sign_extend PARAMS ((cpp_num, size_t)); +cpp_num cpp_num_sign_extend (cpp_num, size_t); /* Diagnostic levels. To get a diagnostic without associating a position in the translation unit with it, use cpp_error_with_line @@ -657,72 +649,64 @@ cpp_num cpp_num_sign_extend PARAMS ((cpp_num, size_t)); getting ridiculously oversized. */ /* Output a diagnostic of some kind. */ -extern void cpp_error PARAMS ((cpp_reader *, int, const char *msgid, ...)) +extern void cpp_error (cpp_reader *, int, const char *msgid, ...) ATTRIBUTE_PRINTF_3; -/* Output a diagnostic of severity LEVEL, with "MSG: " preceding the +/* Output a diagnostic with "MSGID: " preceding the error string of errno. No location is printed. */ -extern void cpp_errno PARAMS ((cpp_reader *, int level, const char *msg)); +extern void cpp_errno (cpp_reader *, int, const char *msgid); /* Same as cpp_error, except additionally specifies a position as a (translation unit) physical line and physical column. If the line is zero, then no location is printed. */ -extern void cpp_error_with_line PARAMS ((cpp_reader *, int, unsigned, unsigned, const char *msgid, ...)) +extern void cpp_error_with_line (cpp_reader *, int, unsigned, unsigned, const char *msgid, ...) ATTRIBUTE_PRINTF_5; /* In cpplex.c */ -extern int cpp_ideq PARAMS ((const cpp_token *, - const char *)); -extern void cpp_output_line PARAMS ((cpp_reader *, FILE *)); -extern void cpp_output_token PARAMS ((const cpp_token *, FILE *)); -extern const char *cpp_type2name PARAMS ((enum cpp_ttype)); +extern int cpp_ideq (const cpp_token *, const char *); +extern void cpp_output_line (cpp_reader *, FILE *); +extern void cpp_output_token (const cpp_token *, FILE *); +extern const char *cpp_type2name (enum cpp_ttype); /* Returns the value of an escape sequence, truncated to the correct target precision. PSTR points to the input pointer, which is just after the backslash. LIMIT is how much text we have. WIDE is true if the escape sequence is part of a wide character constant or string literal. Handles all relevant diagnostics. */ -extern cppchar_t cpp_parse_escape PARAMS ((cpp_reader *, - const unsigned char ** pstr, - const unsigned char *limit, - int wide)); +extern cppchar_t cpp_parse_escape (cpp_reader *, const unsigned char ** pstr, + const unsigned char *limit, int wide); /* In cpphash.c */ /* Lookup an identifier in the hashtable. Puts the identifier in the table if it is not already there. */ -extern cpp_hashnode *cpp_lookup PARAMS ((cpp_reader *, - const unsigned char *, - unsigned int)); +extern cpp_hashnode *cpp_lookup (cpp_reader *, const unsigned char *, + unsigned int); -typedef int (*cpp_cb) PARAMS ((cpp_reader *, cpp_hashnode *, void *)); -extern void cpp_forall_identifiers PARAMS ((cpp_reader *, - cpp_cb, void *)); +typedef int (*cpp_cb) (cpp_reader *, cpp_hashnode *, void *); +extern void cpp_forall_identifiers (cpp_reader *, cpp_cb, void *); /* In cppmacro.c */ -extern void cpp_scan_nooutput PARAMS ((cpp_reader *)); -extern int cpp_sys_macro_p PARAMS ((cpp_reader *)); -extern unsigned char *cpp_quote_string PARAMS ((unsigned char *, - const unsigned char *, - unsigned int)); +extern void cpp_scan_nooutput (cpp_reader *); +extern int cpp_sys_macro_p (cpp_reader *); +extern unsigned char *cpp_quote_string (unsigned char *, const unsigned char *, + unsigned int); /* In cppfiles.c */ -extern int cpp_included PARAMS ((cpp_reader *, const char *)); -extern void cpp_make_system_header PARAMS ((cpp_reader *, int, int)); -extern void cpp_simplify_path PARAMS ((char *)); -extern bool cpp_push_include PARAMS ((cpp_reader *, const char *)); -extern void cpp_change_file PARAMS ((cpp_reader *, enum lc_reason, - const char *)); +extern int cpp_included (cpp_reader *, const char *); +extern void cpp_make_system_header (cpp_reader *, int, int); +extern void cpp_simplify_path (char *); +extern bool cpp_push_include (cpp_reader *, const char *); +extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *); /* In cpppch.c */ struct save_macro_data; -extern int cpp_save_state PARAMS ((cpp_reader *, FILE *)); -extern int cpp_write_pch_deps PARAMS ((cpp_reader *, FILE *)); -extern int cpp_write_pch_state PARAMS ((cpp_reader *, FILE *)); -extern int cpp_valid_state PARAMS ((cpp_reader *, const char *, int)); -extern void cpp_prepare_state PARAMS ((cpp_reader *, - struct save_macro_data **)); -extern int cpp_read_state PARAMS ((cpp_reader *, const char *, FILE *, - struct save_macro_data *)); +extern int cpp_save_state (cpp_reader *, FILE *); +extern int cpp_write_pch_deps (cpp_reader *, FILE *); +extern int cpp_write_pch_state (cpp_reader *, FILE *); +extern int cpp_valid_state (cpp_reader *, const char *, int); +extern void cpp_prepare_state (cpp_reader *, struct save_macro_data **); +extern int cpp_read_state (cpp_reader *, const char *, FILE *, + struct save_macro_data *); #ifdef __cplusplus } diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index eba8c00..893dd21 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -42,47 +42,40 @@ struct macro_arg /* Macro expansion. */ -static int enter_macro_context PARAMS ((cpp_reader *, cpp_hashnode *)); -static int builtin_macro PARAMS ((cpp_reader *, cpp_hashnode *)); -static void push_token_context - PARAMS ((cpp_reader *, cpp_hashnode *, const cpp_token *, unsigned int)); -static void push_ptoken_context - PARAMS ((cpp_reader *, cpp_hashnode *, _cpp_buff *, - const cpp_token **, unsigned int)); -static _cpp_buff *collect_args PARAMS ((cpp_reader *, const cpp_hashnode *)); -static cpp_context *next_context PARAMS ((cpp_reader *)); -static const cpp_token *padding_token - PARAMS ((cpp_reader *, const cpp_token *)); -static void expand_arg PARAMS ((cpp_reader *, macro_arg *)); -static const cpp_token *new_string_token PARAMS ((cpp_reader *, uchar *, - unsigned int)); -static const cpp_token *stringify_arg PARAMS ((cpp_reader *, macro_arg *)); -static void paste_all_tokens PARAMS ((cpp_reader *, const cpp_token *)); -static bool paste_tokens PARAMS ((cpp_reader *, const cpp_token **, - const cpp_token *)); -static void replace_args PARAMS ((cpp_reader *, cpp_hashnode *, cpp_macro *, - macro_arg *)); -static _cpp_buff *funlike_invocation_p PARAMS ((cpp_reader *, cpp_hashnode *)); -static bool create_iso_definition PARAMS ((cpp_reader *, cpp_macro *)); +static int enter_macro_context (cpp_reader *, cpp_hashnode *); +static int builtin_macro (cpp_reader *, cpp_hashnode *); +static void push_token_context (cpp_reader *, cpp_hashnode *, + const cpp_token *, unsigned int); +static void push_ptoken_context (cpp_reader *, cpp_hashnode *, _cpp_buff *, + const cpp_token **, unsigned int); +static _cpp_buff *collect_args (cpp_reader *, const cpp_hashnode *); +static cpp_context *next_context (cpp_reader *); +static const cpp_token *padding_token (cpp_reader *, const cpp_token *); +static void expand_arg (cpp_reader *, macro_arg *); +static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int); +static const cpp_token *stringify_arg (cpp_reader *, macro_arg *); +static void paste_all_tokens (cpp_reader *, const cpp_token *); +static bool paste_tokens (cpp_reader *, const cpp_token **, const cpp_token *); +static void replace_args (cpp_reader *, cpp_hashnode *, cpp_macro *, + macro_arg *); +static _cpp_buff *funlike_invocation_p (cpp_reader *, cpp_hashnode *); +static bool create_iso_definition (cpp_reader *, cpp_macro *); /* #define directive parsing and handling. */ -static cpp_token *alloc_expansion_token PARAMS ((cpp_reader *, cpp_macro *)); -static cpp_token *lex_expansion_token PARAMS ((cpp_reader *, cpp_macro *)); -static bool warn_of_redefinition PARAMS ((cpp_reader *, const cpp_hashnode *, - const cpp_macro *)); -static bool parse_params PARAMS ((cpp_reader *, cpp_macro *)); -static void check_trad_stringification PARAMS ((cpp_reader *, - const cpp_macro *, - const cpp_string *)); +static cpp_token *alloc_expansion_token (cpp_reader *, cpp_macro *); +static cpp_token *lex_expansion_token (cpp_reader *, cpp_macro *); +static bool warn_of_redefinition (cpp_reader *, const cpp_hashnode *, + const cpp_macro *); +static bool parse_params (cpp_reader *, cpp_macro *); +static void check_trad_stringification (cpp_reader *, const cpp_macro *, + const cpp_string *); /* Emits a warning if NODE is a macro defined in the main file that has not been used. */ int -_cpp_warn_if_unused_macro (pfile, node, v) - cpp_reader *pfile; - cpp_hashnode *node; - void *v ATTRIBUTE_UNUSED; +_cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node, + void *v ATTRIBUTE_UNUSED) { if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN)) { @@ -100,10 +93,7 @@ _cpp_warn_if_unused_macro (pfile, node, v) /* Allocates and returns a CPP_STRING token, containing TEXT of length LEN, after null-terminating it. TEXT must be in permanent storage. */ static const cpp_token * -new_string_token (pfile, text, len) - cpp_reader *pfile; - unsigned char *text; - unsigned int len; +new_string_token (cpp_reader *pfile, unsigned char *text, unsigned int len) { cpp_token *token = _cpp_temp_token (pfile); @@ -126,9 +116,7 @@ static const char * const monthnames[] = is created. Returns 1 if it generates a new token context, 0 to return the token to the caller. */ const uchar * -_cpp_builtin_macro_text (pfile, node) - cpp_reader *pfile; - cpp_hashnode *node; +_cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node) { const uchar *result = NULL; unsigned int number = 1; @@ -221,7 +209,8 @@ _cpp_builtin_macro_text (pfile, node) pfile->date = _cpp_unaligned_alloc (pfile, sizeof ("\"Oct 11 1347\"")); sprintf ((char *) pfile->date, "\"%s %2d %4d\"", - monthnames[tb->tm_mon], tb->tm_mday, tb->tm_year + 1900); + monthnames[tb->tm_mon], tb->tm_mday, + tb->tm_year + 1900); pfile->time = _cpp_unaligned_alloc (pfile, sizeof ("\"12:34:56\"")); @@ -260,9 +249,7 @@ _cpp_builtin_macro_text (pfile, node) created. Returns 1 if it generates a new token context, 0 to return the token to the caller. */ static int -builtin_macro (pfile, node) - cpp_reader *pfile; - cpp_hashnode *node; +builtin_macro (cpp_reader *pfile, cpp_hashnode *node) { const uchar *buf; size_t len; @@ -304,10 +291,7 @@ builtin_macro (pfile, node) converted to octal. DEST must be of sufficient size. Returns a pointer to the end of the string. */ uchar * -cpp_quote_string (dest, src, len) - uchar *dest; - const uchar *src; - unsigned int len; +cpp_quote_string (uchar *dest, const uchar *src, unsigned int len) { while (len--) { @@ -336,9 +320,7 @@ cpp_quote_string (dest, src, len) /* Convert a token sequence ARG to a single string token according to the rules of the ISO C #-operator. */ static const cpp_token * -stringify_arg (pfile, arg) - cpp_reader *pfile; - macro_arg *arg; +stringify_arg (cpp_reader *pfile, macro_arg *arg) { unsigned char *dest; unsigned int i, escape_it, backslash_count = 0; @@ -425,9 +407,7 @@ stringify_arg (pfile, arg) case, PLHS is updated to point to the pasted token, which is guaranteed to not have the PASTE_LEFT flag set. */ static bool -paste_tokens (pfile, plhs, rhs) - cpp_reader *pfile; - const cpp_token **plhs, *rhs; +paste_tokens (cpp_reader *pfile, const cpp_token **plhs, const cpp_token *rhs) { unsigned char *buf, *end; const cpp_token *lhs; @@ -468,9 +448,7 @@ paste_tokens (pfile, plhs, rhs) successful pastes, with the effect that the RHS appears in the output stream after the pasted LHS normally. */ static void -paste_all_tokens (pfile, lhs) - cpp_reader *pfile; - const cpp_token *lhs; +paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs) { const cpp_token *rhs; cpp_context *context = pfile->context; @@ -516,11 +494,7 @@ paste_all_tokens (pfile, lhs) Note that MACRO cannot necessarily be deduced from NODE, in case NODE was redefined whilst collecting arguments. */ bool -_cpp_arguments_ok (pfile, macro, node, argc) - cpp_reader *pfile; - cpp_macro *macro; - const cpp_hashnode *node; - unsigned int argc; +_cpp_arguments_ok (cpp_reader *pfile, cpp_macro *macro, const cpp_hashnode *node, unsigned int argc) { if (argc == macro->paramc) return true; @@ -561,9 +535,7 @@ _cpp_arguments_ok (pfile, macro, node, argc) NULL. Each argument is terminated by a CPP_EOF token, for the future benefit of expand_arg(). */ static _cpp_buff * -collect_args (pfile, node) - cpp_reader *pfile; - const cpp_hashnode *node; +collect_args (cpp_reader *pfile, const cpp_hashnode *node) { _cpp_buff *buff, *base_buff; cpp_macro *macro; @@ -697,9 +669,7 @@ collect_args (pfile, node) intervening padding tokens. If we find the parenthesis, collect the arguments and return the buffer containing them. */ static _cpp_buff * -funlike_invocation_p (pfile, node) - cpp_reader *pfile; - cpp_hashnode *node; +funlike_invocation_p (cpp_reader *pfile, cpp_hashnode *node) { const cpp_token *token, *padding = NULL; @@ -739,9 +709,7 @@ funlike_invocation_p (pfile, node) containing its yet-to-be-rescanned replacement list and return one. Otherwise, we don't push a context and return zero. */ static int -enter_macro_context (pfile, node) - cpp_reader *pfile; - cpp_hashnode *node; +enter_macro_context (cpp_reader *pfile, cpp_hashnode *node) { /* The presence of a macro invalidates a file's controlling macro. */ pfile->mi_valid = false; @@ -800,11 +768,7 @@ enter_macro_context (pfile, node) Expand each argument before replacing, unless it is operated upon by the # or ## operators. */ static void -replace_args (pfile, node, macro, args) - cpp_reader *pfile; - cpp_hashnode *node; - cpp_macro *macro; - macro_arg *args; +replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg *args) { unsigned int i, total; const cpp_token *src, *limit; @@ -936,9 +900,7 @@ replace_args (pfile, node, macro, args) /* Return a special padding token, with padding inherited from SOURCE. */ static const cpp_token * -padding_token (pfile, source) - cpp_reader *pfile; - const cpp_token *source; +padding_token (cpp_reader *pfile, const cpp_token *source) { cpp_token *result = _cpp_temp_token (pfile); @@ -951,8 +913,7 @@ padding_token (pfile, source) /* Get a new uninitialized context. Create a new one if we cannot re-use an old one. */ static cpp_context * -next_context (pfile) - cpp_reader *pfile; +next_context (cpp_reader *pfile) { cpp_context *result = pfile->context->next; @@ -970,12 +931,8 @@ next_context (pfile) /* Push a list of pointers to tokens. */ static void -push_ptoken_context (pfile, macro, buff, first, count) - cpp_reader *pfile; - cpp_hashnode *macro; - _cpp_buff *buff; - const cpp_token **first; - unsigned int count; +push_ptoken_context (cpp_reader *pfile, cpp_hashnode *macro, _cpp_buff *buff, + const cpp_token **first, unsigned int count) { cpp_context *context = next_context (pfile); @@ -988,11 +945,8 @@ push_ptoken_context (pfile, macro, buff, first, count) /* Push a list of tokens. */ static void -push_token_context (pfile, macro, first, count) - cpp_reader *pfile; - cpp_hashnode *macro; - const cpp_token *first; - unsigned int count; +push_token_context (cpp_reader *pfile, cpp_hashnode *macro, + const cpp_token *first, unsigned int count) { cpp_context *context = next_context (pfile); @@ -1005,11 +959,8 @@ push_token_context (pfile, macro, first, count) /* Push a traditional macro's replacement text. */ void -_cpp_push_text_context (pfile, macro, start, len) - cpp_reader *pfile; - cpp_hashnode *macro; - const uchar *start; - size_t len; +_cpp_push_text_context (cpp_reader *pfile, cpp_hashnode *macro, + const uchar *start, size_t len) { cpp_context *context = next_context (pfile); @@ -1028,9 +979,7 @@ _cpp_push_text_context (pfile, macro, start, len) has terminated the argument's tokens with a CPP_EOF so that we know when we have fully expanded the argument. */ static void -expand_arg (pfile, arg) - cpp_reader *pfile; - macro_arg *arg; +expand_arg (cpp_reader *pfile, macro_arg *arg) { unsigned int capacity; bool saved_warn_trad; @@ -1076,8 +1025,7 @@ expand_arg (pfile, arg) context represented a macro's replacement list. The context structure is not freed so that we can re-use it later. */ void -_cpp_pop_context (pfile) - cpp_reader *pfile; +_cpp_pop_context (cpp_reader *pfile) { cpp_context *context = pfile->context; @@ -1102,8 +1050,7 @@ _cpp_pop_context (pfile) state.in_directive is still 1, and at the end of argument pre-expansion. */ const cpp_token * -cpp_get_token (pfile) - cpp_reader *pfile; +cpp_get_token (cpp_reader *pfile) { const cpp_token *result; @@ -1180,8 +1127,7 @@ cpp_get_token (pfile) defined in a system header. Just checks the macro at the top of the stack. Used for diagnostic suppression. */ int -cpp_sys_macro_p (pfile) - cpp_reader *pfile; +cpp_sys_macro_p (cpp_reader *pfile) { cpp_hashnode *node = pfile->context->macro; @@ -1191,8 +1137,7 @@ cpp_sys_macro_p (pfile) /* Read each token in, until end of the current file. Directives are transparently processed. */ void -cpp_scan_nooutput (pfile) - cpp_reader *pfile; +cpp_scan_nooutput (cpp_reader *pfile) { /* Request a CPP_EOF token at the end of this file, rather than transparently continuing with the including file. */ @@ -1209,9 +1154,7 @@ cpp_scan_nooutput (pfile) /* Step back one (or more) tokens. Can only step mack more than 1 if they are from the lexer, and not from macro expansion. */ void -_cpp_backup_tokens (pfile, count) - cpp_reader *pfile; - unsigned int count; +_cpp_backup_tokens (cpp_reader *pfile, unsigned int count) { if (pfile->context->prev == NULL) { @@ -1243,10 +1186,8 @@ _cpp_backup_tokens (pfile, count) /* Returns nonzero if a macro redefinition warning is required. */ static bool -warn_of_redefinition (pfile, node, macro2) - cpp_reader *pfile; - const cpp_hashnode *node; - const cpp_macro *macro2; +warn_of_redefinition (cpp_reader *pfile, const cpp_hashnode *node, + const cpp_macro *macro2) { const cpp_macro *macro1; unsigned int i; @@ -1287,8 +1228,7 @@ warn_of_redefinition (pfile, node, macro2) /* Free the definition of hashnode H. */ void -_cpp_free_definition (h) - cpp_hashnode *h; +_cpp_free_definition (cpp_hashnode *h) { /* Macros and assertions no longer have anything to free. */ h->type = NT_VOID; @@ -1299,10 +1239,7 @@ _cpp_free_definition (h) /* Save parameter NODE to the parameter list of macro MACRO. Returns zero on success, nonzero if the parameter is a duplicate. */ bool -_cpp_save_parameter (pfile, macro, node) - cpp_reader *pfile; - cpp_macro *macro; - cpp_hashnode *node; +_cpp_save_parameter (cpp_reader *pfile, cpp_macro *macro, cpp_hashnode *node) { unsigned int len; /* Constraint 6.10.3.6 - duplicate parameter names. */ @@ -1335,9 +1272,7 @@ _cpp_save_parameter (pfile, macro, node) /* Check the syntax of the parameters in a MACRO definition. Returns false if an error occurs. */ static bool -parse_params (pfile, macro) - cpp_reader *pfile; - cpp_macro *macro; +parse_params (cpp_reader *pfile, cpp_macro *macro) { unsigned int prev_ident = 0; @@ -1416,9 +1351,7 @@ parse_params (pfile, macro) /* Allocate room for a token from a macro's replacement list. */ static cpp_token * -alloc_expansion_token (pfile, macro) - cpp_reader *pfile; - cpp_macro *macro; +alloc_expansion_token (cpp_reader *pfile, cpp_macro *macro) { if (BUFF_ROOM (pfile->a_buff) < (macro->count + 1) * sizeof (cpp_token)) _cpp_extend_buff (pfile, &pfile->a_buff, sizeof (cpp_token)); @@ -1429,9 +1362,7 @@ alloc_expansion_token (pfile, macro) /* Lex a token from the expansion of MACRO, but mark parameters as we find them and warn of traditional stringification. */ static cpp_token * -lex_expansion_token (pfile, macro) - cpp_reader *pfile; - cpp_macro *macro; +lex_expansion_token (cpp_reader *pfile, cpp_macro *macro) { cpp_token *token; @@ -1453,9 +1384,7 @@ lex_expansion_token (pfile, macro) } static bool -create_iso_definition (pfile, macro) - cpp_reader *pfile; - cpp_macro *macro; +create_iso_definition (cpp_reader *pfile, cpp_macro *macro) { cpp_token *token; const cpp_token *ctoken; @@ -1524,7 +1453,7 @@ create_iso_definition (pfile, macro) if (macro->count == 0 || token->type == CPP_EOF) { cpp_error (pfile, DL_ERROR, - "'##' cannot appear at either end of a macro expansion"); + "'##' cannot appear at either end of a macro expansion"); return false; } @@ -1551,9 +1480,7 @@ create_iso_definition (pfile, macro) /* Parse a macro and save its expansion. Returns nonzero on success. */ bool -_cpp_create_definition (pfile, node) - cpp_reader *pfile; - cpp_hashnode *node; +_cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node) { cpp_macro *macro; unsigned int i; @@ -1634,10 +1561,8 @@ _cpp_create_definition (pfile, node) /* Warn if a token in STRING matches one of a function-like MACRO's parameters. */ static void -check_trad_stringification (pfile, macro, string) - cpp_reader *pfile; - const cpp_macro *macro; - const cpp_string *string; +check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro, + const cpp_string *string) { unsigned int i, len; const uchar *p, *q, *limit; @@ -1681,9 +1606,7 @@ check_trad_stringification (pfile, macro, string) Caller is expected to generate the "#define" bit if needed. The returned text is temporary, and automatically freed later. */ const unsigned char * -cpp_macro_definition (pfile, node) - cpp_reader *pfile; - const cpp_hashnode *node; +cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node) { unsigned int i, len; const cpp_macro *macro = node->value.macro; diff --git a/gcc/cpppch.c b/gcc/cpppch.c index 602711a..e87abea 100644 --- a/gcc/cpppch.c +++ b/gcc/cpppch.c @@ -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; diff --git a/gcc/cppspec.c b/gcc/cppspec.c index db15d7d..eb5205f 100644 --- a/gcc/cppspec.c +++ b/gcc/cppspec.c @@ -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. */ } diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c index f8923ae..0e4b231 100644 --- a/gcc/cpptrad.c +++ b/gcc/cpptrad.c @@ -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; |