1993-10-22 22:48:08 +01:00
|
|
|
|
/* fix-header.c - Make C header file suitable for C++.
|
2000-02-26 07:23:30 +01:00
|
|
|
|
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998,
|
2001-08-27 08:48:43 +02:00
|
|
|
|
1999, 2000, 2001 Free Software Foundation, Inc.
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
|
later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
1995-06-15 13:33:49 +02:00
|
|
|
|
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
/* This program massages a system include file (such as stdio.h),
|
1997-12-22 10:31:41 +01:00
|
|
|
|
into a form that is compatible with GNU C and GNU C++.
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
* extern "C" { ... } braces are added (inside #ifndef __cplusplus),
|
1993-10-12 23:58:40 +01:00
|
|
|
|
if they seem to be needed. These prevent C++ compilers from name
|
1993-07-26 02:11:20 +02:00
|
|
|
|
mangling the functions inside the braces.
|
|
|
|
|
|
|
|
|
|
* If an old-style incomplete function declaration is seen (without
|
|
|
|
|
an argument list), and it is a "standard" function listed in
|
|
|
|
|
the file sys-protos.h (and with a non-empty argument list), then
|
|
|
|
|
the declaration is converted to a complete prototype by replacing
|
1998-03-18 08:18:06 +01:00
|
|
|
|
the empty parameter list with the argument list from sys-protos.h.
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
* The program can be given a list of (names of) required standard
|
1995-05-16 14:39:54 +02:00
|
|
|
|
functions (such as fclose for stdio.h). If a required function
|
1993-07-26 02:11:20 +02:00
|
|
|
|
is not seen in the input, then a prototype for it will be
|
|
|
|
|
written to the output.
|
|
|
|
|
|
|
|
|
|
* If all of the non-comment code of the original file is protected
|
|
|
|
|
against multiple inclusion:
|
|
|
|
|
#ifndef FOO
|
|
|
|
|
#define FOO
|
|
|
|
|
<body of include file>
|
|
|
|
|
#endif
|
|
|
|
|
then extra matter added to the include file is placed inside the <body>.
|
|
|
|
|
|
|
|
|
|
* If the input file is OK (nothing needs to be done);
|
|
|
|
|
the output file is not written (nor removed if it exists).
|
|
|
|
|
|
|
|
|
|
There are also some special actions that are done for certain
|
|
|
|
|
well-known standard include files:
|
|
|
|
|
|
|
|
|
|
* If argv[1] is "sys/stat.h", the Posix.1 macros
|
|
|
|
|
S_ISBLK, S_ISCHR, S_ISDIR, S_ISFIFO, S_ISLNK, S_ISREG are added if
|
|
|
|
|
they were missing, and the corresponding "traditional" S_IFxxx
|
|
|
|
|
macros were defined.
|
|
|
|
|
|
|
|
|
|
* If argv[1] is "errno.h", errno is declared if it was missing.
|
|
|
|
|
|
|
|
|
|
* TODO: The input file should be read complete into memory, because:
|
|
|
|
|
a) it needs to be scanned twice anyway, and
|
|
|
|
|
b) it would be nice to allow update in place.
|
|
|
|
|
|
|
|
|
|
Usage:
|
1995-04-05 23:16:26 +02:00
|
|
|
|
fix-header FOO.H INFILE.H OUTFILE.H [OPTIONS]
|
1993-07-26 02:11:20 +02:00
|
|
|
|
where:
|
|
|
|
|
* FOO.H is the relative file name of the include file,
|
|
|
|
|
as it would be #include'd by a C file. (E.g. stdio.h)
|
|
|
|
|
* INFILE.H is a full pathname for the input file (e.g. /usr/include/stdio.h)
|
|
|
|
|
* OUTFILE.H is the full pathname for where to write the output file,
|
|
|
|
|
if anything needs to be done. (e.g. ./include/stdio.h)
|
1995-04-05 23:16:26 +02:00
|
|
|
|
* OPTIONS are such as you would pass to cpp.
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
Written by Per Bothner <bothner@cygnus.com>, July 1993. */
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1993-10-27 02:52:20 +01:00
|
|
|
|
#include "hconfig.h"
|
More cutover to system.h:
* Makefile.in (cppalloc.o, cpperror.o, cppexp.o, cpphash.o,
cpplib.o, cppmain.o, fix-header.o, gcov.o, gen-protos.o,
gengenrtl.o, halfpic.o, hash.o, scan-decls.o, scan.o): Depend on
system.h.
* cpphash.c: Include config.h.
* cppalloc.c: Include system.h. Add parameters to various
function prototypes.
* cpperror.c: Likewise.
* cppexp.c: Likewise.
* cpphash.c: Likewise.
* cpplib.c: Likewise.
* cppmain.c: Likewise.
* fix-header.c: Likewise.
* gcov.c: Likewise.
* gen-protos.c: Likewise.
* gengenrtl.c: Likewise.
* halfpic.c: Likewise.
* hash.c: Likewise.
* scan-decls.c: Likewise.
* scan.c: Likewise.
From-SVN: r18911
1998-03-30 14:05:54 +02:00
|
|
|
|
#include "system.h"
|
1993-07-26 02:11:20 +02:00
|
|
|
|
#include "obstack.h"
|
|
|
|
|
#include "scan.h"
|
1995-04-05 23:16:26 +02:00
|
|
|
|
#include "cpplib.h"
|
1996-04-15 19:58:45 +02:00
|
|
|
|
|
2000-11-19 14:15:51 +01:00
|
|
|
|
static void v_fatal PARAMS ((const char *, va_list)) ATTRIBUTE_PRINTF (1,0) ATTRIBUTE_NORETURN;
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static void fatal PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
|
1996-06-07 09:32:32 +02:00
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
sstring buf;
|
1994-03-22 01:04:34 +01:00
|
|
|
|
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int verbose = 0;
|
|
|
|
|
int partial_count = 0;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
int warnings = 0;
|
|
|
|
|
|
|
|
|
|
/* We no longer need to add extern "C", because cpp implicitly
|
|
|
|
|
forces the standard include files to be treated as C. */
|
|
|
|
|
/*#define ADD_MISSING_EXTERN_C 1 */
|
|
|
|
|
|
|
|
|
|
#if ADD_MISSING_EXTERN_C
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int missing_extern_C_count = 0;
|
1993-12-22 20:29:00 +01:00
|
|
|
|
#endif
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
#include "xsys-protos.h"
|
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
#ifdef FIXPROTO_IGNORE_LIST
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* This is a currently unused feature. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
|
|
|
|
/* List of files and directories to ignore.
|
|
|
|
|
A directory name (ending in '/') means ignore anything in that
|
|
|
|
|
directory. (It might be more efficient to do directory pruning
|
|
|
|
|
earlier in fixproto, but this is simpler and easier to customize.) */
|
|
|
|
|
|
collect2.c (is_ctor_dtor): Const-ify.
* collect2.c (is_ctor_dtor): Const-ify.
* m88k-protos.c (output_file_start): Likewise.
* m88k.c (m88k_lang_independent_options, output_options,
output_file_start): Likewise.
* fix-header.c (files_to_ignore, std_include_entry, include_entry,
std_include_table, main): Likewise.
* protoize.c (longopts): Likewise.
* regclass.c (int_reg_class_contents): Likewise.
* toplev.c (dump_file, f_options, W_options): Make static.
(lang_independent_options, f_options, W_options): Const-ify.
* tree-dump.c (dump_file_info): Likewise.
* unroll.c (_factor): Make static.
java:
* chartables.h: Const-ify.
* gjavah.c (options): Likewise.
* jcf-dump.c (options): Likewise.
* jv-scan.c (options): Likewise.
* lex.c (java_start_char_p, java_part_char_p): Likewise.
* parse.y (binop_lookup): Likewise.
From-SVN: r48322
2001-12-27 04:35:21 +01:00
|
|
|
|
static const char *const files_to_ignore[] = {
|
1995-04-05 23:16:26 +02:00
|
|
|
|
"X11/",
|
|
|
|
|
FIXPROTO_IGNORE_LIST
|
|
|
|
|
0
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
1993-10-12 23:58:40 +01:00
|
|
|
|
char *inf_buffer;
|
|
|
|
|
char *inf_limit;
|
|
|
|
|
char *inf_ptr;
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
static const char *cur_file;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
|
1993-07-26 02:11:20 +02:00
|
|
|
|
/* Certain standard files get extra treatment */
|
|
|
|
|
|
|
|
|
|
enum special_file
|
|
|
|
|
{
|
|
|
|
|
no_special,
|
1998-04-19 08:48:07 +02:00
|
|
|
|
#ifdef errno_h
|
|
|
|
|
#undef errno_h
|
|
|
|
|
#endif
|
1995-04-05 23:16:26 +02:00
|
|
|
|
errno_h,
|
1998-04-19 08:48:07 +02:00
|
|
|
|
#ifdef stdio_h
|
|
|
|
|
#undef stdio_h
|
|
|
|
|
#endif
|
1995-04-05 23:16:26 +02:00
|
|
|
|
stdio_h,
|
1998-04-19 08:48:07 +02:00
|
|
|
|
#ifdef stdlib_h
|
|
|
|
|
#undef stdlib_h
|
|
|
|
|
#endif
|
1995-12-27 23:28:33 +01:00
|
|
|
|
stdlib_h,
|
1998-04-19 08:48:07 +02:00
|
|
|
|
#ifdef sys_stat_h
|
|
|
|
|
#undef sys_stat_h
|
|
|
|
|
#endif
|
1995-04-05 23:16:26 +02:00
|
|
|
|
sys_stat_h
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* A NAMELIST is a sequence of names, separated by '\0', and terminated
|
1996-07-04 00:07:53 +02:00
|
|
|
|
by an empty name (i.e. by "\0\0"). */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
typedef const char *namelist;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* The following macros provide the bits for symbol_flags. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
typedef int symbol_flags;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Used to mark names defined in the ANSI/ISO C standard. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
#define ANSI_SYMBOL 1
|
|
|
|
|
|
1997-12-22 10:31:41 +01:00
|
|
|
|
/* We no longer massage include files for POSIX or XOPEN symbols,
|
|
|
|
|
as there are now several versions of the POSIX and XOPEN standards,
|
|
|
|
|
and it would be a maintenance nightmare for us to track them all.
|
|
|
|
|
Better to be compatible with the system include files. */
|
|
|
|
|
/*#define ADD_MISSING_POSIX 1 */
|
|
|
|
|
/*#define ADD_MISSING_XOPEN 1 */
|
|
|
|
|
|
|
|
|
|
#if ADD_MISSING_POSIX
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Used to mark names defined in the Posix.1 or Posix.2 standard. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
#define POSIX1_SYMBOL 2
|
|
|
|
|
#define POSIX2_SYMBOL 4
|
1997-12-22 10:31:41 +01:00
|
|
|
|
#else
|
|
|
|
|
#define POSIX1_SYMBOL 0
|
|
|
|
|
#define POSIX2_SYMBOL 0
|
|
|
|
|
#endif
|
1995-12-15 08:43:33 +01:00
|
|
|
|
|
1997-12-22 10:31:41 +01:00
|
|
|
|
#if ADD_MISSING_XOPEN
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Used to mark names defined in X/Open Portability Guide. */
|
1995-12-27 23:28:33 +01:00
|
|
|
|
#define XOPEN_SYMBOL 8
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Used to mark names defined in X/Open UNIX Extensions. */
|
1995-12-27 23:28:33 +01:00
|
|
|
|
#define XOPEN_EXTENDED_SYMBOL 16
|
1997-12-22 10:31:41 +01:00
|
|
|
|
#else
|
|
|
|
|
#define XOPEN_SYMBOL 0
|
|
|
|
|
#define XOPEN_EXTENDED_SYMBOL 0
|
|
|
|
|
#endif
|
1995-12-27 23:28:33 +01:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
/* Used to indicate names that are not functions */
|
1995-12-27 23:28:33 +01:00
|
|
|
|
#define MACRO_SYMBOL 512
|
1995-12-15 08:43:33 +01:00
|
|
|
|
|
|
|
|
|
struct symbol_list {
|
|
|
|
|
symbol_flags flags;
|
|
|
|
|
namelist names;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
};
|
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
#define SYMBOL_TABLE_SIZE 10
|
|
|
|
|
struct symbol_list symbol_table[SYMBOL_TABLE_SIZE];
|
|
|
|
|
int cur_symbol_table_size;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
2000-01-14 18:14:43 +01:00
|
|
|
|
static void add_symbols PARAMS ((symbol_flags, namelist));
|
|
|
|
|
static struct fn_decl *lookup_std_proto PARAMS ((const char *, int));
|
|
|
|
|
static void write_lbrac PARAMS ((void));
|
|
|
|
|
static void recognized_macro PARAMS ((const char *));
|
|
|
|
|
static void check_macro_names PARAMS ((cpp_reader *, namelist));
|
|
|
|
|
static void read_scan_file PARAMS ((char *, int, char **));
|
|
|
|
|
static void write_rbrac PARAMS ((void));
|
|
|
|
|
static int inf_skip_spaces PARAMS ((int));
|
|
|
|
|
static int inf_read_upto PARAMS ((sstring *, int));
|
|
|
|
|
static int inf_scan_ident PARAMS ((sstring *, int));
|
|
|
|
|
static int check_protection PARAMS ((int *, int *));
|
2001-08-12 11:49:44 +02:00
|
|
|
|
static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *));
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
|
|
|
|
|
static void
|
1995-12-15 08:43:33 +01:00
|
|
|
|
add_symbols (flags, names)
|
|
|
|
|
symbol_flags flags;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
namelist names;
|
|
|
|
|
{
|
1995-12-15 08:43:33 +01:00
|
|
|
|
symbol_table[cur_symbol_table_size].flags = flags;
|
|
|
|
|
symbol_table[cur_symbol_table_size].names = names;
|
|
|
|
|
cur_symbol_table_size++;
|
|
|
|
|
if (cur_symbol_table_size >= SYMBOL_TABLE_SIZE)
|
|
|
|
|
fatal ("too many calls to add_symbols");
|
1996-07-04 00:07:53 +02:00
|
|
|
|
symbol_table[cur_symbol_table_size].names = NULL; /* Termination. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
struct std_include_entry {
|
collect2.c (is_ctor_dtor): Const-ify.
* collect2.c (is_ctor_dtor): Const-ify.
* m88k-protos.c (output_file_start): Likewise.
* m88k.c (m88k_lang_independent_options, output_options,
output_file_start): Likewise.
* fix-header.c (files_to_ignore, std_include_entry, include_entry,
std_include_table, main): Likewise.
* protoize.c (longopts): Likewise.
* regclass.c (int_reg_class_contents): Likewise.
* toplev.c (dump_file, f_options, W_options): Make static.
(lang_independent_options, f_options, W_options): Const-ify.
* tree-dump.c (dump_file_info): Likewise.
* unroll.c (_factor): Make static.
java:
* chartables.h: Const-ify.
* gjavah.c (options): Likewise.
* jcf-dump.c (options): Likewise.
* jv-scan.c (options): Likewise.
* lex.c (java_start_char_p, java_part_char_p): Likewise.
* parse.y (binop_lookup): Likewise.
From-SVN: r48322
2001-12-27 04:35:21 +01:00
|
|
|
|
const char *const name;
|
|
|
|
|
const symbol_flags flags;
|
|
|
|
|
const namelist names;
|
1995-12-15 08:43:33 +01:00
|
|
|
|
};
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
const char NONE[] = ""; /* The empty namelist. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Special name to indicate a continuation line in std_include_table. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
const char CONTINUED[] = "";
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
collect2.c (is_ctor_dtor): Const-ify.
* collect2.c (is_ctor_dtor): Const-ify.
* m88k-protos.c (output_file_start): Likewise.
* m88k.c (m88k_lang_independent_options, output_options,
output_file_start): Likewise.
* fix-header.c (files_to_ignore, std_include_entry, include_entry,
std_include_table, main): Likewise.
* protoize.c (longopts): Likewise.
* regclass.c (int_reg_class_contents): Likewise.
* toplev.c (dump_file, f_options, W_options): Make static.
(lang_independent_options, f_options, W_options): Const-ify.
* tree-dump.c (dump_file_info): Likewise.
* unroll.c (_factor): Make static.
java:
* chartables.h: Const-ify.
* gjavah.c (options): Likewise.
* jcf-dump.c (options): Likewise.
* jv-scan.c (options): Likewise.
* lex.c (java_start_char_p, java_part_char_p): Likewise.
* parse.y (binop_lookup): Likewise.
From-SVN: r48322
2001-12-27 04:35:21 +01:00
|
|
|
|
const struct std_include_entry *include_entry;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
collect2.c (is_ctor_dtor): Const-ify.
* collect2.c (is_ctor_dtor): Const-ify.
* m88k-protos.c (output_file_start): Likewise.
* m88k.c (m88k_lang_independent_options, output_options,
output_file_start): Likewise.
* fix-header.c (files_to_ignore, std_include_entry, include_entry,
std_include_table, main): Likewise.
* protoize.c (longopts): Likewise.
* regclass.c (int_reg_class_contents): Likewise.
* toplev.c (dump_file, f_options, W_options): Make static.
(lang_independent_options, f_options, W_options): Const-ify.
* tree-dump.c (dump_file_info): Likewise.
* unroll.c (_factor): Make static.
java:
* chartables.h: Const-ify.
* gjavah.c (options): Likewise.
* jcf-dump.c (options): Likewise.
* jv-scan.c (options): Likewise.
* lex.c (java_start_char_p, java_part_char_p): Likewise.
* parse.y (binop_lookup): Likewise.
From-SVN: r48322
2001-12-27 04:35:21 +01:00
|
|
|
|
const struct std_include_entry std_include_table [] = {
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "ctype.h", ANSI_SYMBOL,
|
1995-04-05 23:16:26 +02:00
|
|
|
|
"isalnum\0isalpha\0iscntrl\0isdigit\0isgraph\0islower\0\
|
1995-12-15 08:43:33 +01:00
|
|
|
|
isprint\0ispunct\0isspace\0isupper\0isxdigit\0tolower\0toupper\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "dirent.h", POSIX1_SYMBOL, "closedir\0opendir\0readdir\0rewinddir\0"},
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "errno.h", ANSI_SYMBOL|MACRO_SYMBOL, "errno\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* ANSI_SYMBOL is wrong, but ... */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "curses.h", ANSI_SYMBOL, "box\0delwin\0endwin\0getcurx\0getcury\0initscr\0\
|
1995-04-05 23:16:26 +02:00
|
|
|
|
mvcur\0mvwprintw\0mvwscanw\0newwin\0overlay\0overwrite\0\
|
|
|
|
|
scroll\0subwin\0touchwin\0waddstr\0wclear\0wclrtobot\0wclrtoeol\0\
|
|
|
|
|
waddch\0wdelch\0wdeleteln\0werase\0wgetch\0wgetstr\0winsch\0winsertln\0\
|
1995-12-15 08:43:33 +01:00
|
|
|
|
wmove\0wprintw\0wrefresh\0wscanw\0wstandend\0wstandout\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "fcntl.h", POSIX1_SYMBOL, "creat\0fcntl\0open\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
|
|
|
|
/* Maybe also "getgrent fgetgrent setgrent endgrent" */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "grp.h", POSIX1_SYMBOL, "getgrgid\0getgrnam\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
|
|
|
|
/*{ "limit.h", ... provided by gcc }, */
|
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "locale.h", ANSI_SYMBOL, "localeconv\0setlocale\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "math.h", ANSI_SYMBOL,
|
|
|
|
|
"acos\0asin\0atan\0atan2\0ceil\0cos\0cosh\0exp\0\
|
1995-04-05 23:16:26 +02:00
|
|
|
|
fabs\0floor\0fmod\0frexp\0ldexp\0log10\0log\0modf\0pow\0sin\0sinh\0sqrt\0\
|
1995-12-15 08:43:33 +01:00
|
|
|
|
tan\0tanh\0" },
|
|
|
|
|
|
|
|
|
|
{ CONTINUED, ANSI_SYMBOL|MACRO_SYMBOL, "HUGE_VAL\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "pwd.h", POSIX1_SYMBOL, "getpwnam\0getpwuid\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Left out siglongjmp sigsetjmp - these depend on sigjmp_buf. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "setjmp.h", ANSI_SYMBOL, "longjmp\0setjmp\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
|
|
|
|
/* Left out signal() - its prototype is too complex for us!
|
|
|
|
|
Also left out "sigaction sigaddset sigdelset sigemptyset
|
|
|
|
|
sigfillset sigismember sigpending sigprocmask sigsuspend"
|
|
|
|
|
because these need sigset_t or struct sigaction.
|
1996-07-04 00:07:53 +02:00
|
|
|
|
Most systems that provide them will also declare them. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "signal.h", ANSI_SYMBOL, "kill\0raise\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "stdio.h", ANSI_SYMBOL,
|
|
|
|
|
"clearerr\0fclose\0feof\0ferror\0fflush\0fgetc\0fgetpos\0\
|
1995-04-05 23:16:26 +02:00
|
|
|
|
fgets\0fopen\0fprintf\0fputc\0fputs\0fread\0freopen\0fscanf\0fseek\0\
|
1997-12-22 10:31:41 +01:00
|
|
|
|
fsetpos\0ftell\0fwrite\0getc\0getchar\0gets\0perror\0\
|
1995-04-05 23:16:26 +02:00
|
|
|
|
printf\0putc\0putchar\0puts\0remove\0rename\0rewind\0scanf\0setbuf\0\
|
|
|
|
|
setvbuf\0sprintf\0sscanf\0vprintf\0vsprintf\0vfprintf\0tmpfile\0\
|
1995-12-15 08:43:33 +01:00
|
|
|
|
tmpnam\0ungetc\0" },
|
|
|
|
|
{ CONTINUED, POSIX1_SYMBOL, "fdopen\0fileno\0" },
|
1996-07-04 00:07:53 +02:00
|
|
|
|
{ CONTINUED, POSIX2_SYMBOL, "pclose\0popen\0" }, /* I think ... */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
/* Should perhaps also handle NULL, EOF, ... ? */
|
|
|
|
|
|
|
|
|
|
/* "div ldiv", - ignored because these depend on div_t, ldiv_t
|
|
|
|
|
ignore these: "mblen mbstowcs mbstowc wcstombs wctomb"
|
|
|
|
|
Left out getgroups, because SunOS4 has incompatible BSD and SVR4 versions.
|
|
|
|
|
Should perhaps also add NULL */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "stdlib.h", ANSI_SYMBOL,
|
|
|
|
|
"abort\0abs\0atexit\0atof\0atoi\0atol\0bsearch\0calloc\0\
|
1995-04-05 23:16:26 +02:00
|
|
|
|
exit\0free\0getenv\0labs\0malloc\0putenv\0qsort\0rand\0realloc\0\
|
1995-12-15 08:43:33 +01:00
|
|
|
|
srand\0strtod\0strtol\0strtoul\0system\0" },
|
1995-12-27 23:28:33 +01:00
|
|
|
|
{ CONTINUED, ANSI_SYMBOL|MACRO_SYMBOL, "EXIT_FAILURE\0EXIT_SUCCESS\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "string.h", ANSI_SYMBOL, "memchr\0memcmp\0memcpy\0memmove\0memset\0\
|
1995-04-05 23:16:26 +02:00
|
|
|
|
strcat\0strchr\0strcmp\0strcoll\0strcpy\0strcspn\0strerror\0\
|
|
|
|
|
strlen\0strncat\0strncmp\0strncpy\0strpbrk\0strrchr\0strspn\0strstr\0\
|
1995-12-15 08:43:33 +01:00
|
|
|
|
strtok\0strxfrm\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
/* Should perhaps also add NULL and size_t */
|
|
|
|
|
|
1995-12-27 23:28:33 +01:00
|
|
|
|
{ "strings.h", XOPEN_EXTENDED_SYMBOL,
|
|
|
|
|
"bcmp\0bcopy\0bzero\0ffs\0index\0rindex\0strcasecmp\0strncasecmp\0" },
|
|
|
|
|
|
|
|
|
|
{ "strops.h", XOPEN_EXTENDED_SYMBOL, "ioctl\0" },
|
|
|
|
|
|
|
|
|
|
/* Actually, XPG4 does not seem to have <sys/ioctl.h>, but defines
|
|
|
|
|
ioctl in <strops.h>. However, many systems have it is sys/ioctl.h,
|
1996-07-04 00:07:53 +02:00
|
|
|
|
and many systems do have <sys/ioctl.h> but not <strops.h>. */
|
1995-12-27 23:28:33 +01:00
|
|
|
|
{ "sys/ioctl.h", XOPEN_EXTENDED_SYMBOL, "ioctl\0" },
|
|
|
|
|
|
|
|
|
|
{ "sys/socket.h", XOPEN_EXTENDED_SYMBOL, "socket\0" },
|
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "sys/stat.h", POSIX1_SYMBOL,
|
|
|
|
|
"chmod\0fstat\0mkdir\0mkfifo\0stat\0lstat\0umask\0" },
|
|
|
|
|
{ CONTINUED, POSIX1_SYMBOL|MACRO_SYMBOL,
|
1995-04-05 23:16:26 +02:00
|
|
|
|
"S_ISDIR\0S_ISBLK\0S_ISCHR\0S_ISFIFO\0S_ISREG\0S_ISLNK\0S_IFDIR\0\
|
|
|
|
|
S_IFBLK\0S_IFCHR\0S_IFIFO\0S_IFREG\0S_IFLNK\0" },
|
1995-12-27 23:28:33 +01:00
|
|
|
|
{ CONTINUED, XOPEN_EXTENDED_SYMBOL, "fchmod\0" },
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
/* How do we handle fd_set? */
|
|
|
|
|
{ "sys/time.h", XOPEN_EXTENDED_SYMBOL, "select\0" },
|
|
|
|
|
{ "sys/select.h", XOPEN_EXTENDED_SYMBOL /* fake */, "select\0" },
|
|
|
|
|
#endif
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "sys/times.h", POSIX1_SYMBOL, "times\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
/* "sys/types.h" add types (not in old g++-include) */
|
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "sys/utsname.h", POSIX1_SYMBOL, "uname\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "sys/wait.h", POSIX1_SYMBOL, "wait\0waitpid\0" },
|
|
|
|
|
{ CONTINUED, POSIX1_SYMBOL|MACRO_SYMBOL,
|
1995-04-05 23:16:26 +02:00
|
|
|
|
"WEXITSTATUS\0WIFEXITED\0WIFSIGNALED\0WIFSTOPPED\0WSTOPSIG\0\
|
|
|
|
|
WTERMSIG\0WNOHANG\0WNOTRACED\0" },
|
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "tar.h", POSIX1_SYMBOL, NONE },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "termios.h", POSIX1_SYMBOL,
|
|
|
|
|
"cfgetispeed\0cfgetospeed\0cfsetispeed\0cfsetospeed\0tcdrain\0tcflow\0tcflush\0tcgetattr\0tcsendbreak\0tcsetattr\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "time.h", ANSI_SYMBOL,
|
|
|
|
|
"asctime\0clock\0ctime\0difftime\0gmtime\0localtime\0mktime\0strftime\0time\0tzset\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ "unistd.h", POSIX1_SYMBOL,
|
|
|
|
|
"_exit\0access\0alarm\0chdir\0chown\0close\0ctermid\0cuserid\0\
|
1995-04-05 23:16:26 +02:00
|
|
|
|
dup\0dup2\0execl\0execle\0execlp\0execv\0execve\0execvp\0fork\0fpathconf\0\
|
1995-12-15 08:43:33 +01:00
|
|
|
|
getcwd\0getegid\0geteuid\0getgid\0getlogin\0getpgrp\0getpid\0\
|
1995-04-05 23:16:26 +02:00
|
|
|
|
getppid\0getuid\0isatty\0link\0lseek\0pathconf\0pause\0pipe\0read\0rmdir\0\
|
|
|
|
|
setgid\0setpgid\0setsid\0setuid\0sleep\0sysconf\0tcgetpgrp\0tcsetpgrp\0\
|
1995-12-15 08:43:33 +01:00
|
|
|
|
ttyname\0unlink\0write\0" },
|
|
|
|
|
{ CONTINUED, POSIX2_SYMBOL, "getopt\0" },
|
1995-12-27 23:28:33 +01:00
|
|
|
|
{ CONTINUED, XOPEN_EXTENDED_SYMBOL,
|
1998-09-02 15:18:27 +02:00
|
|
|
|
"lockf\0gethostid\0gethostname\0readlink\0symlink\0" },
|
1995-12-27 23:28:33 +01:00
|
|
|
|
|
|
|
|
|
{ "utime.h", POSIX1_SYMBOL, "utime\0" },
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
{ NULL, 0, NONE }
|
1993-07-26 02:11:20 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum special_file special_file_handling = no_special;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* They are set if the corresponding macro has been seen. */
|
1995-12-27 23:28:33 +01:00
|
|
|
|
/* The following are only used when handling sys/stat.h */
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int seen_S_IFBLK = 0, seen_S_ISBLK = 0;
|
|
|
|
|
int seen_S_IFCHR = 0, seen_S_ISCHR = 0;
|
|
|
|
|
int seen_S_IFDIR = 0, seen_S_ISDIR = 0;
|
|
|
|
|
int seen_S_IFIFO = 0, seen_S_ISFIFO = 0;
|
|
|
|
|
int seen_S_IFLNK = 0, seen_S_ISLNK = 0;
|
|
|
|
|
int seen_S_IFREG = 0, seen_S_ISREG = 0;
|
1995-12-27 23:28:33 +01:00
|
|
|
|
/* The following are only used when handling errno.h */
|
|
|
|
|
int seen_errno = 0;
|
|
|
|
|
/* The following are only used when handling stdlib.h */
|
|
|
|
|
int seen_EXIT_FAILURE = 0, seen_EXIT_SUCCESS = 0;
|
1993-11-11 16:50:52 +01:00
|
|
|
|
|
1993-07-26 02:11:20 +02:00
|
|
|
|
#define obstack_chunk_alloc xmalloc
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
#define obstack_chunk_free free
|
1993-07-26 02:11:20 +02:00
|
|
|
|
struct obstack scan_file_obstack;
|
|
|
|
|
|
|
|
|
|
/* NOTE: If you edit this, also edit gen-protos.c !! */
|
1996-07-04 00:07:53 +02:00
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static struct fn_decl *
|
1995-04-05 23:16:26 +02:00
|
|
|
|
lookup_std_proto (name, name_length)
|
|
|
|
|
const char *name;
|
|
|
|
|
int name_length;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
2000-02-08 22:27:02 +01:00
|
|
|
|
int i = hashstr (name, name_length) % HASH_SIZE;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int i0 = i;
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
struct fn_decl *fn;
|
|
|
|
|
if (hash_tab[i] == 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
fn = &std_protos[hash_tab[i]];
|
1998-10-17 22:26:29 +02:00
|
|
|
|
if ((int) strlen (fn->fname) == name_length
|
1995-04-05 23:16:26 +02:00
|
|
|
|
&& strncmp (fn->fname, name, name_length) == 0)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
return fn;
|
|
|
|
|
i = (i+1) % HASH_SIZE;
|
|
|
|
|
if (i == i0)
|
1993-10-20 22:33:01 +01:00
|
|
|
|
abort ();
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *inc_filename;
|
|
|
|
|
int inc_filename_length;
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
const char *progname = "fix-header";
|
1993-07-26 02:11:20 +02:00
|
|
|
|
FILE *outf;
|
|
|
|
|
sstring line;
|
|
|
|
|
|
|
|
|
|
int lbrac_line, rbrac_line;
|
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
int required_unseen_count = 0;
|
1995-12-27 23:28:33 +01:00
|
|
|
|
int required_other = 0;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
2002-05-17 20:07:01 +02:00
|
|
|
|
static void
|
1993-07-26 02:11:20 +02:00
|
|
|
|
write_lbrac ()
|
|
|
|
|
{
|
2002-05-17 20:07:01 +02:00
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
#if ADD_MISSING_EXTERN_C
|
1993-10-21 02:07:39 +01:00
|
|
|
|
if (missing_extern_C_count + required_unseen_count > 0)
|
|
|
|
|
fprintf (outf, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
|
1993-12-22 20:29:00 +01:00
|
|
|
|
#endif
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
if (partial_count)
|
|
|
|
|
{
|
|
|
|
|
fprintf (outf, "#ifndef _PARAMS\n");
|
|
|
|
|
fprintf (outf, "#if defined(__STDC__) || defined(__cplusplus)\n");
|
|
|
|
|
fprintf (outf, "#define _PARAMS(ARGS) ARGS\n");
|
|
|
|
|
fprintf (outf, "#else\n");
|
|
|
|
|
fprintf (outf, "#define _PARAMS(ARGS) ()\n");
|
|
|
|
|
fprintf (outf, "#endif\n#endif /* _PARAMS */\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct partial_proto
|
|
|
|
|
{
|
|
|
|
|
struct partial_proto *next;
|
|
|
|
|
struct fn_decl *fn;
|
|
|
|
|
int line_seen;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct partial_proto *partial_proto_list = NULL;
|
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
struct partial_proto required_dummy_proto, seen_dummy_proto;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
#define REQUIRED(FN) ((FN)->partial == &required_dummy_proto)
|
|
|
|
|
#define SET_REQUIRED(FN) ((FN)->partial = &required_dummy_proto)
|
1995-04-05 23:16:26 +02:00
|
|
|
|
#define SET_SEEN(FN) ((FN)->partial = &seen_dummy_proto)
|
|
|
|
|
#define SEEN(FN) ((FN)->partial == &seen_dummy_proto)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static void
|
1993-10-12 23:58:40 +01:00
|
|
|
|
recognized_macro (fname)
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
const char *fname;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* The original include file defines fname as a macro. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
struct fn_decl *fn = lookup_std_proto (fname, strlen (fname));
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Since fname is a macro, don't require a prototype for it. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (fn)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (REQUIRED (fn))
|
|
|
|
|
required_unseen_count--;
|
|
|
|
|
SET_SEEN (fn);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1993-10-12 23:58:40 +01:00
|
|
|
|
switch (special_file_handling)
|
|
|
|
|
{
|
1995-04-05 23:16:26 +02:00
|
|
|
|
case errno_h:
|
1995-12-27 23:28:33 +01:00
|
|
|
|
if (strcmp (fname, "errno") == 0 && !seen_errno)
|
|
|
|
|
seen_errno = 1, required_other--;
|
|
|
|
|
break;
|
|
|
|
|
case stdlib_h:
|
|
|
|
|
if (strcmp (fname, "EXIT_FAILURE") == 0 && !seen_EXIT_FAILURE)
|
|
|
|
|
seen_EXIT_FAILURE = 1, required_other--;
|
|
|
|
|
if (strcmp (fname, "EXIT_SUCCESS") == 0 && !seen_EXIT_SUCCESS)
|
|
|
|
|
seen_EXIT_SUCCESS = 1, required_other--;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
break;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
case sys_stat_h:
|
1993-10-12 23:58:40 +01:00
|
|
|
|
if (fname[0] == 'S' && fname[1] == '_')
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
1993-10-12 23:58:40 +01:00
|
|
|
|
if (strcmp (fname, "S_IFBLK") == 0) seen_S_IFBLK++;
|
|
|
|
|
else if (strcmp (fname, "S_ISBLK") == 0) seen_S_ISBLK++;
|
|
|
|
|
else if (strcmp (fname, "S_IFCHR") == 0) seen_S_IFCHR++;
|
|
|
|
|
else if (strcmp (fname, "S_ISCHR") == 0) seen_S_ISCHR++;
|
|
|
|
|
else if (strcmp (fname, "S_IFDIR") == 0) seen_S_IFDIR++;
|
|
|
|
|
else if (strcmp (fname, "S_ISDIR") == 0) seen_S_ISDIR++;
|
|
|
|
|
else if (strcmp (fname, "S_IFIFO") == 0) seen_S_IFIFO++;
|
|
|
|
|
else if (strcmp (fname, "S_ISFIFO") == 0) seen_S_ISFIFO++;
|
|
|
|
|
else if (strcmp (fname, "S_IFLNK") == 0) seen_S_IFLNK++;
|
|
|
|
|
else if (strcmp (fname, "S_ISLNK") == 0) seen_S_ISLNK++;
|
|
|
|
|
else if (strcmp (fname, "S_IFREG") == 0) seen_S_IFREG++;
|
|
|
|
|
else if (strcmp (fname, "S_ISREG") == 0) seen_S_ISREG++;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
1997-12-22 10:31:41 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1993-10-12 23:58:40 +01:00
|
|
|
|
void
|
top level:
2000-07-03 Zack Weinberg <zack@wolery.cumb.org>
* fix-header.c (struct partial_proto): Remove unnecessary fields.
(recognized_extern, recognized_function, read_scan_file):
Update for new scheme.
(check_protection): It's still a multiple include guard even
if it doesn't always trigger.
* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
new scheme.
* scan.h: Declare struct cpp_token. Update prototypes.
2000-07-03 Neil Booth <neilb@earthling.net>
Zack Weinberg <zack@wolery.cumb.org>
Complete overhaul of the lexer and macro expander.
* cpphash.c (object_defn, funct_defn, push_macro_expansion,
arg, arglist, argdata, reflist, collect_objlike_expansion,
collect_funlike_expansion, collect_params,
warn_trad_stringify, trad_stringify, duplicate_arg_p, add_pat,
unsafe_chars, macarg, compare_defs, special_symbol,
scan_arguments, stringify, funlike_macroexpand,
_cpp_quote_string, monthnames): Delete.
(cpp_lookup, _cpp_free_definition, dump_funlike_macro,
_cpp_create_definition, _cpp_dump_definition,
dump_hash_helper): Adjust.
(find_param, count_params, parse_define, var_args_str,
check_macro_redefinition, save_expansion): New.
* cpplex.c (skip_block_comment, skip_line_comment, parse_name,
parse_string, output_line_command, trigraph_replace,
lex_line, cpp_push_buffer, cpp_pop_buffer, cpp_output_tokens,
cpp_scan_buffer_nooutput, cpp_scan_buffer, cpp_free_toklist,
cpp_idcmp, _cpp_get_directive_token, _cpp_init_input_buffer,
_cpp_skip_rest_of_line): Modify.
(maybe_macroexpand, skip_comment, copy_comment, skip_string,
find_position, null_warning, bump_column, expand_name_space,
pedantic_whitespace, _cpp_output_list, _cpp_slice_toklist,
_cpp_squeeze_toklist, _cpp_scan_until, _cpp_skip_hspace,
_cpp_parse_name, _cpp_lex_token, cpp_get_non_space_token,
_cpp_prescan): Delete.
(dump_param_spelling, process_directive, lex_next,
is_macro_disabled, stringify_arg, expand_context_stack,
output_token, make_string_token, alloc_number_token,
special_symbol, duplicate_token, maybe_paste_with_next,
can_paste, prevent_macro_expansion, restore_macro_expansion,
get_temp_token, release_temp_tokens, quote_string,
token_names, token_spellings, _cpp_expand_name_space,
_cpp_glue_header_name, _cpp_reserve_name_space,
digraph_spellings, trigraph_ok, skip_whitespace, save_comment,
placemarker_token, eof_token, cpp_context, macro_args,
get_raw_token, parse_arg, parse_args, save_token,
push_arg_context, push_macro_context, pop_context,
do_pop_context, free_macro_args, _cpp_get_line,
_cpp_run_directive): New.
* cpplib.c (validate_else, parse_include, push_conditional,
pass_thru_directive, read_line_number, parse_ifdef,
detect_if_not_defined, _cpp_check_directive, do_define,
do_undef, do_include, do_import, do_include_next, do_error,
do_warning, do_ident, do_pragma, pragma_dispatch, gcc_pragmas,
top_pragmas, do_pragma_gcc, do_pragma_implementation,
do_pragma_poison, do_pragma_system_header,
do_pragma_dependency, do_sccs, do_ifdef, do_ifndef, do_else,
dl_elif, do_endif, _cpp_unwind_if_stack, do_assert,
do_unassert, cpp_define, cpp_undef, cpp_assert, cpp_unassert,
cpp_defined): Update for new scheme.
(strtoul_for_line, get_define_node, dump_macro_name,
_cpp_check_linemarker, _cpp_parse_assertion): New.
(_cpp_handle_directive, do_pragma_default): Delete.
* cpphash.h (struct predicate): Now struct answer.
(enum spell_type, struct token_spelling, struct directive,
directive_handler): New.
Update prototypes. Remove unused macros.
* cpplib.h: Update prototypes. Remove unused macros,
structure definitions, and fields.
* cpperror.c (print_containing_files, v_message): Adjust.
* cppexp.c (parse_assertion, lex, parse_escape,
_cpp_parse_expr): Adjust.
* cppfiles.c (open_include_file, _cpp_execute_include,
_cpp_compare_file_date, cpp_read_file, read_include_file):
Adjust.
* cppinit.c (dump_special_to_buffer): Delete.
(append_include_chain, merge_include_chains, cpp_reader_init,
cpp_cleanup, initialize_builtins, builtin_array, cpp_start_read,
cpp_finish, handle_option, print_help): Adjust.
* cppmain.c (main): Adjust.
testsuite:
2000-07-03 Zack Weinberg <zack@wolery.cumb.org>
* testsuite/gcc.dg/cpp/19951025-1.c: Adjust regexps.
* testsuite/gcc.dg/cpp/19990703-1.c: Likewise.
* testsuite/gcc.dg/cpp/20000625-1.c: Likewise.
* testsuite/gcc.dg/cpp/20000625-2.c: Likewise.
* testsuite/gcc.dg/cpp/macro1.c,
testsuite/gcc.dg/cpp/paste1.c, testsuite/gcc.dg/cpp/paste2.c,
testsuite/gcc.dg/cpp/paste3.c, testsuite/gcc.dg/cpp/paste4.c,
testsuite/gcc.dg/cpp/strify1.c,
testsuite/gcc.dg/cpp/strify2.c: New tests.
From-SVN: r34859
2000-07-04 03:58:21 +02:00
|
|
|
|
recognized_extern (name)
|
|
|
|
|
const cpp_token *name;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
{
|
|
|
|
|
switch (special_file_handling)
|
|
|
|
|
{
|
1995-04-05 23:16:26 +02:00
|
|
|
|
case errno_h:
|
cpplib.h (struct cpp_name): Now struct cpp_string.
* cpplib.h (struct cpp_name): Now struct cpp_string.
(CPP_INT, CPP_FLOAT, CPP_NUMBER, CPP_COMMENT,
CPP_HEADER_NAME): Change to type S.
(struct cpp_token): Rename 'name' field to 'str'. Add 'node'
field, a cpp_hashnode *. All references to val.name updated
to use val.str or val.node as appropriate.
(struct cpp_reader): Add spec_nodes field.
(cpp_idcmp): Now cpp_ideq; takes a token * and a char *.
* cpphash.h (struct spec_nodes): New.
(enum spell_type): Reorder. Only SPELL_STRING tokens use
val.str. All references to 'spelling > SPELL_NONE' updated to
match.
(CPP_IN_SYSTEM_HEADER): Check pfile->buffer and
pfile->buffer->inc are not NULL before dereferencing them.
* cpplex.c (parse_name): Take a pointer to the current token,
plus current position and limit as args; return the new
position; don't copy the text of a name into the string
buffer, instead call cpp_lookup and store the node pointer.
If extending a token, copy out the text of the old into a
scratch buffer, append the new, look that up and store the new
node pointer. Inline.
(maybe_paste_with_next): If the result of paste is a NAME,
then look up the pasted text and store its node pointer.
(lex_line): Adjust for new parse_name interface.
Check for L"str", L'str' using spec_nodes->n_L.
(spell_token): SPELL_IDENT tokens have their spelling in
val.node->name. Handle SPELL_STRING tokens that don't have
string delimiters.
(_cpp_expand_name_space,
(can_paste): Check for L ## "str" using spec_nodes->n_L.
(cpp_get_token, special_symbol): No need to call cpp_lookup.
(cpp_idcmp): Now cpp_ideq; take a token * and a const char *;
return 1=equal 0=not, not a tristate.
* cpphash.c (var_args_str): Delete.
(find_param): Compare node fields directly.
(is__va_args__): Use CPP_PEDANTIC. Just compare
token->val.node with spec_nodes->n__VA_ARGS__.
(dump_funlike_macro): Don't use var_args_str.
* cpplib.c (_cpp_check_directive): Just walk through
spec_nodes->dirs comparing pointers.
(get_define_node, do_pragma_poison, detect_if_not_defined,
parse_ifdef): The identifier has already been looked up.
(do_ifdef, do_ifndef): parse_ifdef won't return a poisoned
node.
(do_if): Only call detect_if_not_defined at beginning of file.
(_cpp_parse_assertion): Only copy string pointers for
SPELL_STRING tokens.
(pragma_dispatch): Take a node pointer and examine its name
field.
(_cpp_init_stacks): Also initialize the spec_nodes structure.
* cppinit.c (cpp_reader_init): Call _cpp_init_stacks after
_cpp_init_macros.
(cpp_cleanup): Free pfile->spec_nodes. Call _cpp_cleanup_* in
reverse order from the corresponding _cpp_init_* routines.
* cppexp.c (parse_number, parse_charconst, parse_defined,
lex): Check val.node->type instead of calling cpp_defined.
Use spec_nodes entries where appropriate.
* fix-header.c, scan-decls.c: Update for interface changes.
From-SVN: r34926
2000-07-08 21:00:39 +02:00
|
|
|
|
if (cpp_ideq (name, "errno"))
|
1995-12-27 23:28:33 +01:00
|
|
|
|
seen_errno = 1, required_other--;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
break;
|
1997-12-22 10:31:41 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1993-10-12 23:58:40 +01:00
|
|
|
|
/* Called by scan_decls if it saw a function definition for a function
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
named FNAME. KIND is 'I' for an inline function; 'F' if a normal
|
|
|
|
|
function declaration preceded by 'extern "C"' (or nested inside
|
|
|
|
|
'extern "C"' braces); or 'f' for other function declarations. */
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1993-10-12 23:58:40 +01:00
|
|
|
|
void
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
recognized_function (fname, line, kind, have_arg_list)
|
top level:
2000-07-03 Zack Weinberg <zack@wolery.cumb.org>
* fix-header.c (struct partial_proto): Remove unnecessary fields.
(recognized_extern, recognized_function, read_scan_file):
Update for new scheme.
(check_protection): It's still a multiple include guard even
if it doesn't always trigger.
* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
new scheme.
* scan.h: Declare struct cpp_token. Update prototypes.
2000-07-03 Neil Booth <neilb@earthling.net>
Zack Weinberg <zack@wolery.cumb.org>
Complete overhaul of the lexer and macro expander.
* cpphash.c (object_defn, funct_defn, push_macro_expansion,
arg, arglist, argdata, reflist, collect_objlike_expansion,
collect_funlike_expansion, collect_params,
warn_trad_stringify, trad_stringify, duplicate_arg_p, add_pat,
unsafe_chars, macarg, compare_defs, special_symbol,
scan_arguments, stringify, funlike_macroexpand,
_cpp_quote_string, monthnames): Delete.
(cpp_lookup, _cpp_free_definition, dump_funlike_macro,
_cpp_create_definition, _cpp_dump_definition,
dump_hash_helper): Adjust.
(find_param, count_params, parse_define, var_args_str,
check_macro_redefinition, save_expansion): New.
* cpplex.c (skip_block_comment, skip_line_comment, parse_name,
parse_string, output_line_command, trigraph_replace,
lex_line, cpp_push_buffer, cpp_pop_buffer, cpp_output_tokens,
cpp_scan_buffer_nooutput, cpp_scan_buffer, cpp_free_toklist,
cpp_idcmp, _cpp_get_directive_token, _cpp_init_input_buffer,
_cpp_skip_rest_of_line): Modify.
(maybe_macroexpand, skip_comment, copy_comment, skip_string,
find_position, null_warning, bump_column, expand_name_space,
pedantic_whitespace, _cpp_output_list, _cpp_slice_toklist,
_cpp_squeeze_toklist, _cpp_scan_until, _cpp_skip_hspace,
_cpp_parse_name, _cpp_lex_token, cpp_get_non_space_token,
_cpp_prescan): Delete.
(dump_param_spelling, process_directive, lex_next,
is_macro_disabled, stringify_arg, expand_context_stack,
output_token, make_string_token, alloc_number_token,
special_symbol, duplicate_token, maybe_paste_with_next,
can_paste, prevent_macro_expansion, restore_macro_expansion,
get_temp_token, release_temp_tokens, quote_string,
token_names, token_spellings, _cpp_expand_name_space,
_cpp_glue_header_name, _cpp_reserve_name_space,
digraph_spellings, trigraph_ok, skip_whitespace, save_comment,
placemarker_token, eof_token, cpp_context, macro_args,
get_raw_token, parse_arg, parse_args, save_token,
push_arg_context, push_macro_context, pop_context,
do_pop_context, free_macro_args, _cpp_get_line,
_cpp_run_directive): New.
* cpplib.c (validate_else, parse_include, push_conditional,
pass_thru_directive, read_line_number, parse_ifdef,
detect_if_not_defined, _cpp_check_directive, do_define,
do_undef, do_include, do_import, do_include_next, do_error,
do_warning, do_ident, do_pragma, pragma_dispatch, gcc_pragmas,
top_pragmas, do_pragma_gcc, do_pragma_implementation,
do_pragma_poison, do_pragma_system_header,
do_pragma_dependency, do_sccs, do_ifdef, do_ifndef, do_else,
dl_elif, do_endif, _cpp_unwind_if_stack, do_assert,
do_unassert, cpp_define, cpp_undef, cpp_assert, cpp_unassert,
cpp_defined): Update for new scheme.
(strtoul_for_line, get_define_node, dump_macro_name,
_cpp_check_linemarker, _cpp_parse_assertion): New.
(_cpp_handle_directive, do_pragma_default): Delete.
* cpphash.h (struct predicate): Now struct answer.
(enum spell_type, struct token_spelling, struct directive,
directive_handler): New.
Update prototypes. Remove unused macros.
* cpplib.h: Update prototypes. Remove unused macros,
structure definitions, and fields.
* cpperror.c (print_containing_files, v_message): Adjust.
* cppexp.c (parse_assertion, lex, parse_escape,
_cpp_parse_expr): Adjust.
* cppfiles.c (open_include_file, _cpp_execute_include,
_cpp_compare_file_date, cpp_read_file, read_include_file):
Adjust.
* cppinit.c (dump_special_to_buffer): Delete.
(append_include_chain, merge_include_chains, cpp_reader_init,
cpp_cleanup, initialize_builtins, builtin_array, cpp_start_read,
cpp_finish, handle_option, print_help): Adjust.
* cppmain.c (main): Adjust.
testsuite:
2000-07-03 Zack Weinberg <zack@wolery.cumb.org>
* testsuite/gcc.dg/cpp/19951025-1.c: Adjust regexps.
* testsuite/gcc.dg/cpp/19990703-1.c: Likewise.
* testsuite/gcc.dg/cpp/20000625-1.c: Likewise.
* testsuite/gcc.dg/cpp/20000625-2.c: Likewise.
* testsuite/gcc.dg/cpp/macro1.c,
testsuite/gcc.dg/cpp/paste1.c, testsuite/gcc.dg/cpp/paste2.c,
testsuite/gcc.dg/cpp/paste3.c, testsuite/gcc.dg/cpp/paste4.c,
testsuite/gcc.dg/cpp/strify1.c,
testsuite/gcc.dg/cpp/strify2.c: New tests.
From-SVN: r34859
2000-07-04 03:58:21 +02:00
|
|
|
|
const cpp_token *fname;
|
New macro expander.
2000-10-28 Neil Booth <neilb@earthling.net>
New macro expander.
* cpplib.c (struct answer): New.
(struct if_stack): Use cpp_lexer_pos rather than line and col.
Rename cmacro mi_cmacro.
(struct directive, KANDR, STDC89, EXTENSION, COND, IF_COND, INCL,
IN_I): New directive and flags.
(skip_rest_of_line, check_eol, run_directive, glue_header_name,
parse_answer, parse_assertion, find_answer): New functions.
(parse_ifdef, detect_if_not_defined, validate_else): Remove.
(lex_macro_node): New function to replace parse_ifdef and
get_define_node.
(_cpp_handle_directive): New function, combines _cpp_check_directive
and _cpp_check_linemarker.
(do_define, do_undef, parse_include, do_include, do_import,
do_include_next, read_line_number, do_line, do_ident, do_pragma,
do_pragma_once, do_pragma_poison, do_pragma_dependency):
Update for new token getting interface.
(do_ifdef, do_ifndef, do_if, do_else, do_endif, push_conditional)
: Update for new multiple-include optimisation technique.
(do_elif): Don't forget to invalidate controlling macros.
(unwind_if_stack, cpp_defined, cpp_push_buffer, cpp_pop_buffer): Update.
(parse_assertion, parse_answer, find_answer, _cpp_test_assertion):
Functions to handle assertions with the new token interface.
(do_assert, do_unassert): Use them.
(cpp_define, _cpp_define_builtin, cpp_undef, cpp_assert, cpp_unassert):
Use run_directive.
(_cpp_init_stacks): Register directive names. Don't register special
nodes.
* cpperror.c (print_containing_files, _cpp_begin_message): Update to
new position recording regime.
(cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Update for _cpp_begin_message changes.
(cpp_type2name): Move to cpplex.c.
* cppexp.c (parse_charconst): spec_nodes is no longer a pointer.
(parse_defined): Update to handle new multiple include optimisation
method. Remove poisoned identifier warning.
(parse_assertion, TYPE_NAME): Delete.
(lex): Update for multiple include optimisation, removal of
CPP_DEFINED, to use _cpp_test_assertion for assertions and
cpp_token_as_text.
(_cpp_parse_expr): Update for MI optimisation, and to use op_as_text.
(op_as_text): New function, to wrap cpp_token_as_text.
* cppfiles.c (stack_include_file, _cpp_pop_file_buffer):
Update for MI optimisation.
(_cpp_execute_include): Take a token rather than 3 arguments. Fix
segfault on diagnostic.
(_cpp_compare_file_date): Take a token rather than 3 args.
(cpp_read_file): Work correctly for zero-length files.
* cpphash.c (_cpp_init_macros, _cpp_cleanup_macros): Rename
_cpp_init_hashtable and _cpp_cleanup_hashtable.
(cpp_lookup): Place identifiers at front of identifier pool
for _cpp_lookup_with_hash.
(_cpp_lookup_with_hash): Require identifiers to be at the front of
the identifier pool. Commit the memory if not already in the
hash table.
* cppinit.c (cpp_reader_init): Move cpp_init_completed test to top.
Initialise various members of cpp_reader, memory pools, and the
special nodes.
(cpp_printer_init): Delete.
(cpp_cleanup): Update.
(struct builtin, builtin_array, initialize_builtins): Update for new
hashnode definition and builtin handling.
(cpp_start_read, cpp_finish): Don't take or initialise a
printer. Update.
* cpplib.h (cpp_printer, cpp_toklist, CPP_DEFINED, BOL,
PASTED, VAR_ARGS, BEG_OF_FILE, IN_DIRECTIVE, KNOWN_DIRECTIVE,
T_VOID, T_SPECLINE, T_DATE, T_FILE, T_BASE_FILE, T_INCLUDE_LEVEL,
T_TIME, T_STDC, T_OPERATOR, T_POISON, T_MACRO, T_ASSERTION): Delete.
(struct cpp_pool, struct cpp_macro, struct cpp_lexer_pos,
struct cpp_lookahead, CPP_DHASH, enum mi_state, enum mi_ind,
NO_EXPAND, VARARGS_FIRST, struct cpp_token_with_pos,
struct toklist, struct cpp_context, struct specnodes,
TOKEN_LOOKAHEAD, TOKEN_BUFFSIZE, NODE_OPERATOR, NODE_POISONED,
NODE_BUILTIN, NODE_DIAGNOSTIC, NT_VOID, NT_MACRO, NT_ASSERTION,
enum builtin_type, cpp_can_paste): New.
(struct cpp_token): Delete line and col members.
(struct cpp_buffer): New member output_lineno.
(struct lexer_state): Delete indented, in_lex_line, seen_dot.
Add va_args_ok, poisoned_ok, prevent_expansion, parsing_args.
(struct cpp_reader): New members lexer_pos, macro_pos, directive_pos,
ident_pool, temp_string_pool, macro_pool, argument_pool, string_pool,
base_context, context, directive, mi_state, mi_if_not_defined,
mi_lexed, mi_cmacro, mi_ind_cmacro, la_read, la_write, la_unused,
mlstring_pos, macro_buffer, macro_buffer_len.
Delete members mls_line, mls_column, token_list, potential_control_macro,
temp_tokens, temp_cap, temp_alloced, temp_used, first_directive_token,
context_cap, cur_context, no_expand_level, paste_level, contexts, args,
save_parameter_spellings, need_newline, .
Change type of date, time and spec_nodes members.
Change prototypes for include and ident callbacks.
(struct cpp_hashnode): Change type of name. Remove union members
expansion and code. Add members macro, operator and builtin.
(cpp_token_len, cpp_token_as_text, cpp_spell_token, cpp_start_read,
cpp_finish, cpp_avoid_paste, cpp_get_token, cpp_get_line,
cpp_get_output_line, cpp_macro_definition, cpp_start_lookahead,
cpp_stop_lookahead): New prototypes.
(cpp_printer_init, cpp_dump_definition): Delete prototypes.
(U_CHAR, U, ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr, ufputs):
Move from cpphash.h.
* cpphash.h (U_CHAR, U, ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr,
ufputs): Move to cpplib.h.
(enum spell_type, struct token_spelling, _cpp_token_spellings, TOKEN_SPELL,
TOKEN_NAME, struct answer, FREE_ANSWER, KANDR, STDC89, EXTENSION,
COND, EXPAND, INCL, COMMENTS, IN_I, struct directive, directive_handler,
struct spec_nodes, _cpp_digraph_spellings, _cpp_free_temp_tokens,
_cpp_init_input_buffer, _cpp_grow_token_buffer, _cpp_init_toklist,
_cpp_clear_toklist, _cpp_expand_token_space, _cpp_expand_name_space,
_cpp_equiv_tokens, _cpp_equiv_toklists, _cpp_process_directive,
_cpp_run_directive, _cpp_get_line, _cpp_get_raw_token, _cpp_glue_header_name,
_cpp_can_paste, _cpp_check_directive, _cpp_check_linemarker,
_cpp_parse_assertion, _cpp_find_answer): Delete.
(VALID_SIGN, ALIGN, POOL_FRONT, POOL_LIMIT, POOL_BASE, POOL_SIZE,
POOL_USED, POOL_COMMIT, struct cpp_chunk, _cpp_lex_token, _cpp_init_pool,
_cpp_free_pool, _cpp_pool_reserve, _cpp_pool_alloc, _cpp_next_chunk,
_cpp_lock_pool, _cpp_unlock_pool, _cpp_test_assertion,
_cpp_handle_directive, DSC): New.
(struct include_file): New member defined.
(DO_NOT_REREAD, _cpp_begin_message, _cpp_execute_include,
_cpp_compare_file_date): Update.
(_cpp_pop_context, _cpp_get_token, _cpp_free_lookaheads, _cpp_push_token): New.
(_cpp_init_macros, _cpp_cleanup_macros): Rename to _cpp_init_hashtable,
_cpp_cleanup_hashtable.
* Makefile.in: Remove cppoutput.c.
* cppoutput.c: Delete
* fixheader.c (read_scan_file): Update for new cpp_get_token
prototype.
(recognized_function): New argument LINE.
* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
new cpp_get_token prototype.
* scan.h (recognized_function): Update prototype.
* po/POTFILES.in: Remove cppoutput.c.
From-SVN: r37098
2000-10-28 19:59:06 +02:00
|
|
|
|
unsigned int line;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
int kind; /* One of 'f' 'F' or 'I' */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
int have_arg_list;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
{
|
|
|
|
|
struct partial_proto *partial;
|
|
|
|
|
int i;
|
|
|
|
|
struct fn_decl *fn;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
#if ADD_MISSING_EXTERN_C
|
1993-10-12 23:58:40 +01:00
|
|
|
|
if (kind == 'f')
|
|
|
|
|
missing_extern_C_count++;
|
1993-12-22 20:29:00 +01:00
|
|
|
|
#endif
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
cppexp.c (lex): Use NODE_NAME and NODE_LEN.
* cppexp.c (lex): Use NODE_NAME and NODE_LEN.
* cpphash.c (_cpp_lookup_with_hash): Similarly.
* cpplex.c (cpp_ideq, parse_identifier, cpp_token_len,
cpp_spell_token, cpp_output_token): Similarly.
* cpplib.c (lex_macro_node, do_undef, do_pragma,
do_pragma_poison, parse_assertion, do_assert): Similarly.
* cppmacro.c (builtin_macro, parse_args, funlike_invocation_p,
save_parameter, _cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Similarly.
* cppmain.c (cb_define, cb_undef, dump_macro): Similarly.
* c-lex.c (cb_undef, c_lex): Similarly.
* fix-header.c (recognized_function): Similarly.
* cpplib.h (NODE_LEN, NODE_NAME): New.
(cpp_hashnode): Rename length len.
From-SVN: r42174
2001-05-17 00:02:09 +02:00
|
|
|
|
fn = lookup_std_proto ((const char *) NODE_NAME (fname->val.node),
|
|
|
|
|
NODE_LEN (fname->val.node));
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Remove the function from the list of required function. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (fn)
|
1993-10-12 23:58:40 +01:00
|
|
|
|
{
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (REQUIRED (fn))
|
|
|
|
|
required_unseen_count--;
|
|
|
|
|
SET_SEEN (fn);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
1993-08-10 03:59:37 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* If we have a full prototype, we're done. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (have_arg_list)
|
1993-10-12 23:58:40 +01:00
|
|
|
|
return;
|
2002-05-17 20:07:01 +02:00
|
|
|
|
|
1993-10-12 23:58:40 +01:00
|
|
|
|
if (kind == 'I') /* don't edit inline function */
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* If the partial prototype was included from some other file,
|
1996-07-04 00:07:53 +02:00
|
|
|
|
we don't need to patch it up (in this run). */
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
i = strlen (cur_file);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
if (i < inc_filename_length
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
|| strcmp (inc_filename, cur_file + (i - inc_filename_length)) != 0)
|
1993-10-12 23:58:40 +01:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (fn == NULL)
|
|
|
|
|
return;
|
2000-02-27 03:25:05 +01:00
|
|
|
|
if (fn->params[0] == '\0')
|
1993-10-12 23:58:40 +01:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* We only have a partial function declaration,
|
1996-07-04 00:07:53 +02:00
|
|
|
|
so remember that we have to add a complete prototype. */
|
1993-10-12 23:58:40 +01:00
|
|
|
|
partial_count++;
|
1996-07-04 00:07:53 +02:00
|
|
|
|
partial = (struct partial_proto *)
|
1993-10-20 22:33:01 +01:00
|
|
|
|
obstack_alloc (&scan_file_obstack, sizeof (struct partial_proto));
|
New macro expander.
2000-10-28 Neil Booth <neilb@earthling.net>
New macro expander.
* cpplib.c (struct answer): New.
(struct if_stack): Use cpp_lexer_pos rather than line and col.
Rename cmacro mi_cmacro.
(struct directive, KANDR, STDC89, EXTENSION, COND, IF_COND, INCL,
IN_I): New directive and flags.
(skip_rest_of_line, check_eol, run_directive, glue_header_name,
parse_answer, parse_assertion, find_answer): New functions.
(parse_ifdef, detect_if_not_defined, validate_else): Remove.
(lex_macro_node): New function to replace parse_ifdef and
get_define_node.
(_cpp_handle_directive): New function, combines _cpp_check_directive
and _cpp_check_linemarker.
(do_define, do_undef, parse_include, do_include, do_import,
do_include_next, read_line_number, do_line, do_ident, do_pragma,
do_pragma_once, do_pragma_poison, do_pragma_dependency):
Update for new token getting interface.
(do_ifdef, do_ifndef, do_if, do_else, do_endif, push_conditional)
: Update for new multiple-include optimisation technique.
(do_elif): Don't forget to invalidate controlling macros.
(unwind_if_stack, cpp_defined, cpp_push_buffer, cpp_pop_buffer): Update.
(parse_assertion, parse_answer, find_answer, _cpp_test_assertion):
Functions to handle assertions with the new token interface.
(do_assert, do_unassert): Use them.
(cpp_define, _cpp_define_builtin, cpp_undef, cpp_assert, cpp_unassert):
Use run_directive.
(_cpp_init_stacks): Register directive names. Don't register special
nodes.
* cpperror.c (print_containing_files, _cpp_begin_message): Update to
new position recording regime.
(cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Update for _cpp_begin_message changes.
(cpp_type2name): Move to cpplex.c.
* cppexp.c (parse_charconst): spec_nodes is no longer a pointer.
(parse_defined): Update to handle new multiple include optimisation
method. Remove poisoned identifier warning.
(parse_assertion, TYPE_NAME): Delete.
(lex): Update for multiple include optimisation, removal of
CPP_DEFINED, to use _cpp_test_assertion for assertions and
cpp_token_as_text.
(_cpp_parse_expr): Update for MI optimisation, and to use op_as_text.
(op_as_text): New function, to wrap cpp_token_as_text.
* cppfiles.c (stack_include_file, _cpp_pop_file_buffer):
Update for MI optimisation.
(_cpp_execute_include): Take a token rather than 3 arguments. Fix
segfault on diagnostic.
(_cpp_compare_file_date): Take a token rather than 3 args.
(cpp_read_file): Work correctly for zero-length files.
* cpphash.c (_cpp_init_macros, _cpp_cleanup_macros): Rename
_cpp_init_hashtable and _cpp_cleanup_hashtable.
(cpp_lookup): Place identifiers at front of identifier pool
for _cpp_lookup_with_hash.
(_cpp_lookup_with_hash): Require identifiers to be at the front of
the identifier pool. Commit the memory if not already in the
hash table.
* cppinit.c (cpp_reader_init): Move cpp_init_completed test to top.
Initialise various members of cpp_reader, memory pools, and the
special nodes.
(cpp_printer_init): Delete.
(cpp_cleanup): Update.
(struct builtin, builtin_array, initialize_builtins): Update for new
hashnode definition and builtin handling.
(cpp_start_read, cpp_finish): Don't take or initialise a
printer. Update.
* cpplib.h (cpp_printer, cpp_toklist, CPP_DEFINED, BOL,
PASTED, VAR_ARGS, BEG_OF_FILE, IN_DIRECTIVE, KNOWN_DIRECTIVE,
T_VOID, T_SPECLINE, T_DATE, T_FILE, T_BASE_FILE, T_INCLUDE_LEVEL,
T_TIME, T_STDC, T_OPERATOR, T_POISON, T_MACRO, T_ASSERTION): Delete.
(struct cpp_pool, struct cpp_macro, struct cpp_lexer_pos,
struct cpp_lookahead, CPP_DHASH, enum mi_state, enum mi_ind,
NO_EXPAND, VARARGS_FIRST, struct cpp_token_with_pos,
struct toklist, struct cpp_context, struct specnodes,
TOKEN_LOOKAHEAD, TOKEN_BUFFSIZE, NODE_OPERATOR, NODE_POISONED,
NODE_BUILTIN, NODE_DIAGNOSTIC, NT_VOID, NT_MACRO, NT_ASSERTION,
enum builtin_type, cpp_can_paste): New.
(struct cpp_token): Delete line and col members.
(struct cpp_buffer): New member output_lineno.
(struct lexer_state): Delete indented, in_lex_line, seen_dot.
Add va_args_ok, poisoned_ok, prevent_expansion, parsing_args.
(struct cpp_reader): New members lexer_pos, macro_pos, directive_pos,
ident_pool, temp_string_pool, macro_pool, argument_pool, string_pool,
base_context, context, directive, mi_state, mi_if_not_defined,
mi_lexed, mi_cmacro, mi_ind_cmacro, la_read, la_write, la_unused,
mlstring_pos, macro_buffer, macro_buffer_len.
Delete members mls_line, mls_column, token_list, potential_control_macro,
temp_tokens, temp_cap, temp_alloced, temp_used, first_directive_token,
context_cap, cur_context, no_expand_level, paste_level, contexts, args,
save_parameter_spellings, need_newline, .
Change type of date, time and spec_nodes members.
Change prototypes for include and ident callbacks.
(struct cpp_hashnode): Change type of name. Remove union members
expansion and code. Add members macro, operator and builtin.
(cpp_token_len, cpp_token_as_text, cpp_spell_token, cpp_start_read,
cpp_finish, cpp_avoid_paste, cpp_get_token, cpp_get_line,
cpp_get_output_line, cpp_macro_definition, cpp_start_lookahead,
cpp_stop_lookahead): New prototypes.
(cpp_printer_init, cpp_dump_definition): Delete prototypes.
(U_CHAR, U, ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr, ufputs):
Move from cpphash.h.
* cpphash.h (U_CHAR, U, ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr,
ufputs): Move to cpplib.h.
(enum spell_type, struct token_spelling, _cpp_token_spellings, TOKEN_SPELL,
TOKEN_NAME, struct answer, FREE_ANSWER, KANDR, STDC89, EXTENSION,
COND, EXPAND, INCL, COMMENTS, IN_I, struct directive, directive_handler,
struct spec_nodes, _cpp_digraph_spellings, _cpp_free_temp_tokens,
_cpp_init_input_buffer, _cpp_grow_token_buffer, _cpp_init_toklist,
_cpp_clear_toklist, _cpp_expand_token_space, _cpp_expand_name_space,
_cpp_equiv_tokens, _cpp_equiv_toklists, _cpp_process_directive,
_cpp_run_directive, _cpp_get_line, _cpp_get_raw_token, _cpp_glue_header_name,
_cpp_can_paste, _cpp_check_directive, _cpp_check_linemarker,
_cpp_parse_assertion, _cpp_find_answer): Delete.
(VALID_SIGN, ALIGN, POOL_FRONT, POOL_LIMIT, POOL_BASE, POOL_SIZE,
POOL_USED, POOL_COMMIT, struct cpp_chunk, _cpp_lex_token, _cpp_init_pool,
_cpp_free_pool, _cpp_pool_reserve, _cpp_pool_alloc, _cpp_next_chunk,
_cpp_lock_pool, _cpp_unlock_pool, _cpp_test_assertion,
_cpp_handle_directive, DSC): New.
(struct include_file): New member defined.
(DO_NOT_REREAD, _cpp_begin_message, _cpp_execute_include,
_cpp_compare_file_date): Update.
(_cpp_pop_context, _cpp_get_token, _cpp_free_lookaheads, _cpp_push_token): New.
(_cpp_init_macros, _cpp_cleanup_macros): Rename to _cpp_init_hashtable,
_cpp_cleanup_hashtable.
* Makefile.in: Remove cppoutput.c.
* cppoutput.c: Delete
* fixheader.c (read_scan_file): Update for new cpp_get_token
prototype.
(recognized_function): New argument LINE.
* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
new cpp_get_token prototype.
* scan.h (recognized_function): Update prototype.
* po/POTFILES.in: Remove cppoutput.c.
From-SVN: r37098
2000-10-28 19:59:06 +02:00
|
|
|
|
partial->line_seen = line;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
partial->fn = fn;
|
|
|
|
|
fn->partial = partial;
|
|
|
|
|
partial->next = partial_proto_list;
|
|
|
|
|
partial_proto_list = partial;
|
|
|
|
|
if (verbose)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "(%s: %s non-prototype function declaration.)\n",
|
top level:
2000-07-03 Zack Weinberg <zack@wolery.cumb.org>
* fix-header.c (struct partial_proto): Remove unnecessary fields.
(recognized_extern, recognized_function, read_scan_file):
Update for new scheme.
(check_protection): It's still a multiple include guard even
if it doesn't always trigger.
* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
new scheme.
* scan.h: Declare struct cpp_token. Update prototypes.
2000-07-03 Neil Booth <neilb@earthling.net>
Zack Weinberg <zack@wolery.cumb.org>
Complete overhaul of the lexer and macro expander.
* cpphash.c (object_defn, funct_defn, push_macro_expansion,
arg, arglist, argdata, reflist, collect_objlike_expansion,
collect_funlike_expansion, collect_params,
warn_trad_stringify, trad_stringify, duplicate_arg_p, add_pat,
unsafe_chars, macarg, compare_defs, special_symbol,
scan_arguments, stringify, funlike_macroexpand,
_cpp_quote_string, monthnames): Delete.
(cpp_lookup, _cpp_free_definition, dump_funlike_macro,
_cpp_create_definition, _cpp_dump_definition,
dump_hash_helper): Adjust.
(find_param, count_params, parse_define, var_args_str,
check_macro_redefinition, save_expansion): New.
* cpplex.c (skip_block_comment, skip_line_comment, parse_name,
parse_string, output_line_command, trigraph_replace,
lex_line, cpp_push_buffer, cpp_pop_buffer, cpp_output_tokens,
cpp_scan_buffer_nooutput, cpp_scan_buffer, cpp_free_toklist,
cpp_idcmp, _cpp_get_directive_token, _cpp_init_input_buffer,
_cpp_skip_rest_of_line): Modify.
(maybe_macroexpand, skip_comment, copy_comment, skip_string,
find_position, null_warning, bump_column, expand_name_space,
pedantic_whitespace, _cpp_output_list, _cpp_slice_toklist,
_cpp_squeeze_toklist, _cpp_scan_until, _cpp_skip_hspace,
_cpp_parse_name, _cpp_lex_token, cpp_get_non_space_token,
_cpp_prescan): Delete.
(dump_param_spelling, process_directive, lex_next,
is_macro_disabled, stringify_arg, expand_context_stack,
output_token, make_string_token, alloc_number_token,
special_symbol, duplicate_token, maybe_paste_with_next,
can_paste, prevent_macro_expansion, restore_macro_expansion,
get_temp_token, release_temp_tokens, quote_string,
token_names, token_spellings, _cpp_expand_name_space,
_cpp_glue_header_name, _cpp_reserve_name_space,
digraph_spellings, trigraph_ok, skip_whitespace, save_comment,
placemarker_token, eof_token, cpp_context, macro_args,
get_raw_token, parse_arg, parse_args, save_token,
push_arg_context, push_macro_context, pop_context,
do_pop_context, free_macro_args, _cpp_get_line,
_cpp_run_directive): New.
* cpplib.c (validate_else, parse_include, push_conditional,
pass_thru_directive, read_line_number, parse_ifdef,
detect_if_not_defined, _cpp_check_directive, do_define,
do_undef, do_include, do_import, do_include_next, do_error,
do_warning, do_ident, do_pragma, pragma_dispatch, gcc_pragmas,
top_pragmas, do_pragma_gcc, do_pragma_implementation,
do_pragma_poison, do_pragma_system_header,
do_pragma_dependency, do_sccs, do_ifdef, do_ifndef, do_else,
dl_elif, do_endif, _cpp_unwind_if_stack, do_assert,
do_unassert, cpp_define, cpp_undef, cpp_assert, cpp_unassert,
cpp_defined): Update for new scheme.
(strtoul_for_line, get_define_node, dump_macro_name,
_cpp_check_linemarker, _cpp_parse_assertion): New.
(_cpp_handle_directive, do_pragma_default): Delete.
* cpphash.h (struct predicate): Now struct answer.
(enum spell_type, struct token_spelling, struct directive,
directive_handler): New.
Update prototypes. Remove unused macros.
* cpplib.h: Update prototypes. Remove unused macros,
structure definitions, and fields.
* cpperror.c (print_containing_files, v_message): Adjust.
* cppexp.c (parse_assertion, lex, parse_escape,
_cpp_parse_expr): Adjust.
* cppfiles.c (open_include_file, _cpp_execute_include,
_cpp_compare_file_date, cpp_read_file, read_include_file):
Adjust.
* cppinit.c (dump_special_to_buffer): Delete.
(append_include_chain, merge_include_chains, cpp_reader_init,
cpp_cleanup, initialize_builtins, builtin_array, cpp_start_read,
cpp_finish, handle_option, print_help): Adjust.
* cppmain.c (main): Adjust.
testsuite:
2000-07-03 Zack Weinberg <zack@wolery.cumb.org>
* testsuite/gcc.dg/cpp/19951025-1.c: Adjust regexps.
* testsuite/gcc.dg/cpp/19990703-1.c: Likewise.
* testsuite/gcc.dg/cpp/20000625-1.c: Likewise.
* testsuite/gcc.dg/cpp/20000625-2.c: Likewise.
* testsuite/gcc.dg/cpp/macro1.c,
testsuite/gcc.dg/cpp/paste1.c, testsuite/gcc.dg/cpp/paste2.c,
testsuite/gcc.dg/cpp/paste3.c, testsuite/gcc.dg/cpp/paste4.c,
testsuite/gcc.dg/cpp/strify1.c,
testsuite/gcc.dg/cpp/strify2.c: New tests.
From-SVN: r34859
2000-07-04 03:58:21 +02:00
|
|
|
|
inc_filename, fn->fname);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For any name in NAMES that is defined as a macro,
|
1996-07-04 00:07:53 +02:00
|
|
|
|
call recognized_macro on it. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static void
|
1995-04-05 23:16:26 +02:00
|
|
|
|
check_macro_names (pfile, names)
|
1996-06-07 05:07:32 +02:00
|
|
|
|
cpp_reader *pfile;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
namelist names;
|
|
|
|
|
{
|
2000-04-30 19:30:25 +02:00
|
|
|
|
size_t len;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
while (*names)
|
|
|
|
|
{
|
2000-04-30 19:30:25 +02:00
|
|
|
|
len = strlen (names);
|
2000-06-22 01:08:17 +02:00
|
|
|
|
if (cpp_defined (pfile, (const unsigned char *)names, len))
|
1995-04-05 23:16:26 +02:00
|
|
|
|
recognized_macro (names);
|
2000-04-30 19:30:25 +02:00
|
|
|
|
names += len + 1;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
static void
|
2001-08-12 11:49:44 +02:00
|
|
|
|
cb_file_change (pfile, map)
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
cpp_reader *pfile ATTRIBUTE_UNUSED;
|
2001-08-12 11:49:44 +02:00
|
|
|
|
const struct line_map *map;
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
{
|
|
|
|
|
/* Just keep track of current file name. */
|
2001-08-12 11:49:44 +02:00
|
|
|
|
cur_file = map->to_file;
|
c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
From-SVN: r37784
2000-11-27 09:00:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static void
|
1995-04-05 23:16:26 +02:00
|
|
|
|
read_scan_file (in_fname, argc, argv)
|
|
|
|
|
char *in_fname;
|
|
|
|
|
int argc;
|
|
|
|
|
char **argv;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
{
|
2001-11-15 21:17:48 +01:00
|
|
|
|
cpp_reader *scan_in;
|
2001-01-13 02:07:32 +01:00
|
|
|
|
cpp_callbacks *cb;
|
|
|
|
|
cpp_options *options;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
struct fn_decl *fn;
|
|
|
|
|
int i;
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct symbol_list *cur_symbols;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
2002-05-17 20:07:01 +02:00
|
|
|
|
obstack_init (&scan_file_obstack);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
2001-11-15 15:47:04 +01:00
|
|
|
|
scan_in = cpp_create_reader (CLK_GNUC89);
|
2001-01-13 02:07:32 +01:00
|
|
|
|
cb = cpp_get_callbacks (scan_in);
|
|
|
|
|
cb->file_change = cb_file_change;
|
2000-08-20 10:33:52 +02:00
|
|
|
|
|
2000-02-11 00:47:04 +01:00
|
|
|
|
/* We are going to be scanning a header file out of its proper context,
|
|
|
|
|
so ignore warnings and errors. */
|
2001-01-13 02:13:35 +01:00
|
|
|
|
options = cpp_get_options (scan_in);
|
2001-01-13 02:07:32 +01:00
|
|
|
|
options->inhibit_warnings = 1;
|
|
|
|
|
options->inhibit_errors = 1;
|
|
|
|
|
|
2000-11-28 22:13:35 +01:00
|
|
|
|
i = cpp_handle_options (scan_in, argc, argv);
|
2002-05-23 08:07:45 +02:00
|
|
|
|
if (i < argc)
|
|
|
|
|
cpp_error (scan_in, DL_ERROR, "invalid option `%s'", argv[i]);
|
2001-01-07 18:42:22 +01:00
|
|
|
|
cpp_post_options (scan_in);
|
2002-05-23 08:07:45 +02:00
|
|
|
|
if (cpp_errors (scan_in))
|
1996-06-07 05:07:32 +02:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
|
|
|
|
|
2001-11-15 15:47:04 +01:00
|
|
|
|
if (! cpp_read_main_file (scan_in, in_fname, NULL))
|
1996-06-07 05:07:32 +02:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
2001-11-15 15:47:04 +01:00
|
|
|
|
cpp_finish_options (scan_in);
|
|
|
|
|
|
2000-04-30 19:30:25 +02:00
|
|
|
|
/* We are scanning a system header, so mark it as such. */
|
2000-12-04 08:32:04 +01:00
|
|
|
|
cpp_make_system_header (scan_in, 1, 0);
|
2000-04-30 19:30:25 +02:00
|
|
|
|
|
2000-11-28 22:13:35 +01:00
|
|
|
|
scan_decls (scan_in, argc, argv);
|
1995-12-15 08:43:33 +01:00
|
|
|
|
for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
|
2000-11-28 22:13:35 +01:00
|
|
|
|
check_macro_names (scan_in, cur_symbols->names);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
|
|
|
|
/* Traditionally, getc and putc are defined in terms of _filbuf and _flsbuf.
|
1996-07-04 00:07:53 +02:00
|
|
|
|
If so, those functions are also required. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (special_file_handling == stdio_h
|
|
|
|
|
&& (fn = lookup_std_proto ("_filbuf", 7)) != NULL)
|
|
|
|
|
{
|
2000-06-22 01:08:17 +02:00
|
|
|
|
static const unsigned char getchar_call[] = "getchar();";
|
1995-04-05 23:16:26 +02:00
|
|
|
|
int seen_filbuf = 0;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Scan the macro expansion of "getchar();". */
|
2000-12-11 08:45:16 +01:00
|
|
|
|
cpp_push_buffer (scan_in, getchar_call, sizeof(getchar_call) - 1,
|
cpperror.c (print_location): Don't show _Pragma.
* cpperror.c (print_location): Don't show _Pragma.
* cppfiles.c (_cpp_pop_file_buffer): Handle -include file pushing
and file change callback generation here.
(stack_include_file): Update use of cpp_push_buffer.
* cpphash.h (_cpp_pop_file_buffer): Update prototype.
(struct cpp_buffer): Remove type, pfile members.
* cppinit.c (cpp_handle_option): Use free_chain.
* cpplex.c (_cpp_lex_token): Don't do -include file pushing here.
(skip_escaped_newlines, get_effective_char, lex_percent): Take
a cpp_reader rather than a cpp_buffer.
(skip_escaped_newlines, get_effective_char, skip_block_comment,
skip_line_comment, parse_string, lex_percent, lex_dot,
_cpp_lex_token): Update accordingly.
* cpplib.c (_cpp_pop_buffer): Don't do file change callback
generation here.
(cpp_push_buffer): Update prototype.
(run_directive): Update use of cpp_push_buffer.
(_cpp_do__Pragma, cpp_define, cpp_define_builtin, cpp_undef,
handle_assertion): Update use of run_directive.
* cpplib.h (enum cpp_buffer_type): Remove.
(cpp_push_buffer): Update prototype.
* fix-header.c (read_scan_file): Update.
From-SVN: r45112
2001-08-22 22:37:20 +02:00
|
|
|
|
/* from_stage3 */ true, 1);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
for (;;)
|
|
|
|
|
{
|
c-lex.c (cb_def_pragma): Update.
* c-lex.c (cb_def_pragma): Update.
(c_lex): Update, and skip padding.
* cppexp.c (lex, parse_defined): Update, remove unused variable.
* cpphash.h (struct toklist): Delete.
(union utoken): New.
(struct cpp_context): Update.
(struct cpp_reader): New members eof, avoid_paste.
(_cpp_temp_token): New.
* cppinit.c (cpp_create_reader): Update.
* cpplex.c (_cpp_temp_token): New.
(_cpp_lex_direct): Add PREV_WHITE when parsing args.
(cpp_output_token): Don't print leading whitespace.
(cpp_output_line): Update.
* cpplib.c (glue_header_name, parse_include, get__Pragma_string,
do_include_common, do_line, do_ident, do_pragma,
do_pragma_dependency, _cpp_do__Pragma, parse_answer,
parse_assertion): Update.
(get_token_no_padding): New.
* cpplib.h (CPP_PADDING): New.
(AVOID_LPASTE): Delete.
(struct cpp_token): New union member source.
(cpp_get_token): Update.
* cppmacro.c (macro_arg): Convert to use pointers to const tokens.
(builtin_macro, paste_all_tokens, paste_tokens, funlike_invocation_p,
replace_args, quote_string, stringify_arg, parse_arg, next_context,
enter_macro_context, expand_arg, _cpp_pop_context, cpp_scan_nooutput,
_cpp_backup_tokens, _cpp_create_definition): Update.
(push_arg_context): Delete.
(padding_token, push_token_context, push_ptoken_context): New.
(make_string_token, make_number_token): Update, rename.
(cpp_get_token): Update to handle tokens as pointers to const,
and insert padding appropriately.
* cppmain.c (struct printer): New member prev.
(check_multiline_token): Constify.
(do_preprocessing, cb_line_change): Update.
(scan_translation_unit): Update to handle spacing.
* scan-decls.c (get_a_token): New.
(skip_to_closing_brace, scan_decls): Update.
* fix-header.c (read_scan_file): Update.
* doc/cpp.texi: Update.
* gcc.dg/cpp/macro10.c: New test.
* gcc.dg/cpp/strify3.c: New test.
* gcc.dg/cpp/spacing1.c: Add tests.
* gcc.dg/cpp/19990703-1.c: Remove bogus test.
* gcc.dg/cpp/20000625-2.c: Fudge to pass.
From-SVN: r45793
2001-09-25 00:53:12 +02:00
|
|
|
|
const cpp_token *t = cpp_get_token (scan_in);
|
top level:
2000-07-03 Zack Weinberg <zack@wolery.cumb.org>
* fix-header.c (struct partial_proto): Remove unnecessary fields.
(recognized_extern, recognized_function, read_scan_file):
Update for new scheme.
(check_protection): It's still a multiple include guard even
if it doesn't always trigger.
* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
new scheme.
* scan.h: Declare struct cpp_token. Update prototypes.
2000-07-03 Neil Booth <neilb@earthling.net>
Zack Weinberg <zack@wolery.cumb.org>
Complete overhaul of the lexer and macro expander.
* cpphash.c (object_defn, funct_defn, push_macro_expansion,
arg, arglist, argdata, reflist, collect_objlike_expansion,
collect_funlike_expansion, collect_params,
warn_trad_stringify, trad_stringify, duplicate_arg_p, add_pat,
unsafe_chars, macarg, compare_defs, special_symbol,
scan_arguments, stringify, funlike_macroexpand,
_cpp_quote_string, monthnames): Delete.
(cpp_lookup, _cpp_free_definition, dump_funlike_macro,
_cpp_create_definition, _cpp_dump_definition,
dump_hash_helper): Adjust.
(find_param, count_params, parse_define, var_args_str,
check_macro_redefinition, save_expansion): New.
* cpplex.c (skip_block_comment, skip_line_comment, parse_name,
parse_string, output_line_command, trigraph_replace,
lex_line, cpp_push_buffer, cpp_pop_buffer, cpp_output_tokens,
cpp_scan_buffer_nooutput, cpp_scan_buffer, cpp_free_toklist,
cpp_idcmp, _cpp_get_directive_token, _cpp_init_input_buffer,
_cpp_skip_rest_of_line): Modify.
(maybe_macroexpand, skip_comment, copy_comment, skip_string,
find_position, null_warning, bump_column, expand_name_space,
pedantic_whitespace, _cpp_output_list, _cpp_slice_toklist,
_cpp_squeeze_toklist, _cpp_scan_until, _cpp_skip_hspace,
_cpp_parse_name, _cpp_lex_token, cpp_get_non_space_token,
_cpp_prescan): Delete.
(dump_param_spelling, process_directive, lex_next,
is_macro_disabled, stringify_arg, expand_context_stack,
output_token, make_string_token, alloc_number_token,
special_symbol, duplicate_token, maybe_paste_with_next,
can_paste, prevent_macro_expansion, restore_macro_expansion,
get_temp_token, release_temp_tokens, quote_string,
token_names, token_spellings, _cpp_expand_name_space,
_cpp_glue_header_name, _cpp_reserve_name_space,
digraph_spellings, trigraph_ok, skip_whitespace, save_comment,
placemarker_token, eof_token, cpp_context, macro_args,
get_raw_token, parse_arg, parse_args, save_token,
push_arg_context, push_macro_context, pop_context,
do_pop_context, free_macro_args, _cpp_get_line,
_cpp_run_directive): New.
* cpplib.c (validate_else, parse_include, push_conditional,
pass_thru_directive, read_line_number, parse_ifdef,
detect_if_not_defined, _cpp_check_directive, do_define,
do_undef, do_include, do_import, do_include_next, do_error,
do_warning, do_ident, do_pragma, pragma_dispatch, gcc_pragmas,
top_pragmas, do_pragma_gcc, do_pragma_implementation,
do_pragma_poison, do_pragma_system_header,
do_pragma_dependency, do_sccs, do_ifdef, do_ifndef, do_else,
dl_elif, do_endif, _cpp_unwind_if_stack, do_assert,
do_unassert, cpp_define, cpp_undef, cpp_assert, cpp_unassert,
cpp_defined): Update for new scheme.
(strtoul_for_line, get_define_node, dump_macro_name,
_cpp_check_linemarker, _cpp_parse_assertion): New.
(_cpp_handle_directive, do_pragma_default): Delete.
* cpphash.h (struct predicate): Now struct answer.
(enum spell_type, struct token_spelling, struct directive,
directive_handler): New.
Update prototypes. Remove unused macros.
* cpplib.h: Update prototypes. Remove unused macros,
structure definitions, and fields.
* cpperror.c (print_containing_files, v_message): Adjust.
* cppexp.c (parse_assertion, lex, parse_escape,
_cpp_parse_expr): Adjust.
* cppfiles.c (open_include_file, _cpp_execute_include,
_cpp_compare_file_date, cpp_read_file, read_include_file):
Adjust.
* cppinit.c (dump_special_to_buffer): Delete.
(append_include_chain, merge_include_chains, cpp_reader_init,
cpp_cleanup, initialize_builtins, builtin_array, cpp_start_read,
cpp_finish, handle_option, print_help): Adjust.
* cppmain.c (main): Adjust.
testsuite:
2000-07-03 Zack Weinberg <zack@wolery.cumb.org>
* testsuite/gcc.dg/cpp/19951025-1.c: Adjust regexps.
* testsuite/gcc.dg/cpp/19990703-1.c: Likewise.
* testsuite/gcc.dg/cpp/20000625-1.c: Likewise.
* testsuite/gcc.dg/cpp/20000625-2.c: Likewise.
* testsuite/gcc.dg/cpp/macro1.c,
testsuite/gcc.dg/cpp/paste1.c, testsuite/gcc.dg/cpp/paste2.c,
testsuite/gcc.dg/cpp/paste3.c, testsuite/gcc.dg/cpp/paste4.c,
testsuite/gcc.dg/cpp/strify1.c,
testsuite/gcc.dg/cpp/strify2.c: New tests.
From-SVN: r34859
2000-07-04 03:58:21 +02:00
|
|
|
|
|
c-lex.c (cb_def_pragma): Update.
* c-lex.c (cb_def_pragma): Update.
(c_lex): Update, and skip padding.
* cppexp.c (lex, parse_defined): Update, remove unused variable.
* cpphash.h (struct toklist): Delete.
(union utoken): New.
(struct cpp_context): Update.
(struct cpp_reader): New members eof, avoid_paste.
(_cpp_temp_token): New.
* cppinit.c (cpp_create_reader): Update.
* cpplex.c (_cpp_temp_token): New.
(_cpp_lex_direct): Add PREV_WHITE when parsing args.
(cpp_output_token): Don't print leading whitespace.
(cpp_output_line): Update.
* cpplib.c (glue_header_name, parse_include, get__Pragma_string,
do_include_common, do_line, do_ident, do_pragma,
do_pragma_dependency, _cpp_do__Pragma, parse_answer,
parse_assertion): Update.
(get_token_no_padding): New.
* cpplib.h (CPP_PADDING): New.
(AVOID_LPASTE): Delete.
(struct cpp_token): New union member source.
(cpp_get_token): Update.
* cppmacro.c (macro_arg): Convert to use pointers to const tokens.
(builtin_macro, paste_all_tokens, paste_tokens, funlike_invocation_p,
replace_args, quote_string, stringify_arg, parse_arg, next_context,
enter_macro_context, expand_arg, _cpp_pop_context, cpp_scan_nooutput,
_cpp_backup_tokens, _cpp_create_definition): Update.
(push_arg_context): Delete.
(padding_token, push_token_context, push_ptoken_context): New.
(make_string_token, make_number_token): Update, rename.
(cpp_get_token): Update to handle tokens as pointers to const,
and insert padding appropriately.
* cppmain.c (struct printer): New member prev.
(check_multiline_token): Constify.
(do_preprocessing, cb_line_change): Update.
(scan_translation_unit): Update to handle spacing.
* scan-decls.c (get_a_token): New.
(skip_to_closing_brace, scan_decls): Update.
* fix-header.c (read_scan_file): Update.
* doc/cpp.texi: Update.
* gcc.dg/cpp/macro10.c: New test.
* gcc.dg/cpp/strify3.c: New test.
* gcc.dg/cpp/spacing1.c: Add tests.
* gcc.dg/cpp/19990703-1.c: Remove bogus test.
* gcc.dg/cpp/20000625-2.c: Fudge to pass.
From-SVN: r45793
2001-09-25 00:53:12 +02:00
|
|
|
|
if (t->type == CPP_EOF)
|
2000-12-07 08:14:42 +01:00
|
|
|
|
break;
|
c-lex.c (cb_def_pragma): Update.
* c-lex.c (cb_def_pragma): Update.
(c_lex): Update, and skip padding.
* cppexp.c (lex, parse_defined): Update, remove unused variable.
* cpphash.h (struct toklist): Delete.
(union utoken): New.
(struct cpp_context): Update.
(struct cpp_reader): New members eof, avoid_paste.
(_cpp_temp_token): New.
* cppinit.c (cpp_create_reader): Update.
* cpplex.c (_cpp_temp_token): New.
(_cpp_lex_direct): Add PREV_WHITE when parsing args.
(cpp_output_token): Don't print leading whitespace.
(cpp_output_line): Update.
* cpplib.c (glue_header_name, parse_include, get__Pragma_string,
do_include_common, do_line, do_ident, do_pragma,
do_pragma_dependency, _cpp_do__Pragma, parse_answer,
parse_assertion): Update.
(get_token_no_padding): New.
* cpplib.h (CPP_PADDING): New.
(AVOID_LPASTE): Delete.
(struct cpp_token): New union member source.
(cpp_get_token): Update.
* cppmacro.c (macro_arg): Convert to use pointers to const tokens.
(builtin_macro, paste_all_tokens, paste_tokens, funlike_invocation_p,
replace_args, quote_string, stringify_arg, parse_arg, next_context,
enter_macro_context, expand_arg, _cpp_pop_context, cpp_scan_nooutput,
_cpp_backup_tokens, _cpp_create_definition): Update.
(push_arg_context): Delete.
(padding_token, push_token_context, push_ptoken_context): New.
(make_string_token, make_number_token): Update, rename.
(cpp_get_token): Update to handle tokens as pointers to const,
and insert padding appropriately.
* cppmain.c (struct printer): New member prev.
(check_multiline_token): Constify.
(do_preprocessing, cb_line_change): Update.
(scan_translation_unit): Update to handle spacing.
* scan-decls.c (get_a_token): New.
(skip_to_closing_brace, scan_decls): Update.
* fix-header.c (read_scan_file): Update.
* doc/cpp.texi: Update.
* gcc.dg/cpp/macro10.c: New test.
* gcc.dg/cpp/strify3.c: New test.
* gcc.dg/cpp/spacing1.c: Add tests.
* gcc.dg/cpp/19990703-1.c: Remove bogus test.
* gcc.dg/cpp/20000625-2.c: Fudge to pass.
From-SVN: r45793
2001-09-25 00:53:12 +02:00
|
|
|
|
else if (cpp_ideq (t, "_filbuf"))
|
1995-04-05 23:16:26 +02:00
|
|
|
|
seen_filbuf++;
|
|
|
|
|
}
|
2000-12-07 08:14:42 +01:00
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (seen_filbuf)
|
|
|
|
|
{
|
|
|
|
|
int need_filbuf = !SEEN (fn) && !REQUIRED (fn);
|
|
|
|
|
struct fn_decl *flsbuf_fn = lookup_std_proto ("_flsbuf", 7);
|
|
|
|
|
int need_flsbuf
|
|
|
|
|
= flsbuf_fn && !SEEN (flsbuf_fn) && !REQUIRED (flsbuf_fn);
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Append "_filbuf" and/or "_flsbuf" to the required functions. */
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (need_filbuf + need_flsbuf)
|
|
|
|
|
{
|
final.c (bb_str): Qualify a char* with the keyword `const'.
* final.c (bb_str): Qualify a char* with the keyword `const'.
(add_bb_string, final_scan_insn, output_asm_insn): Likewise.
* fix-header.c (read_scan_file): Likewise.
* genoutput.c (output_epilogue, process_template): Likewise.
* local-alloc.c (requires_inout, block_alloc): Likewise.
* output.h (output_asm_insn, assemble_string): Likewise.
* recog.c (recog_constraints, check_asm_operands,
decode_asm_operands, extract_insn, preprocess_constraints,
constrain_operands): Likewise.
* recog.h (operand_alternative, recog_constraints, insn_template,
insn_outfun, insn_operand_constraint, insn_name): Likewise.
* regclass.c (record_reg_classes, scan_one_insn): Likewise.
* regmove.c (find_matches): Likewise.
* reload.c (alternative_allows_memconst): Likewise.
* reload1.c (constraint_accepts_reg_p,
reload_cse_simplify_operands): Likewise.
* rtl.h (decode_asm_operands): Likewise.
* scan.h (fn_decl): Likewise.
* varasm.c (assemble_string): Likewise.
From-SVN: r24834
1999-01-23 20:45:50 +01:00
|
|
|
|
const char *new_list;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (need_filbuf)
|
1995-12-15 08:43:33 +01:00
|
|
|
|
SET_REQUIRED (fn);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
if (need_flsbuf)
|
1995-12-15 08:43:33 +01:00
|
|
|
|
SET_REQUIRED (flsbuf_fn);
|
2000-04-30 19:30:25 +02:00
|
|
|
|
if (need_flsbuf && need_filbuf)
|
1995-12-15 08:43:33 +01:00
|
|
|
|
new_list = "_filbuf\0_flsbuf\0";
|
|
|
|
|
else if (need_flsbuf)
|
|
|
|
|
new_list = "_flsbuf\0";
|
|
|
|
|
else /* if (need_flsbuf) */
|
|
|
|
|
new_list = "_filbuf\0";
|
|
|
|
|
add_symbols (ANSI_SYMBOL, new_list);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
required_unseen_count += need_filbuf + need_flsbuf;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1995-12-27 23:28:33 +01:00
|
|
|
|
if (required_unseen_count + partial_count + required_other
|
1995-04-05 23:16:26 +02:00
|
|
|
|
#if ADD_MISSING_EXTERN_C
|
1993-12-22 20:29:00 +01:00
|
|
|
|
+ missing_extern_C_count
|
2002-05-17 20:07:01 +02:00
|
|
|
|
#endif
|
1993-12-22 20:29:00 +01:00
|
|
|
|
== 0)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
|
|
|
|
if (verbose)
|
|
|
|
|
fprintf (stderr, "%s: OK, nothing needs to be done.\n", inc_filename);
|
1997-04-20 18:39:28 +02:00
|
|
|
|
exit (SUCCESS_EXIT_CODE);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
1993-08-10 03:59:37 +02:00
|
|
|
|
if (!verbose)
|
|
|
|
|
fprintf (stderr, "%s: fixing %s\n", progname, inc_filename);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (required_unseen_count)
|
|
|
|
|
fprintf (stderr, "%s: %d missing function declarations.\n",
|
|
|
|
|
inc_filename, required_unseen_count);
|
|
|
|
|
if (partial_count)
|
|
|
|
|
fprintf (stderr, "%s: %d non-prototype function declarations.\n",
|
|
|
|
|
inc_filename, partial_count);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
#if ADD_MISSING_EXTERN_C
|
1993-08-10 03:59:37 +02:00
|
|
|
|
if (missing_extern_C_count)
|
|
|
|
|
fprintf (stderr,
|
|
|
|
|
"%s: %d declarations not protected by extern \"C\".\n",
|
|
|
|
|
inc_filename, missing_extern_C_count);
|
1993-12-22 20:29:00 +01:00
|
|
|
|
#endif
|
1993-08-10 03:59:37 +02:00
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static void
|
1993-07-26 02:11:20 +02:00
|
|
|
|
write_rbrac ()
|
|
|
|
|
{
|
|
|
|
|
struct fn_decl *fn;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
const char *cptr;
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct symbol_list *cur_symbols;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
if (required_unseen_count)
|
1994-08-11 22:36:33 +02:00
|
|
|
|
{
|
|
|
|
|
#ifdef NO_IMPLICIT_EXTERN_C
|
1994-08-12 00:18:53 +02:00
|
|
|
|
fprintf (outf, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
|
1994-08-11 22:36:33 +02:00
|
|
|
|
#endif
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Now we print out prototypes for those functions that we haven't seen. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
1995-12-15 08:43:33 +01:00
|
|
|
|
int if_was_emitted = 0;
|
|
|
|
|
int name_len;
|
|
|
|
|
cptr = cur_symbols->names;
|
|
|
|
|
for ( ; (name_len = strlen (cptr)) != 0; cptr+= name_len + 1)
|
|
|
|
|
{
|
|
|
|
|
int macro_protect = 0;
|
1993-11-11 16:50:52 +01:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
if (cur_symbols->flags & MACRO_SYMBOL)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
fn = lookup_std_proto (cptr, name_len);
|
|
|
|
|
if (fn == NULL || !REQUIRED (fn))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (!if_was_emitted)
|
|
|
|
|
{
|
|
|
|
|
/* what about curses. ??? or _flsbuf/_filbuf ??? */
|
|
|
|
|
if (cur_symbols->flags & ANSI_SYMBOL)
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || defined (__STRICT_ANSI__)\n");
|
1995-12-27 23:28:33 +01:00
|
|
|
|
else if (cur_symbols->flags & (POSIX1_SYMBOL|POSIX2_SYMBOL))
|
1995-12-15 08:43:33 +01:00
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#if defined(__USE_FIXED_PROTOTYPES__) || (defined(__cplusplus) \\\n\
|
1995-12-27 23:28:33 +01:00
|
|
|
|
? (!defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)) \\\n\
|
|
|
|
|
: (defined(__STRICT_ANSI__) && defined(_POSIX_SOURCE)))\n");
|
|
|
|
|
else if (cur_symbols->flags & XOPEN_SYMBOL)
|
|
|
|
|
{
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#if defined(__USE_FIXED_PROTOTYPES__) \\\n\
|
|
|
|
|
|| (defined(__STRICT_ANSI__) && defined(_XOPEN_SOURCE))\n");
|
|
|
|
|
}
|
|
|
|
|
else if (cur_symbols->flags & XOPEN_EXTENDED_SYMBOL)
|
|
|
|
|
{
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#if defined(__USE_FIXED_PROTOTYPES__) \\\n\
|
|
|
|
|
|| (defined(__STRICT_ANSI__) && defined(_XOPEN_EXTENDED_SOURCE))\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fatal ("internal error for function %s", fn->fname);
|
|
|
|
|
}
|
1995-12-15 08:43:33 +01:00
|
|
|
|
if_was_emitted = 1;
|
|
|
|
|
}
|
1993-11-11 16:50:52 +01:00
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
/* In the case of memmove, protect in case the application
|
|
|
|
|
defines it as a macro before including the header. */
|
|
|
|
|
if (!strcmp (fn->fname, "memmove")
|
2000-09-02 00:43:56 +02:00
|
|
|
|
|| !strcmp (fn->fname, "putc")
|
|
|
|
|
|| !strcmp (fn->fname, "getc")
|
1995-12-15 08:43:33 +01:00
|
|
|
|
|| !strcmp (fn->fname, "vprintf")
|
|
|
|
|
|| !strcmp (fn->fname, "vfprintf")
|
|
|
|
|
|| !strcmp (fn->fname, "vsprintf")
|
1998-05-06 01:23:41 +02:00
|
|
|
|
|| !strcmp (fn->fname, "rewinddir")
|
|
|
|
|
|| !strcmp (fn->fname, "abort"))
|
1995-12-15 08:43:33 +01:00
|
|
|
|
macro_protect = 1;
|
|
|
|
|
|
|
|
|
|
if (macro_protect)
|
|
|
|
|
fprintf (outf, "#ifndef %s\n", fn->fname);
|
|
|
|
|
fprintf (outf, "extern %s %s (%s);\n",
|
|
|
|
|
fn->rtype, fn->fname, fn->params);
|
|
|
|
|
if (macro_protect)
|
|
|
|
|
fprintf (outf, "#endif\n");
|
|
|
|
|
}
|
|
|
|
|
if (if_was_emitted)
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#endif /* defined(__USE_FIXED_PROTOTYPES__) || ... */\n");
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
if (required_unseen_count)
|
1994-08-11 22:36:33 +02:00
|
|
|
|
{
|
|
|
|
|
#ifdef NO_IMPLICIT_EXTERN_C
|
1994-08-12 00:18:53 +02:00
|
|
|
|
fprintf (outf, "#ifdef __cplusplus\n}\n#endif\n");
|
1994-08-11 22:36:33 +02:00
|
|
|
|
#endif
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
switch (special_file_handling)
|
|
|
|
|
{
|
1995-04-05 23:16:26 +02:00
|
|
|
|
case errno_h:
|
1995-12-27 23:28:33 +01:00
|
|
|
|
if (!seen_errno)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
fprintf (outf, "extern int errno;\n");
|
|
|
|
|
break;
|
1995-12-27 23:28:33 +01:00
|
|
|
|
case stdlib_h:
|
|
|
|
|
if (!seen_EXIT_FAILURE)
|
|
|
|
|
fprintf (outf, "#define EXIT_FAILURE 1\n");
|
|
|
|
|
if (!seen_EXIT_SUCCESS)
|
|
|
|
|
fprintf (outf, "#define EXIT_SUCCESS 0\n");
|
|
|
|
|
break;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
case sys_stat_h:
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (!seen_S_ISBLK && seen_S_IFBLK)
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)\n");
|
|
|
|
|
if (!seen_S_ISCHR && seen_S_IFCHR)
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)\n");
|
|
|
|
|
if (!seen_S_ISDIR && seen_S_IFDIR)
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)\n");
|
|
|
|
|
if (!seen_S_ISFIFO && seen_S_IFIFO)
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)\n");
|
|
|
|
|
if (!seen_S_ISLNK && seen_S_IFLNK)
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)\n");
|
|
|
|
|
if (!seen_S_ISREG && seen_S_IFREG)
|
|
|
|
|
fprintf (outf,
|
|
|
|
|
"#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)\n");
|
|
|
|
|
break;
|
1997-12-22 10:31:41 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
#if ADD_MISSING_EXTERN_C
|
1993-10-21 02:07:39 +01:00
|
|
|
|
if (missing_extern_C_count + required_unseen_count > 0)
|
|
|
|
|
fprintf (outf, "#ifdef __cplusplus\n}\n#endif\n");
|
1993-12-22 20:29:00 +01:00
|
|
|
|
#endif
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns 1 iff the file is properly protected from multiple inclusion:
|
|
|
|
|
#ifndef PROTECT_NAME
|
|
|
|
|
#define PROTECT_NAME
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
#define INF_GET() (inf_ptr < inf_limit ? *(unsigned char *) inf_ptr++ : EOF)
|
1993-10-20 22:33:01 +01:00
|
|
|
|
#define INF_UNGET(c) ((c)!=EOF && inf_ptr--)
|
1993-10-12 23:58:40 +01:00
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static int
|
1993-10-12 23:58:40 +01:00
|
|
|
|
inf_skip_spaces (c)
|
|
|
|
|
int c;
|
|
|
|
|
{
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
if (c == ' ' || c == '\t')
|
1993-10-20 22:33:01 +01:00
|
|
|
|
c = INF_GET ();
|
1993-10-12 23:58:40 +01:00
|
|
|
|
else if (c == '/')
|
|
|
|
|
{
|
1993-10-20 22:33:01 +01:00
|
|
|
|
c = INF_GET ();
|
1993-10-12 23:58:40 +01:00
|
|
|
|
if (c != '*')
|
|
|
|
|
{
|
1998-03-18 08:18:06 +01:00
|
|
|
|
(void) INF_UNGET (c);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
return '/';
|
|
|
|
|
}
|
1993-10-20 22:33:01 +01:00
|
|
|
|
c = INF_GET ();
|
1993-10-12 23:58:40 +01:00
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
if (c == EOF)
|
|
|
|
|
return EOF;
|
|
|
|
|
else if (c != '*')
|
|
|
|
|
{
|
|
|
|
|
if (c == '\n')
|
|
|
|
|
source_lineno++, lineno++;
|
|
|
|
|
c = INF_GET ();
|
|
|
|
|
}
|
1993-10-20 22:33:01 +01:00
|
|
|
|
else if ((c = INF_GET ()) == '/')
|
|
|
|
|
return INF_GET ();
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Read into STR from inf_buffer upto DELIM. */
|
1993-10-12 23:58:40 +01:00
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static int
|
1993-10-12 23:58:40 +01:00
|
|
|
|
inf_read_upto (str, delim)
|
|
|
|
|
sstring *str;
|
|
|
|
|
int delim;
|
|
|
|
|
{
|
|
|
|
|
int ch;
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
ch = INF_GET ();
|
|
|
|
|
if (ch == EOF || ch == delim)
|
|
|
|
|
break;
|
1993-10-20 22:33:01 +01:00
|
|
|
|
SSTRING_PUT (str, ch);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
1993-10-20 22:33:01 +01:00
|
|
|
|
MAKE_SSTRING_SPACE (str, 1);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
*str->ptr = 0;
|
|
|
|
|
return ch;
|
|
|
|
|
}
|
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static int
|
1993-10-12 23:58:40 +01:00
|
|
|
|
inf_scan_ident (s, c)
|
2001-10-11 05:16:15 +02:00
|
|
|
|
sstring *s;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
int c;
|
|
|
|
|
{
|
|
|
|
|
s->ptr = s->base;
|
c-format.c (maybe_read_dollar_number): Use safe-ctype macros and/or fold extra calls into fewer ones.
* c-format.c (maybe_read_dollar_number): Use safe-ctype macros
and/or fold extra calls into fewer ones.
* collect2.c (dump_file): Likewise.
* cppexp.c (parse_number): Likewise.
* cpplex.c (_cpp_lex_direct): Likewise.
* final.c (output_asm_insn, asm_fprintf): Likewise.
* fix-header.c (inf_scan_ident, main): Likewise.
* fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix):
Likewise.
* fold-const.c (real_hex_to_f): Likewise.
* gen-protos.c (parse_fn_proto): Likewise.
* genattrtab.c (check_attr_test, check_attr_value): Likewise.
* genrecog.c (change_state, write_action): Likewise.
* gensupport.c (shift_output_template): Likewise.
* local-alloc.c (requires_inout): Likewise.
* mips-tfile.c (IS_ASM_IDENT): Likewise.
* protoize.c (is_id_char, main): Likewise.
* real.c (asctoeg): Likewise.
* recog.c (asm_operand_ok): Likewise.
* reload.c (find_reloads): Likewise.
* scan.c (scan_identget_token): Likewise.
* sched-vis.c (print_value): Likewise.
* stringpool.c (ggc_alloc_string): Likewise.
* toplev.c (read_integral_parameter, decode_g_option): Likewise.
* tradcif.y (parse_number, yylex, parse_escape): Likewise.
* tradcpp.c (rescan): Likewise.
* tree.c (clean_symbol_name): Likewise.
* varasm.c (decode_reg_name): Likewise.
* alpha.h (ASM_OUTPUT_ASCII): Likewise.
* darwin.c (name_needs_quotes, func_name_maybe_scoped): Likewise.
* dsp16xx.h (ASM_OUTPUT_ASCII): Likewise.
* m88k.c (output_ascii): Likewise.
* m88k.h (OVERRIDE_OPTIONS): Likewise.
* mcore.h (REG_CLASS_FROM_LETTER): Likewise.
* ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise.
* sh.h (REG_CLASS_FROM_LETTER): Likewise.
cp:
* xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
extra calls into fewer ones.
f:
* bad.c (ffebad_finish): Use safe-ctype macros and/or fold extra
calls into fewer ones.
* implic.c (ffeimplic_lookup_): Likewise.
* intdoc.c (dumpimp): Likewise.
* intrin.c (ffeintrin_init_0): Likewise.
* lex.c (ffelex_backslash_, ffelex_cfebackslash_, ffelex_hash_):
Likewise.
* lex.h (ffelex_is_firstnamechar): Likewise.
* target.c (ffetarget_integerhex): Likewise.
java:
* gjavah.c (jni_print_char, decode_signature_piece): Use
safe-ctype macros and/or fold extra calls into fewer ones.
* lex.c (java_read_unicode, java_lex): Likewise.
* lex.h (JAVA_START_CHAR_P, JAVA_PART_CHAR_P, JAVA_ASCII_DIGIT,
JAVA_ASCII_HEXDIGIT, JAVA_ASCII_LETTER): Likewise.
* mangle_name.c (append_unicode_mangled_name,
unicode_mangling_length): Likewise.
From-SVN: r46397
2001-10-21 23:32:15 +02:00
|
|
|
|
if (ISIDST (c))
|
1993-10-12 23:58:40 +01:00
|
|
|
|
{
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
1993-10-20 22:33:01 +01:00
|
|
|
|
SSTRING_PUT (s, c);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = INF_GET ();
|
c-format.c (maybe_read_dollar_number): Use safe-ctype macros and/or fold extra calls into fewer ones.
* c-format.c (maybe_read_dollar_number): Use safe-ctype macros
and/or fold extra calls into fewer ones.
* collect2.c (dump_file): Likewise.
* cppexp.c (parse_number): Likewise.
* cpplex.c (_cpp_lex_direct): Likewise.
* final.c (output_asm_insn, asm_fprintf): Likewise.
* fix-header.c (inf_scan_ident, main): Likewise.
* fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix):
Likewise.
* fold-const.c (real_hex_to_f): Likewise.
* gen-protos.c (parse_fn_proto): Likewise.
* genattrtab.c (check_attr_test, check_attr_value): Likewise.
* genrecog.c (change_state, write_action): Likewise.
* gensupport.c (shift_output_template): Likewise.
* local-alloc.c (requires_inout): Likewise.
* mips-tfile.c (IS_ASM_IDENT): Likewise.
* protoize.c (is_id_char, main): Likewise.
* real.c (asctoeg): Likewise.
* recog.c (asm_operand_ok): Likewise.
* reload.c (find_reloads): Likewise.
* scan.c (scan_identget_token): Likewise.
* sched-vis.c (print_value): Likewise.
* stringpool.c (ggc_alloc_string): Likewise.
* toplev.c (read_integral_parameter, decode_g_option): Likewise.
* tradcif.y (parse_number, yylex, parse_escape): Likewise.
* tradcpp.c (rescan): Likewise.
* tree.c (clean_symbol_name): Likewise.
* varasm.c (decode_reg_name): Likewise.
* alpha.h (ASM_OUTPUT_ASCII): Likewise.
* darwin.c (name_needs_quotes, func_name_maybe_scoped): Likewise.
* dsp16xx.h (ASM_OUTPUT_ASCII): Likewise.
* m88k.c (output_ascii): Likewise.
* m88k.h (OVERRIDE_OPTIONS): Likewise.
* mcore.h (REG_CLASS_FROM_LETTER): Likewise.
* ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise.
* sh.h (REG_CLASS_FROM_LETTER): Likewise.
cp:
* xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
extra calls into fewer ones.
f:
* bad.c (ffebad_finish): Use safe-ctype macros and/or fold extra
calls into fewer ones.
* implic.c (ffeimplic_lookup_): Likewise.
* intdoc.c (dumpimp): Likewise.
* intrin.c (ffeintrin_init_0): Likewise.
* lex.c (ffelex_backslash_, ffelex_cfebackslash_, ffelex_hash_):
Likewise.
* lex.h (ffelex_is_firstnamechar): Likewise.
* target.c (ffetarget_integerhex): Likewise.
java:
* gjavah.c (jni_print_char, decode_signature_piece): Use
safe-ctype macros and/or fold extra calls into fewer ones.
* lex.c (java_read_unicode, java_lex): Likewise.
* lex.h (JAVA_START_CHAR_P, JAVA_PART_CHAR_P, JAVA_ASCII_DIGIT,
JAVA_ASCII_HEXDIGIT, JAVA_ASCII_LETTER): Likewise.
* mangle_name.c (append_unicode_mangled_name,
unicode_mangling_length): Likewise.
From-SVN: r46397
2001-10-21 23:32:15 +02:00
|
|
|
|
if (c == EOF || !(ISIDNUM (c)))
|
1993-10-12 23:58:40 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
1993-10-20 22:33:01 +01:00
|
|
|
|
MAKE_SSTRING_SPACE (s, 1);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
*s->ptr = 0;
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns 1 if the file is correctly protected against multiple
|
|
|
|
|
inclusion, setting *ifndef_line to the line number of the initial #ifndef
|
|
|
|
|
and setting *endif_line to the final #endif.
|
1996-07-04 00:07:53 +02:00
|
|
|
|
Otherwise return 0. */
|
1993-10-12 23:58:40 +01:00
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static int
|
1993-10-12 23:58:40 +01:00
|
|
|
|
check_protection (ifndef_line, endif_line)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int *ifndef_line, *endif_line;
|
|
|
|
|
{
|
|
|
|
|
int c;
|
|
|
|
|
int if_nesting = 1; /* Level of nesting of #if's */
|
|
|
|
|
char *protect_name = NULL; /* Identifier following initial #ifndef */
|
|
|
|
|
int define_seen = 0;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Skip initial white space (including comments). */
|
1993-07-26 02:11:20 +02:00
|
|
|
|
for (;; lineno++)
|
|
|
|
|
{
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_skip_spaces (' ');
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (c == EOF)
|
|
|
|
|
return 0;
|
|
|
|
|
if (c != '\n')
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (c != '#')
|
|
|
|
|
return 0;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_scan_ident (&buf, inf_skip_spaces (' '));
|
1993-10-20 22:33:01 +01:00
|
|
|
|
if (SSTRING_LENGTH (&buf) == 0 || strcmp (buf.base, "ifndef") != 0)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
return 0;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* So far so good: We've seen an initial #ifndef. */
|
1993-07-26 02:11:20 +02:00
|
|
|
|
*ifndef_line = lineno;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_scan_ident (&buf, inf_skip_spaces (c));
|
1993-10-20 22:33:01 +01:00
|
|
|
|
if (SSTRING_LENGTH (&buf) == 0 || c == EOF)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
return 0;
|
1994-06-14 23:29:48 +02:00
|
|
|
|
protect_name = xstrdup (buf.base);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1998-03-18 08:18:06 +01:00
|
|
|
|
(void) INF_UNGET (c);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_read_upto (&buf, '\n');
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (c == EOF)
|
|
|
|
|
return 0;
|
|
|
|
|
lineno++;
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
1993-10-20 22:33:01 +01:00
|
|
|
|
c = inf_skip_spaces (' ');
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (c == EOF)
|
|
|
|
|
return 0;
|
|
|
|
|
if (c == '\n')
|
|
|
|
|
{
|
|
|
|
|
lineno++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (c != '#')
|
|
|
|
|
goto skip_to_eol;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_scan_ident (&buf, inf_skip_spaces (' '));
|
1993-10-20 22:33:01 +01:00
|
|
|
|
if (SSTRING_LENGTH (&buf) == 0)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
;
|
|
|
|
|
else if (!strcmp (buf.base, "ifndef")
|
|
|
|
|
|| !strcmp (buf.base, "ifdef") || !strcmp (buf.base, "if"))
|
|
|
|
|
{
|
|
|
|
|
if_nesting++;
|
|
|
|
|
}
|
|
|
|
|
else if (!strcmp (buf.base, "endif"))
|
|
|
|
|
{
|
|
|
|
|
if_nesting--;
|
|
|
|
|
if (if_nesting == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (!strcmp (buf.base, "else"))
|
|
|
|
|
{
|
|
|
|
|
if (if_nesting == 1)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else if (!strcmp (buf.base, "define"))
|
|
|
|
|
{
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_skip_spaces (c);
|
|
|
|
|
c = inf_scan_ident (&buf, c);
|
1993-10-20 22:33:01 +01:00
|
|
|
|
if (buf.base[0] > 0 && strcmp (buf.base, protect_name) == 0)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
define_seen = 1;
|
|
|
|
|
}
|
|
|
|
|
skip_to_eol:
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
if (c == '\n' || c == EOF)
|
|
|
|
|
break;
|
1993-10-20 22:33:01 +01:00
|
|
|
|
c = INF_GET ();
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
if (c == EOF)
|
|
|
|
|
return 0;
|
|
|
|
|
lineno++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!define_seen)
|
|
|
|
|
return 0;
|
|
|
|
|
*endif_line = lineno;
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Skip final white space (including comments). */
|
1993-07-26 02:11:20 +02:00
|
|
|
|
for (;;)
|
|
|
|
|
{
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_skip_spaces (' ');
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (c == EOF)
|
|
|
|
|
break;
|
|
|
|
|
if (c != '\n')
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-14 18:14:43 +01:00
|
|
|
|
extern int main PARAMS ((int, char **));
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int
|
1993-10-20 22:33:01 +01:00
|
|
|
|
main (argc, argv)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int argc;
|
|
|
|
|
char **argv;
|
|
|
|
|
{
|
1993-10-12 23:58:40 +01:00
|
|
|
|
int inf_fd;
|
|
|
|
|
struct stat sbuf;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int c;
|
c-lex.c: Include <stdlib.h> and <string.h>/<strings.h>.
/
* c-lex.c: Include <stdlib.h> and <string.h>/<strings.h>. Add
prototype for `handle_sysv_pragma', and make it static. Add
parentheses around assignment used as truth value.
* combine.c (combine_instructions): Protect variable `prev' with
macro HAVE_cc0.
(can_combine_p): Protect variable `link' with AUTO_INC_DEC.
(extract_left_shift): Add parentheses around operand of &.
(merge_outer_ops): Avoid an empty body in an else-statement.
(gen_rtx_combine): Remove unused variable `i'.
* sparc/gmon-sol2.c: Include <fcntl.h>. Make return type of
function monstartup `void'. Likewise for internal_mcount. Add
`static void' prototype for moncontrol. Reconcile sprintf format
vs. args.
* sparc/sparc.c: Include <stdlib.h> and <string.h>/<strings.h>.
Make return type of function_arg_slotno explicitly `int'.
(reg_unused_after): Add parentheses around assignment used as
truth value.
(save_regs): Add explicit braces to avoid ambiguous `else'.
(function_arg_slotno): Add parentheses around && within ||.
(function_arg_pass_by_reference): Likewise.
(sparc_flat_output_function_prologue): Reconcile fprintf format
vs. args.
* svr4.h (ASM_OUTPUT_LIMITED_STRING): Add parentheses around
assignment used as truth value.
* cplus-dem.c: Include <stdlib.h>.
(demangle_signature): Avoid an empty body in an else-statement.
(do_type): Remove unused variable `lvl'.
* cppexp.c: Don't have <stdlib.h> depend on MULTIBYTE_CHARS.
Include <string.h>/<strings.h>.
(cpp_lex): Remove unused variable `namelen'.
(cpp_lex): Explicitly declare `num_chars' as an int.
* cpplib.c: Avoid duplicate inclusion of <stdlib.h>, include
<unistd.h> instead. Explicitly declare is_system_include
returning int.
(make_assertion): Remove unused variable `kt'.
(cpp_expand_to_buffer): Hide variable `obuf'.
(output_line_command): Remove unused variables, `line_end',
`line_cmd_buf' and `len'.
(macarg): Remove unused variable `arg_start'.
(special_symbol): Remove unused variable `i'. Add parentheses
around assignment used as truth value.
(do_include): Remove unused variables `pcfname' and `retried',
hide `pcf' and `pcfbuflimit'.
(do_line): Remove unused variable `i'.
(finclude): Hide variable `missing_newline'.
(cpp_handle_options): Remove unused variable `j'.
(read_token_list): Remove unused variable `eofp'.
(cpp_error_with_line): Remove unused variable `i'.
(cpp_warning_with_line): Likewise.
(cpp_pedwarn_with_line): Explicitly declare `column' as int.
(cpp_error_from_errno): Remove unused variable `i'.
* cse.c (invalidate): Add parentheses around assignment used as
truth value.
(find_best_addr): Move declaration of variable `our_cost' inside
the conditional macro where its used.
(fold_rtx): Avoid an empty body in an if-statement.
(cse_insn): Wrap variables `this_insn_cc0_mode' and
`this_insn_cc0' in macro HAVE_cc0.
* dwarf2out.c: Include <stdlib.h> and <string.h>/<string.h>.
(ASM_OUTPUT_DWARF_DATA8): Reconcile format vs. args in fprintf's.
(output_uleb128): Likewise.
(output_sleb128): Likewise.
(output_cfi): Likewise.
(output_call_frame_info): Remove unused variables `j', `fde_size'
and `fde_pad'.
(comp_unit_has_inlines): Hide declaration as per rest of file.
(size_of_line_prolog): Correct typo in prototype.
(add_arange): Likewise.
(output_aranges): Likewise.
(add_name_and_src_coords_attributes): Likewise.
(gen_array_type_die): Likewise.
(gen_inlined_subroutine_die): Likewise.
(equate_decl_number_to_die): Remove unused variable `i'.
(print_die): Reconcile format vs. args in fprintf's.
(print_dwarf_line_table): Likewise.
(output_die): Likewise.
(output_line_info): Likewise.
(add_subscript_info): Avoid an empty body in an else-statement.
(gen_subprogram_die): Remove unused variable `fp_loc'.
* dwarfout.c: Explicitly declare `next_pubname_number' as int.
Protect `ordering_attribute' prototype with USE_ORDERING_ATTRIBUTE
macro. Protect `src_coords_attribute' prototype with
DWARF_DECL_COORDINATES macro. Hide `output_entry_point_die'
prototype as in the rest of the file. Likewise for
`output_pointer_type_die' and `output_reference_type_die'. Remove
prototype for `type_of_for_scope'.
(output_unsigned_leb128): Reconcile format vs. args in fprintf.
(type_attribute): Add explicit braces to avoid ambiguous `else'.
* final.c: Include <stdlib.h> and <string.h>/<strings.h>.
(shorten_branches): Protect declaration of tmp_length with
SHORTEN_WITH_ADJUST_INSN_LENGTH and ADJUST_INSN_LENGTH macros.
(profile_function): Protect declaration of `sval' and `cxt'
variables with appropriate macros.
(final_scan_insn): Likewise for `note' variable. Add explicit
braces to avoid empty body in an if-statement.
(output_asm_insn): Move variable `i' inside macro conditional
where it is used. Add parentheses around assignment used as truth
value.
(asm_fprintf) Likewise, likewise.
* fix-header.c (main): Remove unused variable `done'. Protect
declaration of `i' with FIXPROTO_IGNORE_LIST.
* pexecute.c: Include <unistd.h>. Prototype `my_strerror'.
* print-rtl.c (print_inline_rtx): Explicitly declare the parameter
`ind'.
* profile.c: Include <string.h>/<strings.h>.
(instrument_arcs): Remove unused variables `note', `inverted',
`zero' and `neg_one'.
(branch_prob): Avoid empty body in an if-statement.
* regclass.c: Include <stdlib.h>.
(reg_alternate_class): Explicitly declare parameter `regno'.
* regmove.c (regmove_optimize): Remove unused variable `p'. Add
parentheses around assignment used as truth value.
(find_matches): Remove unused variables `output_operand' and
`matching_operand'.
(fixup_match_1): Remove statement with no effect: "if (0) ;".
* scan.c (sstring_append): Explicitly declare `count' as int.
(scan_string): Explicitly declare parameter `init' as int.
* sched.c: Include <stdlib.h>.
(BLOCKAGE_RANGE): Add parentheses around arithmetic in operand of |.
(rank_for_schedule): Add parentheses around assignment used as
truth value.
(schedule_block): Likewise.
(regno_use_in): Likewise.
(schedule_insns): Remove unused variable `i'.
* toplev.c: Include <stdlib.h> and <string.h>/<strings.h>.
(v_message_with_decl): Remove unused variable `n'.
(botch): Explicitly declare parameter `s' as char *.
(main): Add parentheses around assignment used as truth value.
* tree.c (make_node): Protect the variable `kind' with the
GATHER_STATISTICS macro.
(real_value_from_int_cst): Move variable `e' inside conditional
macro area where it is used.
(tree_last): Add parentheses around assignment used as truth value.
(build1): Protect the variable `kind' with the GATHER_STATISTICS
macro.
(print_obstack_statistics): Reconcile format vs. args in fprintf.
Protect variables `i', `total_nodes', and `total_bytes' with the
GATHER_STATISTICS macro.
Lots more -W -Wall warnings disappear.
From-SVN: r17517
1998-01-27 23:11:54 +01:00
|
|
|
|
#ifdef FIXPROTO_IGNORE_LIST
|
|
|
|
|
int i;
|
|
|
|
|
#endif
|
|
|
|
|
const char *cptr;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
int ifndef_line;
|
1993-10-12 23:58:40 +01:00
|
|
|
|
int endif_line;
|
|
|
|
|
long to_read;
|
1993-10-20 22:33:01 +01:00
|
|
|
|
long int inf_size;
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct symbol_list *cur_symbols;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
if (argv[0] && argv[0][0])
|
1993-10-20 23:28:08 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
char *p;
|
1993-10-20 23:28:08 +01:00
|
|
|
|
|
|
|
|
|
progname = 0;
|
|
|
|
|
for (p = argv[0]; *p; p++)
|
2002-05-17 20:07:01 +02:00
|
|
|
|
if (*p == '/')
|
|
|
|
|
progname = p;
|
1993-10-20 23:28:08 +01:00
|
|
|
|
progname = progname ? progname+1 : argv[0];
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
|
|
|
|
if (argc < 4)
|
|
|
|
|
{
|
1995-04-05 23:16:26 +02:00
|
|
|
|
fprintf (stderr, "%s: Usage: foo.h infile.h outfile.h options\n",
|
1993-07-26 02:11:20 +02:00
|
|
|
|
progname);
|
1997-04-20 18:39:28 +02:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inc_filename = argv[1];
|
|
|
|
|
inc_filename_length = strlen (inc_filename);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
|
|
|
|
#ifdef FIXPROTO_IGNORE_LIST
|
|
|
|
|
for (i = 0; files_to_ignore[i] != NULL; i++)
|
|
|
|
|
{
|
collect2.c (is_ctor_dtor): Const-ify.
* collect2.c (is_ctor_dtor): Const-ify.
* m88k-protos.c (output_file_start): Likewise.
* m88k.c (m88k_lang_independent_options, output_options,
output_file_start): Likewise.
* fix-header.c (files_to_ignore, std_include_entry, include_entry,
std_include_table, main): Likewise.
* protoize.c (longopts): Likewise.
* regclass.c (int_reg_class_contents): Likewise.
* toplev.c (dump_file, f_options, W_options): Make static.
(lang_independent_options, f_options, W_options): Const-ify.
* tree-dump.c (dump_file_info): Likewise.
* unroll.c (_factor): Make static.
java:
* chartables.h: Const-ify.
* gjavah.c (options): Likewise.
* jcf-dump.c (options): Likewise.
* jv-scan.c (options): Likewise.
* lex.c (java_start_char_p, java_part_char_p): Likewise.
* parse.y (binop_lookup): Likewise.
From-SVN: r48322
2001-12-27 04:35:21 +01:00
|
|
|
|
const char *const ignore_name = files_to_ignore[i];
|
1995-04-05 23:16:26 +02:00
|
|
|
|
int ignore_len = strlen (ignore_name);
|
|
|
|
|
if (strncmp (inc_filename, ignore_name, ignore_len) == 0)
|
|
|
|
|
{
|
|
|
|
|
if (ignore_name[ignore_len-1] == '/'
|
|
|
|
|
|| inc_filename[ignore_len] == '\0')
|
|
|
|
|
{
|
|
|
|
|
if (verbose)
|
|
|
|
|
fprintf (stderr, "%s: ignoring %s\n", progname, inc_filename);
|
1997-04-20 18:39:28 +02:00
|
|
|
|
exit (SUCCESS_EXIT_CODE);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-05-17 20:07:01 +02:00
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (strcmp (inc_filename, "sys/stat.h") == 0)
|
1995-04-05 23:16:26 +02:00
|
|
|
|
special_file_handling = sys_stat_h;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
else if (strcmp (inc_filename, "errno.h") == 0)
|
1995-12-27 23:28:33 +01:00
|
|
|
|
special_file_handling = errno_h, required_other++;
|
|
|
|
|
else if (strcmp (inc_filename, "stdlib.h") == 0)
|
|
|
|
|
special_file_handling = stdlib_h, required_other+=2;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
else if (strcmp (inc_filename, "stdio.h") == 0)
|
|
|
|
|
special_file_handling = stdio_h;
|
|
|
|
|
include_entry = std_include_table;
|
|
|
|
|
while (include_entry->name != NULL
|
1999-08-02 09:37:40 +02:00
|
|
|
|
&& ((strcmp (include_entry->name, CONTINUED) == 0)
|
1995-12-15 08:43:33 +01:00
|
|
|
|
|| strcmp (inc_filename, include_entry->name) != 0))
|
1995-04-05 23:16:26 +02:00
|
|
|
|
include_entry++;
|
|
|
|
|
|
1995-12-15 08:43:33 +01:00
|
|
|
|
if (include_entry->name != NULL)
|
|
|
|
|
{
|
collect2.c (is_ctor_dtor): Const-ify.
* collect2.c (is_ctor_dtor): Const-ify.
* m88k-protos.c (output_file_start): Likewise.
* m88k.c (m88k_lang_independent_options, output_options,
output_file_start): Likewise.
* fix-header.c (files_to_ignore, std_include_entry, include_entry,
std_include_table, main): Likewise.
* protoize.c (longopts): Likewise.
* regclass.c (int_reg_class_contents): Likewise.
* toplev.c (dump_file, f_options, W_options): Make static.
(lang_independent_options, f_options, W_options): Const-ify.
* tree-dump.c (dump_file_info): Likewise.
* unroll.c (_factor): Make static.
java:
* chartables.h: Const-ify.
* gjavah.c (options): Likewise.
* jcf-dump.c (options): Likewise.
* jv-scan.c (options): Likewise.
* lex.c (java_start_char_p, java_part_char_p): Likewise.
* parse.y (binop_lookup): Likewise.
From-SVN: r48322
2001-12-27 04:35:21 +01:00
|
|
|
|
const struct std_include_entry *entry;
|
1995-12-15 08:43:33 +01:00
|
|
|
|
cur_symbol_table_size = 0;
|
|
|
|
|
for (entry = include_entry; ;)
|
|
|
|
|
{
|
1997-12-22 10:31:41 +01:00
|
|
|
|
if (entry->flags)
|
|
|
|
|
add_symbols (entry->flags, entry->names);
|
1995-12-15 08:43:33 +01:00
|
|
|
|
entry++;
|
1999-08-29 11:28:09 +02:00
|
|
|
|
if (!entry->name || strcmp (entry->name, CONTINUED) != 0)
|
1995-12-15 08:43:33 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
symbol_table[0].names = NULL;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
2002-05-17 20:07:01 +02:00
|
|
|
|
/* Count and mark the prototypes required for this include file. */
|
1995-12-15 08:43:33 +01:00
|
|
|
|
for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
1995-12-15 08:43:33 +01:00
|
|
|
|
int name_len;
|
|
|
|
|
if (cur_symbols->flags & MACRO_SYMBOL)
|
|
|
|
|
continue;
|
|
|
|
|
cptr = cur_symbols->names;
|
|
|
|
|
for ( ; (name_len = strlen (cptr)) != 0; cptr+= name_len + 1)
|
|
|
|
|
{
|
|
|
|
|
struct fn_decl *fn = lookup_std_proto (cptr, name_len);
|
|
|
|
|
required_unseen_count++;
|
|
|
|
|
if (fn == NULL)
|
|
|
|
|
fprintf (stderr, "Internal error: No prototype for %s\n", cptr);
|
|
|
|
|
else
|
|
|
|
|
SET_REQUIRED (fn);
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
1995-04-05 23:16:26 +02:00
|
|
|
|
read_scan_file (argv[2], argc - 4, argv + 4);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
1993-10-12 23:58:40 +01:00
|
|
|
|
inf_fd = open (argv[2], O_RDONLY, 0666);
|
|
|
|
|
if (inf_fd < 0)
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "%s: Cannot open '%s' for reading -",
|
|
|
|
|
progname, argv[2]);
|
|
|
|
|
perror (NULL);
|
1997-04-20 18:39:28 +02:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
1993-10-12 23:58:40 +01:00
|
|
|
|
if (fstat (inf_fd, &sbuf) < 0)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "%s: Cannot get size of '%s' -", progname, argv[2]);
|
|
|
|
|
perror (NULL);
|
1997-04-20 18:39:28 +02:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
|
|
|
|
inf_size = sbuf.st_size;
|
1996-07-04 00:07:53 +02:00
|
|
|
|
inf_buffer = (char *) xmalloc (inf_size + 2);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
inf_ptr = inf_buffer;
|
|
|
|
|
|
|
|
|
|
to_read = inf_size;
|
|
|
|
|
while (to_read > 0)
|
|
|
|
|
{
|
|
|
|
|
long i = read (inf_fd, inf_buffer + inf_size - to_read, to_read);
|
|
|
|
|
if (i < 0)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "%s: Failed to read '%s' -", progname, argv[2]);
|
|
|
|
|
perror (NULL);
|
1997-04-20 18:39:28 +02:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
1993-10-12 23:58:40 +01:00
|
|
|
|
}
|
|
|
|
|
if (i == 0)
|
|
|
|
|
{
|
|
|
|
|
inf_size -= to_read;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
to_read -= i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close (inf_fd);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
|
2001-11-24 23:17:58 +01:00
|
|
|
|
/* Inf_size may have changed if read was short (as on VMS) */
|
|
|
|
|
inf_buffer[inf_size] = '\n';
|
|
|
|
|
inf_buffer[inf_size + 1] = '\0';
|
|
|
|
|
inf_limit = inf_buffer + inf_size;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* If file doesn't end with '\n', add one. */
|
1993-10-20 22:33:01 +01:00
|
|
|
|
if (inf_limit > inf_buffer && inf_limit[-1] != '\n')
|
|
|
|
|
inf_limit++;
|
|
|
|
|
|
1993-10-20 23:28:08 +01:00
|
|
|
|
unlink (argv[3]);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
outf = fopen (argv[3], "w");
|
|
|
|
|
if (outf == NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "%s: Cannot open '%s' for writing -",
|
|
|
|
|
progname, argv[3]);
|
|
|
|
|
perror (NULL);
|
1997-04-20 18:39:28 +02:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
1993-10-12 23:58:40 +01:00
|
|
|
|
lineno = 1;
|
|
|
|
|
|
|
|
|
|
if (check_protection (&ifndef_line, &endif_line))
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
|
|
|
|
lbrac_line = ifndef_line+1;
|
|
|
|
|
rbrac_line = endif_line;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lbrac_line = 1;
|
|
|
|
|
rbrac_line = -1;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* Reset input file. */
|
1993-10-12 23:58:40 +01:00
|
|
|
|
inf_ptr = inf_buffer;
|
1993-07-26 02:11:20 +02:00
|
|
|
|
lineno = 1;
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
if (lineno == lbrac_line)
|
|
|
|
|
write_lbrac ();
|
|
|
|
|
if (lineno == rbrac_line)
|
|
|
|
|
write_rbrac ();
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
struct fn_decl *fn;
|
1993-10-20 22:33:01 +01:00
|
|
|
|
c = INF_GET ();
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (c == EOF)
|
|
|
|
|
break;
|
c-format.c (maybe_read_dollar_number): Use safe-ctype macros and/or fold extra calls into fewer ones.
* c-format.c (maybe_read_dollar_number): Use safe-ctype macros
and/or fold extra calls into fewer ones.
* collect2.c (dump_file): Likewise.
* cppexp.c (parse_number): Likewise.
* cpplex.c (_cpp_lex_direct): Likewise.
* final.c (output_asm_insn, asm_fprintf): Likewise.
* fix-header.c (inf_scan_ident, main): Likewise.
* fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix):
Likewise.
* fold-const.c (real_hex_to_f): Likewise.
* gen-protos.c (parse_fn_proto): Likewise.
* genattrtab.c (check_attr_test, check_attr_value): Likewise.
* genrecog.c (change_state, write_action): Likewise.
* gensupport.c (shift_output_template): Likewise.
* local-alloc.c (requires_inout): Likewise.
* mips-tfile.c (IS_ASM_IDENT): Likewise.
* protoize.c (is_id_char, main): Likewise.
* real.c (asctoeg): Likewise.
* recog.c (asm_operand_ok): Likewise.
* reload.c (find_reloads): Likewise.
* scan.c (scan_identget_token): Likewise.
* sched-vis.c (print_value): Likewise.
* stringpool.c (ggc_alloc_string): Likewise.
* toplev.c (read_integral_parameter, decode_g_option): Likewise.
* tradcif.y (parse_number, yylex, parse_escape): Likewise.
* tradcpp.c (rescan): Likewise.
* tree.c (clean_symbol_name): Likewise.
* varasm.c (decode_reg_name): Likewise.
* alpha.h (ASM_OUTPUT_ASCII): Likewise.
* darwin.c (name_needs_quotes, func_name_maybe_scoped): Likewise.
* dsp16xx.h (ASM_OUTPUT_ASCII): Likewise.
* m88k.c (output_ascii): Likewise.
* m88k.h (OVERRIDE_OPTIONS): Likewise.
* mcore.h (REG_CLASS_FROM_LETTER): Likewise.
* ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise.
* sh.h (REG_CLASS_FROM_LETTER): Likewise.
cp:
* xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
extra calls into fewer ones.
f:
* bad.c (ffebad_finish): Use safe-ctype macros and/or fold extra
calls into fewer ones.
* implic.c (ffeimplic_lookup_): Likewise.
* intdoc.c (dumpimp): Likewise.
* intrin.c (ffeintrin_init_0): Likewise.
* lex.c (ffelex_backslash_, ffelex_cfebackslash_, ffelex_hash_):
Likewise.
* lex.h (ffelex_is_firstnamechar): Likewise.
* target.c (ffetarget_integerhex): Likewise.
java:
* gjavah.c (jni_print_char, decode_signature_piece): Use
safe-ctype macros and/or fold extra calls into fewer ones.
* lex.c (java_read_unicode, java_lex): Likewise.
* lex.h (JAVA_START_CHAR_P, JAVA_PART_CHAR_P, JAVA_ASCII_DIGIT,
JAVA_ASCII_HEXDIGIT, JAVA_ASCII_LETTER): Likewise.
* mangle_name.c (append_unicode_mangled_name,
unicode_mangling_length): Likewise.
From-SVN: r46397
2001-10-21 23:32:15 +02:00
|
|
|
|
if (ISIDST (c))
|
1993-07-26 02:11:20 +02:00
|
|
|
|
{
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_scan_ident (&buf, c);
|
1998-03-18 08:18:06 +01:00
|
|
|
|
(void) INF_UNGET (c);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
fputs (buf.base, outf);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
fn = lookup_std_proto (buf.base, strlen (buf.base));
|
1993-07-26 02:11:20 +02:00
|
|
|
|
/* We only want to edit the declaration matching the one
|
|
|
|
|
seen by scan-decls, as there can be multiple
|
1996-07-04 00:07:53 +02:00
|
|
|
|
declarations, selected by #ifdef __STDC__ or whatever. */
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (fn && fn->partial && fn->partial->line_seen == lineno)
|
|
|
|
|
{
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_skip_spaces (' ');
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (c == EOF)
|
|
|
|
|
break;
|
|
|
|
|
if (c == '(')
|
|
|
|
|
{
|
1993-10-12 23:58:40 +01:00
|
|
|
|
c = inf_skip_spaces (' ');
|
1993-07-26 02:11:20 +02:00
|
|
|
|
if (c == ')')
|
|
|
|
|
{
|
|
|
|
|
fprintf (outf, " _PARAMS((%s))", fn->params);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
putc ('(', outf);
|
1998-03-18 08:18:06 +01:00
|
|
|
|
(void) INF_UNGET (c);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
1993-08-10 03:59:37 +02:00
|
|
|
|
fprintf (outf, " %c", c);
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
1993-10-12 23:58:40 +01:00
|
|
|
|
{
|
|
|
|
|
putc (c, outf);
|
|
|
|
|
if (c == '\n')
|
|
|
|
|
break;
|
|
|
|
|
}
|
1993-07-26 02:11:20 +02:00
|
|
|
|
}
|
|
|
|
|
if (c == EOF)
|
|
|
|
|
break;
|
|
|
|
|
lineno++;
|
|
|
|
|
}
|
|
|
|
|
if (rbrac_line < 0)
|
|
|
|
|
write_rbrac ();
|
|
|
|
|
|
|
|
|
|
fclose (outf);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1995-04-05 23:16:26 +02:00
|
|
|
|
|
Warning Fixes:
* Makefile.in (print-rtl.o): Depend on bitmap.h.
(dbxout.o): Depend on toplev.h.
($(SCHED_PREFIX)sched.o): Likewise.
($(out_object_file)): Likewise for system.h and toplev.h.
(cppmain.o): Depend on gansidecl.h.
(cpplib.o): Likewise.
(cpperror.o): Likewise.
(cppexp.o): Likewise.
(cpphash.o): Likewise.
(cppalloc.o): Likewise.
(fix-header.o): Depend on cpplib.h and cpphash.h.
(scan-decls.o): Depend on gansidecl.h.
* basic-block.h (free_regset_vector): Add prototype.
* cccp.c (check_precompiled): Mark parameter `fname' with
ATTRIBUTE_UNUSED.
(do_assert): Likewise for `op' and `keyword'.
(do_unassert): Likewise.
(do_line): Likewise for `keyword'.
(do_error): Likewise for `op' and `keyword'.
(do_warning): Likewise.
(do_ident): Likewise for `keyword'.
(do_pragma): Likewise for `limit', `op' and `keyword'.
(do_sccs): Likewise.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(do_else): Likewise.
(do_endif): Likewise.
* collect2.c (getenv): Remove redundant prototype.
(collect_exit, collect_execute, dump_file): Likewise.
(dump_list): Wrap prototype and definition in COLLECT_EXPORT_LIST.
(dump_prefix_list): Hide prototype and definition.
* sparc.c: Include toplev.h.
(intreg_operand): Mark parameter `mode' with ATTRIBUTE_UNUSED.
(symbolic_memory_operand): Likewise.
(sp64_medium_pic_operand): Likewise.
(data_segment_operand): Likewise.
(text_segment_operand): Likewise.
(splittable_symbolic_memory_operand): Likewise.
(splittable_immediate_memory_operand): Likewise.
(eq_or_neq): Likewise.
(normal_comp_operator): Likewise.
(noov_compare_op): Likewise.
(v9_regcmp_op): Likewise.
(v8plus_regcmp_op): Likewise.
(extend_op): Likewise.
(cc_arithop): Likewise.
(cc_arithopn): Likewise.
(small_int): Likewise.
(uns_small_int): Likewise.
(clobbered_register): Likewise.
(legitimize_pic_address): Likewise.
(delay_operand): Likewise.
(sparc_builtin_saveregs): Remove unused variable `stdarg'.
* sparc.h (order_regs_for_local_alloc, eligible_for_return_delay,
sparc_issue_rate, v8plus_regcmp_p): Add prototypes.
* sparc.md (cmpdi_v8plus): Add abort for default case in switch.
* cppalloc.c: Include gansidecl.h.
* cpperror.c: Include stdarg.h/varargs.h and gansidecl.h.
(cpp_file_line_for_message): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
(v_cpp_message): New function.
(cpp_message): Use it. Also convert to variable arguments.
(cpp_fatal): Likewise.
(cpp_pfatal_with_name): Constify parameter `name'.
* cppexp.c: Move gansidecl.h before cpplib.h.
* cpphash.c: Likewise.
* cpphash.h (hashf, delete_macro): Add prototypes.
* cpplib.c: Include stdarg.h/varargs.h and move gansidecl.h before
cpplib.h. Don't include errno.h.
(update_path): Add arguments to prototype.
(cpp_fatal, cpp_file_line_for_message, cpp_message, delete_macro,
cpp_print_containing_files): Remove redundant prototypes.
(cpp_hash_cleanup, add_import, append_include_chain,
make_assertion, path_include, initialize_builtins,
initialize_char_syntax, finclude, validate_else, comp_def_part,
lookup_import, redundant_include_p, is_system_include,
read_name_map, read_filename_string, open_include_file,
check_macro_name, compare_defs, compare_token_lists,
eval_if_expression, change_newlines): Add prototype arguments.
(hashf): Remove redundant prototype.
(read_token_list, free_token_list, safe_read, xcalloc, savestring,
conditional_skip, skip_if_group): Add prototype arguments.
(fdopen): Remove redundant prototype.
(do_define, do_line, do_include, do_undef, do_error, do_pragma,
do_ident, do_if, do_xifdef, do_else, do_elif, do_endif, do_sccs,
do_once, do_assert, do_unassert, do_warning): Add prototype arguments.
(struct directive): Add prototype arguments to function pointer
member `func'.
(handle_directive): Add missing arguments to call to `do_line'.
(do_include): Mark parameters `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_line): Likewise for `keyword' and new parameters `unused1' and
`unused2'.
(do_error): Likewise for `keyword'.
(do_warning): Likewise. Also add missing argument `pfile' in call
to cpp_pedwarn.
(do_once): Mark parameter `keyword', `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_ident): Likewise for `keyword', `buf' and `limit'.
(do_pragma): Likewise. Also add missing arguments in call to do_once.
(do_sccs): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(eval_if_expression): Likewise for `buf' and `length'.
(do_xifdef): Likewise for `unused1' and `unused2'.
(do_else): Likewise for `keyword', `buf' and `limit'.
(do_endif): Likewise.
(parse_name): Add missing argument `pfile' in call to cpp_pedwarn.
(cpp_handle_options): Remove superfluous NULL argument in call to
cpp_fatal.
(cpp_handle_options): Likewise.
(do_assert): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_unassert): Likewise.
(cpp_print_file_and_line): Add missing argument `pfile' in call to
cpp_file_line_for_message.
(v_cpp_error): New function.
(cpp_error): Use it. Also accept variable arguments.
(v_cpp_warning): New function.
(cpp_warning): Use it. Also accept variable arguments.
(cpp_pedwarn): Accept variable arguments.
(v_cpp_error_with_line): New function
(cpp_error_with_line): Use it. Accept variable arguments.
(v_cpp_warning_with_line): New function.
(cpp_warning_with_line): Use it. Accept variable arguments. Hide
definition.
(cpp_pedwarn_with_line): Accept variable arguments.
(cpp_pedwarn_with_file_and_line): Likewise.
(cpp_error_from_errno): Constify parameter `name'. Add missing
argument `pfile' in call to cpp_file_line_for_message.
(cpp_perror_with_name): Constify parameter `name'.
* cpplib.h: Define PARAMS() in terms of PROTO().
(fatal): Remove redundant prototype.
(cpp_error, cpp_warning, cpp_pedwarn, cpp_error_with_line,
cpp_pedwarn_with_line, cpp_pedwarn_with_file_and_line,
cpp_error_from_errno, cpp_perror_with_name, cpp_pfatal_with_name,
cpp_fatal, cpp_message, cpp_pfatal_with_name,
cpp_file_line_for_message, cpp_print_containing_files): Add
arguments to prototypes.
(scan_decls, cpp_finish): Add prototypes.
* cppmain.c: Include gansidecl.h.
(main): Remove unused variable `i'.
* dbxout.c: Include toplev.h.
* demangle.h (do_tlink, collect_execute, collect_exit,
collect_wait, dump_file, file_exists): Add prototype.
* dwarf2out.c (dwarf_type_encoding_name, decl_start_label): Hide
prototype and definition.
(gen_unspecified_parameters_die): Don't assign results of call to
function new_die() to unused variable `parm_die'.
(dwarf2out_line): Mark parameter `filename' with ATTRIBUTE_UNUSED.
(dwarf2out_define): Likewise for `lineno' and `buffer'.
* dwarfout.c (output_unsigned_leb128, output_signed_leb128): Hide
prototype and definition.
(output_die): Add prototype arguments to function pointer arg.
(output_unspecified_parameters_die): Mark parameter `arg' with
ATTRIBUTE_UNUSED.
* except.c (output_exception_table_entry): Remove unused variable
`eh_entry'.
* except.h (expand_fixup_region_start, expand_fixup_region_end):
Add prototypes.
* expr.c (do_jump_by_parts_equality_rtx): Remove prototype.
* expr.h (do_jump_by_parts_equality_rtx): Add prototype.
* fix-header.c: Include stdarg.h/varargs.h, move gansidecl.h
before cpplib.h, include cpphash.h, remove redundant prototype of
cpp_fatal, don't define `const', add a prototype for `fatal'.
(cpp_file_line_for_message): Add missing arguments `pfile'.
(v_cpp_message): New function.
(cpp_message): Use it.
(v_fatal): New function.
(fatal, cpp_fatal): Use it.
(cpp_pfatal_with_name): Constify parameter `name'.
* flow.c (free_regset_vector): Remove redundant prototype.
* function.c (round_down): Wrap prototype and definition with
macro ARGS_GROW_DOWNWARD.
(record_insns): Wrap prototype and definition with
defined (HAVE_prologue) || defined (HAVE_epilogue).
* gansidecl.h (ATTRIBUTE_PRINTF_4, ATTRIBUTE_PRINTF_5): New macros.
* gen-protos.c: Include gansidecl.h.
(hashf): Don't make it static, constify parameter `name'.
* genattrtab.c (check_attr_test): Change XEXP() to XSTR() to match
specifier %s in calls to function `fatal'.
* haifa-sched.c: Include toplev.h.
(find_rgns): Remove unused variable `j'.
* integrate.c (note_modified_parmregs): Mark parameter `x' with
ATTRIBUTE_UNUSED.
(mark_stores): Likewise.
* jump.c (mark_modified_reg): Likewise.
* output.h (insn_current_reference_address): Add prototype.
(eh_frame_section): Likewise.
* print-rtl.c: Include bitmap.h.
* reload1.c (reload): Wrap variables `note' and `next' in macro
PRESERVE_DEATH_INFO_REGNO_P.
(forget_old_reloads_1): Mark parameter `ignored' with
ATTRIBUTE_UNUSED.
(choose_reload_regs): Remove unused variable `in'.
(reload_cse_invalidate_mem): Mark parameter `ignore' with
ATTRIBUTE_UNUSED.
(reload_cse_check_clobber): Likewise.
* rtl.h (expand_null_return, reg_classes_intersect_p): Add prototype.
(mark_elimination): Fix typo in prototype.
* scan-decls.c: Include gansidecl.h.
* tree.h (using_eh_for_cleanups, supports_one_only): Add prototype.
From-SVN: r19867
1998-05-19 10:42:48 +02:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
v_fatal (str, ap)
|
|
|
|
|
const char * str;
|
|
|
|
|
va_list ap;
|
1995-04-05 23:16:26 +02:00
|
|
|
|
{
|
1995-04-12 08:34:50 +02:00
|
|
|
|
fprintf (stderr, "%s: %s: ", progname, inc_filename);
|
Warning Fixes:
* Makefile.in (print-rtl.o): Depend on bitmap.h.
(dbxout.o): Depend on toplev.h.
($(SCHED_PREFIX)sched.o): Likewise.
($(out_object_file)): Likewise for system.h and toplev.h.
(cppmain.o): Depend on gansidecl.h.
(cpplib.o): Likewise.
(cpperror.o): Likewise.
(cppexp.o): Likewise.
(cpphash.o): Likewise.
(cppalloc.o): Likewise.
(fix-header.o): Depend on cpplib.h and cpphash.h.
(scan-decls.o): Depend on gansidecl.h.
* basic-block.h (free_regset_vector): Add prototype.
* cccp.c (check_precompiled): Mark parameter `fname' with
ATTRIBUTE_UNUSED.
(do_assert): Likewise for `op' and `keyword'.
(do_unassert): Likewise.
(do_line): Likewise for `keyword'.
(do_error): Likewise for `op' and `keyword'.
(do_warning): Likewise.
(do_ident): Likewise for `keyword'.
(do_pragma): Likewise for `limit', `op' and `keyword'.
(do_sccs): Likewise.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(do_else): Likewise.
(do_endif): Likewise.
* collect2.c (getenv): Remove redundant prototype.
(collect_exit, collect_execute, dump_file): Likewise.
(dump_list): Wrap prototype and definition in COLLECT_EXPORT_LIST.
(dump_prefix_list): Hide prototype and definition.
* sparc.c: Include toplev.h.
(intreg_operand): Mark parameter `mode' with ATTRIBUTE_UNUSED.
(symbolic_memory_operand): Likewise.
(sp64_medium_pic_operand): Likewise.
(data_segment_operand): Likewise.
(text_segment_operand): Likewise.
(splittable_symbolic_memory_operand): Likewise.
(splittable_immediate_memory_operand): Likewise.
(eq_or_neq): Likewise.
(normal_comp_operator): Likewise.
(noov_compare_op): Likewise.
(v9_regcmp_op): Likewise.
(v8plus_regcmp_op): Likewise.
(extend_op): Likewise.
(cc_arithop): Likewise.
(cc_arithopn): Likewise.
(small_int): Likewise.
(uns_small_int): Likewise.
(clobbered_register): Likewise.
(legitimize_pic_address): Likewise.
(delay_operand): Likewise.
(sparc_builtin_saveregs): Remove unused variable `stdarg'.
* sparc.h (order_regs_for_local_alloc, eligible_for_return_delay,
sparc_issue_rate, v8plus_regcmp_p): Add prototypes.
* sparc.md (cmpdi_v8plus): Add abort for default case in switch.
* cppalloc.c: Include gansidecl.h.
* cpperror.c: Include stdarg.h/varargs.h and gansidecl.h.
(cpp_file_line_for_message): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
(v_cpp_message): New function.
(cpp_message): Use it. Also convert to variable arguments.
(cpp_fatal): Likewise.
(cpp_pfatal_with_name): Constify parameter `name'.
* cppexp.c: Move gansidecl.h before cpplib.h.
* cpphash.c: Likewise.
* cpphash.h (hashf, delete_macro): Add prototypes.
* cpplib.c: Include stdarg.h/varargs.h and move gansidecl.h before
cpplib.h. Don't include errno.h.
(update_path): Add arguments to prototype.
(cpp_fatal, cpp_file_line_for_message, cpp_message, delete_macro,
cpp_print_containing_files): Remove redundant prototypes.
(cpp_hash_cleanup, add_import, append_include_chain,
make_assertion, path_include, initialize_builtins,
initialize_char_syntax, finclude, validate_else, comp_def_part,
lookup_import, redundant_include_p, is_system_include,
read_name_map, read_filename_string, open_include_file,
check_macro_name, compare_defs, compare_token_lists,
eval_if_expression, change_newlines): Add prototype arguments.
(hashf): Remove redundant prototype.
(read_token_list, free_token_list, safe_read, xcalloc, savestring,
conditional_skip, skip_if_group): Add prototype arguments.
(fdopen): Remove redundant prototype.
(do_define, do_line, do_include, do_undef, do_error, do_pragma,
do_ident, do_if, do_xifdef, do_else, do_elif, do_endif, do_sccs,
do_once, do_assert, do_unassert, do_warning): Add prototype arguments.
(struct directive): Add prototype arguments to function pointer
member `func'.
(handle_directive): Add missing arguments to call to `do_line'.
(do_include): Mark parameters `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_line): Likewise for `keyword' and new parameters `unused1' and
`unused2'.
(do_error): Likewise for `keyword'.
(do_warning): Likewise. Also add missing argument `pfile' in call
to cpp_pedwarn.
(do_once): Mark parameter `keyword', `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_ident): Likewise for `keyword', `buf' and `limit'.
(do_pragma): Likewise. Also add missing arguments in call to do_once.
(do_sccs): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(eval_if_expression): Likewise for `buf' and `length'.
(do_xifdef): Likewise for `unused1' and `unused2'.
(do_else): Likewise for `keyword', `buf' and `limit'.
(do_endif): Likewise.
(parse_name): Add missing argument `pfile' in call to cpp_pedwarn.
(cpp_handle_options): Remove superfluous NULL argument in call to
cpp_fatal.
(cpp_handle_options): Likewise.
(do_assert): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_unassert): Likewise.
(cpp_print_file_and_line): Add missing argument `pfile' in call to
cpp_file_line_for_message.
(v_cpp_error): New function.
(cpp_error): Use it. Also accept variable arguments.
(v_cpp_warning): New function.
(cpp_warning): Use it. Also accept variable arguments.
(cpp_pedwarn): Accept variable arguments.
(v_cpp_error_with_line): New function
(cpp_error_with_line): Use it. Accept variable arguments.
(v_cpp_warning_with_line): New function.
(cpp_warning_with_line): Use it. Accept variable arguments. Hide
definition.
(cpp_pedwarn_with_line): Accept variable arguments.
(cpp_pedwarn_with_file_and_line): Likewise.
(cpp_error_from_errno): Constify parameter `name'. Add missing
argument `pfile' in call to cpp_file_line_for_message.
(cpp_perror_with_name): Constify parameter `name'.
* cpplib.h: Define PARAMS() in terms of PROTO().
(fatal): Remove redundant prototype.
(cpp_error, cpp_warning, cpp_pedwarn, cpp_error_with_line,
cpp_pedwarn_with_line, cpp_pedwarn_with_file_and_line,
cpp_error_from_errno, cpp_perror_with_name, cpp_pfatal_with_name,
cpp_fatal, cpp_message, cpp_pfatal_with_name,
cpp_file_line_for_message, cpp_print_containing_files): Add
arguments to prototypes.
(scan_decls, cpp_finish): Add prototypes.
* cppmain.c: Include gansidecl.h.
(main): Remove unused variable `i'.
* dbxout.c: Include toplev.h.
* demangle.h (do_tlink, collect_execute, collect_exit,
collect_wait, dump_file, file_exists): Add prototype.
* dwarf2out.c (dwarf_type_encoding_name, decl_start_label): Hide
prototype and definition.
(gen_unspecified_parameters_die): Don't assign results of call to
function new_die() to unused variable `parm_die'.
(dwarf2out_line): Mark parameter `filename' with ATTRIBUTE_UNUSED.
(dwarf2out_define): Likewise for `lineno' and `buffer'.
* dwarfout.c (output_unsigned_leb128, output_signed_leb128): Hide
prototype and definition.
(output_die): Add prototype arguments to function pointer arg.
(output_unspecified_parameters_die): Mark parameter `arg' with
ATTRIBUTE_UNUSED.
* except.c (output_exception_table_entry): Remove unused variable
`eh_entry'.
* except.h (expand_fixup_region_start, expand_fixup_region_end):
Add prototypes.
* expr.c (do_jump_by_parts_equality_rtx): Remove prototype.
* expr.h (do_jump_by_parts_equality_rtx): Add prototype.
* fix-header.c: Include stdarg.h/varargs.h, move gansidecl.h
before cpplib.h, include cpphash.h, remove redundant prototype of
cpp_fatal, don't define `const', add a prototype for `fatal'.
(cpp_file_line_for_message): Add missing arguments `pfile'.
(v_cpp_message): New function.
(cpp_message): Use it.
(v_fatal): New function.
(fatal, cpp_fatal): Use it.
(cpp_pfatal_with_name): Constify parameter `name'.
* flow.c (free_regset_vector): Remove redundant prototype.
* function.c (round_down): Wrap prototype and definition with
macro ARGS_GROW_DOWNWARD.
(record_insns): Wrap prototype and definition with
defined (HAVE_prologue) || defined (HAVE_epilogue).
* gansidecl.h (ATTRIBUTE_PRINTF_4, ATTRIBUTE_PRINTF_5): New macros.
* gen-protos.c: Include gansidecl.h.
(hashf): Don't make it static, constify parameter `name'.
* genattrtab.c (check_attr_test): Change XEXP() to XSTR() to match
specifier %s in calls to function `fatal'.
* haifa-sched.c: Include toplev.h.
(find_rgns): Remove unused variable `j'.
* integrate.c (note_modified_parmregs): Mark parameter `x' with
ATTRIBUTE_UNUSED.
(mark_stores): Likewise.
* jump.c (mark_modified_reg): Likewise.
* output.h (insn_current_reference_address): Add prototype.
(eh_frame_section): Likewise.
* print-rtl.c: Include bitmap.h.
* reload1.c (reload): Wrap variables `note' and `next' in macro
PRESERVE_DEATH_INFO_REGNO_P.
(forget_old_reloads_1): Mark parameter `ignored' with
ATTRIBUTE_UNUSED.
(choose_reload_regs): Remove unused variable `in'.
(reload_cse_invalidate_mem): Mark parameter `ignore' with
ATTRIBUTE_UNUSED.
(reload_cse_check_clobber): Likewise.
* rtl.h (expand_null_return, reg_classes_intersect_p): Add prototype.
(mark_elimination): Fix typo in prototype.
* scan-decls.c: Include gansidecl.h.
* tree.h (using_eh_for_cleanups, supports_one_only): Add prototype.
From-SVN: r19867
1998-05-19 10:42:48 +02:00
|
|
|
|
vfprintf (stderr, str, ap);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
fprintf (stderr, "\n");
|
2002-05-17 20:07:01 +02:00
|
|
|
|
|
1995-05-17 00:03:31 +02:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
1995-04-05 23:16:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
cpperror.c (cpp_file_line_for_message): Constify a char*.
* cpperror.c (cpp_file_line_for_message): Constify a char*.
* cppexp.c (parse_number, parse_charconst, cpp_lex,
cpp_parse_expr): Add static prototypes.
(parse_charconst): Don't cast away const-ness.
(token): Constify a char*.
* cppfiles.c (file_name_list, include_hash, find_include_file,
finclude, initialize_input_buffer): Constify a char*.
(file_cleanup, find_position): Add static prototypes.
* cpphash.c (macro_cleanup, macarg, timestamp, special_symbol,
collect_expansion): Add static prototypes.
(cpp_install, create_definition, monthnames): Constify a char*.
* cpphash.h (cpp_install): Likewise.
* cppinit.c (known_suffixes, default_include,
dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise.
(base_name, dump_special_to_buffer, initialize_dependency_output):
Add static prototypes.
* cpplib.c (my_strerror): Constify a char*.
(null_underflow, null_cleanup, skip_comment, copy_comment,
copy_rest_of_line, handle_directive, pass_thru_directive,
get_directive_token, read_line_number, cpp_print_file_and_line,
v_cpp_error, v_cpp_warning, v_cpp_error_with_line,
v_cpp_warning_with_line, detect_if_not_defined,
consider_directive_while_skipping): Add static prototypes.
(pass_thru_directive, check_macro_name, cpp_expand_to_buffer,
cpp_pedwarn_with_file_and_line): Constify a char*.
* cpplib.h (cpp_options, include_hash, progname, definition,
cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer,
check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message,
find_include_file, deps_output, include_hash): Constify a char*.
* cppmain.c (progname): Constify.
(main): Add prototype. Use return, not exit.
* fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac,
recognized_macro, check_macro_names, read_scan_file, write_rbrac,
inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident,
check_protection): Add static prototype.
(xfree): Remove.
(progname, recognized_macrom, recognized_extern): Constify a char*.
(main): Add prototype.
* gen-protos.c (progname): Constify a char*.
From-SVN: r29171
1999-09-07 17:41:26 +02:00
|
|
|
|
static void
|
2000-01-14 18:14:43 +01:00
|
|
|
|
fatal VPARAMS ((const char *str, ...))
|
1996-06-07 05:07:32 +02:00
|
|
|
|
{
|
2001-08-27 08:48:43 +02:00
|
|
|
|
VA_OPEN (ap, str);
|
|
|
|
|
VA_FIXEDARG (ap, const char *, str);
|
Warning Fixes:
* Makefile.in (print-rtl.o): Depend on bitmap.h.
(dbxout.o): Depend on toplev.h.
($(SCHED_PREFIX)sched.o): Likewise.
($(out_object_file)): Likewise for system.h and toplev.h.
(cppmain.o): Depend on gansidecl.h.
(cpplib.o): Likewise.
(cpperror.o): Likewise.
(cppexp.o): Likewise.
(cpphash.o): Likewise.
(cppalloc.o): Likewise.
(fix-header.o): Depend on cpplib.h and cpphash.h.
(scan-decls.o): Depend on gansidecl.h.
* basic-block.h (free_regset_vector): Add prototype.
* cccp.c (check_precompiled): Mark parameter `fname' with
ATTRIBUTE_UNUSED.
(do_assert): Likewise for `op' and `keyword'.
(do_unassert): Likewise.
(do_line): Likewise for `keyword'.
(do_error): Likewise for `op' and `keyword'.
(do_warning): Likewise.
(do_ident): Likewise for `keyword'.
(do_pragma): Likewise for `limit', `op' and `keyword'.
(do_sccs): Likewise.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(do_else): Likewise.
(do_endif): Likewise.
* collect2.c (getenv): Remove redundant prototype.
(collect_exit, collect_execute, dump_file): Likewise.
(dump_list): Wrap prototype and definition in COLLECT_EXPORT_LIST.
(dump_prefix_list): Hide prototype and definition.
* sparc.c: Include toplev.h.
(intreg_operand): Mark parameter `mode' with ATTRIBUTE_UNUSED.
(symbolic_memory_operand): Likewise.
(sp64_medium_pic_operand): Likewise.
(data_segment_operand): Likewise.
(text_segment_operand): Likewise.
(splittable_symbolic_memory_operand): Likewise.
(splittable_immediate_memory_operand): Likewise.
(eq_or_neq): Likewise.
(normal_comp_operator): Likewise.
(noov_compare_op): Likewise.
(v9_regcmp_op): Likewise.
(v8plus_regcmp_op): Likewise.
(extend_op): Likewise.
(cc_arithop): Likewise.
(cc_arithopn): Likewise.
(small_int): Likewise.
(uns_small_int): Likewise.
(clobbered_register): Likewise.
(legitimize_pic_address): Likewise.
(delay_operand): Likewise.
(sparc_builtin_saveregs): Remove unused variable `stdarg'.
* sparc.h (order_regs_for_local_alloc, eligible_for_return_delay,
sparc_issue_rate, v8plus_regcmp_p): Add prototypes.
* sparc.md (cmpdi_v8plus): Add abort for default case in switch.
* cppalloc.c: Include gansidecl.h.
* cpperror.c: Include stdarg.h/varargs.h and gansidecl.h.
(cpp_file_line_for_message): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
(v_cpp_message): New function.
(cpp_message): Use it. Also convert to variable arguments.
(cpp_fatal): Likewise.
(cpp_pfatal_with_name): Constify parameter `name'.
* cppexp.c: Move gansidecl.h before cpplib.h.
* cpphash.c: Likewise.
* cpphash.h (hashf, delete_macro): Add prototypes.
* cpplib.c: Include stdarg.h/varargs.h and move gansidecl.h before
cpplib.h. Don't include errno.h.
(update_path): Add arguments to prototype.
(cpp_fatal, cpp_file_line_for_message, cpp_message, delete_macro,
cpp_print_containing_files): Remove redundant prototypes.
(cpp_hash_cleanup, add_import, append_include_chain,
make_assertion, path_include, initialize_builtins,
initialize_char_syntax, finclude, validate_else, comp_def_part,
lookup_import, redundant_include_p, is_system_include,
read_name_map, read_filename_string, open_include_file,
check_macro_name, compare_defs, compare_token_lists,
eval_if_expression, change_newlines): Add prototype arguments.
(hashf): Remove redundant prototype.
(read_token_list, free_token_list, safe_read, xcalloc, savestring,
conditional_skip, skip_if_group): Add prototype arguments.
(fdopen): Remove redundant prototype.
(do_define, do_line, do_include, do_undef, do_error, do_pragma,
do_ident, do_if, do_xifdef, do_else, do_elif, do_endif, do_sccs,
do_once, do_assert, do_unassert, do_warning): Add prototype arguments.
(struct directive): Add prototype arguments to function pointer
member `func'.
(handle_directive): Add missing arguments to call to `do_line'.
(do_include): Mark parameters `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_line): Likewise for `keyword' and new parameters `unused1' and
`unused2'.
(do_error): Likewise for `keyword'.
(do_warning): Likewise. Also add missing argument `pfile' in call
to cpp_pedwarn.
(do_once): Mark parameter `keyword', `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_ident): Likewise for `keyword', `buf' and `limit'.
(do_pragma): Likewise. Also add missing arguments in call to do_once.
(do_sccs): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(eval_if_expression): Likewise for `buf' and `length'.
(do_xifdef): Likewise for `unused1' and `unused2'.
(do_else): Likewise for `keyword', `buf' and `limit'.
(do_endif): Likewise.
(parse_name): Add missing argument `pfile' in call to cpp_pedwarn.
(cpp_handle_options): Remove superfluous NULL argument in call to
cpp_fatal.
(cpp_handle_options): Likewise.
(do_assert): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_unassert): Likewise.
(cpp_print_file_and_line): Add missing argument `pfile' in call to
cpp_file_line_for_message.
(v_cpp_error): New function.
(cpp_error): Use it. Also accept variable arguments.
(v_cpp_warning): New function.
(cpp_warning): Use it. Also accept variable arguments.
(cpp_pedwarn): Accept variable arguments.
(v_cpp_error_with_line): New function
(cpp_error_with_line): Use it. Accept variable arguments.
(v_cpp_warning_with_line): New function.
(cpp_warning_with_line): Use it. Accept variable arguments. Hide
definition.
(cpp_pedwarn_with_line): Accept variable arguments.
(cpp_pedwarn_with_file_and_line): Likewise.
(cpp_error_from_errno): Constify parameter `name'. Add missing
argument `pfile' in call to cpp_file_line_for_message.
(cpp_perror_with_name): Constify parameter `name'.
* cpplib.h: Define PARAMS() in terms of PROTO().
(fatal): Remove redundant prototype.
(cpp_error, cpp_warning, cpp_pedwarn, cpp_error_with_line,
cpp_pedwarn_with_line, cpp_pedwarn_with_file_and_line,
cpp_error_from_errno, cpp_perror_with_name, cpp_pfatal_with_name,
cpp_fatal, cpp_message, cpp_pfatal_with_name,
cpp_file_line_for_message, cpp_print_containing_files): Add
arguments to prototypes.
(scan_decls, cpp_finish): Add prototypes.
* cppmain.c: Include gansidecl.h.
(main): Remove unused variable `i'.
* dbxout.c: Include toplev.h.
* demangle.h (do_tlink, collect_execute, collect_exit,
collect_wait, dump_file, file_exists): Add prototype.
* dwarf2out.c (dwarf_type_encoding_name, decl_start_label): Hide
prototype and definition.
(gen_unspecified_parameters_die): Don't assign results of call to
function new_die() to unused variable `parm_die'.
(dwarf2out_line): Mark parameter `filename' with ATTRIBUTE_UNUSED.
(dwarf2out_define): Likewise for `lineno' and `buffer'.
* dwarfout.c (output_unsigned_leb128, output_signed_leb128): Hide
prototype and definition.
(output_die): Add prototype arguments to function pointer arg.
(output_unspecified_parameters_die): Mark parameter `arg' with
ATTRIBUTE_UNUSED.
* except.c (output_exception_table_entry): Remove unused variable
`eh_entry'.
* except.h (expand_fixup_region_start, expand_fixup_region_end):
Add prototypes.
* expr.c (do_jump_by_parts_equality_rtx): Remove prototype.
* expr.h (do_jump_by_parts_equality_rtx): Add prototype.
* fix-header.c: Include stdarg.h/varargs.h, move gansidecl.h
before cpplib.h, include cpphash.h, remove redundant prototype of
cpp_fatal, don't define `const', add a prototype for `fatal'.
(cpp_file_line_for_message): Add missing arguments `pfile'.
(v_cpp_message): New function.
(cpp_message): Use it.
(v_fatal): New function.
(fatal, cpp_fatal): Use it.
(cpp_pfatal_with_name): Constify parameter `name'.
* flow.c (free_regset_vector): Remove redundant prototype.
* function.c (round_down): Wrap prototype and definition with
macro ARGS_GROW_DOWNWARD.
(record_insns): Wrap prototype and definition with
defined (HAVE_prologue) || defined (HAVE_epilogue).
* gansidecl.h (ATTRIBUTE_PRINTF_4, ATTRIBUTE_PRINTF_5): New macros.
* gen-protos.c: Include gansidecl.h.
(hashf): Don't make it static, constify parameter `name'.
* genattrtab.c (check_attr_test): Change XEXP() to XSTR() to match
specifier %s in calls to function `fatal'.
* haifa-sched.c: Include toplev.h.
(find_rgns): Remove unused variable `j'.
* integrate.c (note_modified_parmregs): Mark parameter `x' with
ATTRIBUTE_UNUSED.
(mark_stores): Likewise.
* jump.c (mark_modified_reg): Likewise.
* output.h (insn_current_reference_address): Add prototype.
(eh_frame_section): Likewise.
* print-rtl.c: Include bitmap.h.
* reload1.c (reload): Wrap variables `note' and `next' in macro
PRESERVE_DEATH_INFO_REGNO_P.
(forget_old_reloads_1): Mark parameter `ignored' with
ATTRIBUTE_UNUSED.
(choose_reload_regs): Remove unused variable `in'.
(reload_cse_invalidate_mem): Mark parameter `ignore' with
ATTRIBUTE_UNUSED.
(reload_cse_check_clobber): Likewise.
* rtl.h (expand_null_return, reg_classes_intersect_p): Add prototype.
(mark_elimination): Fix typo in prototype.
* scan-decls.c: Include gansidecl.h.
* tree.h (using_eh_for_cleanups, supports_one_only): Add prototype.
From-SVN: r19867
1998-05-19 10:42:48 +02:00
|
|
|
|
|
2001-02-03 14:33:14 +01:00
|
|
|
|
v_fatal (str, ap);
|
2001-08-27 08:48:43 +02:00
|
|
|
|
VA_CLOSE (ap);
|
Warning Fixes:
* Makefile.in (print-rtl.o): Depend on bitmap.h.
(dbxout.o): Depend on toplev.h.
($(SCHED_PREFIX)sched.o): Likewise.
($(out_object_file)): Likewise for system.h and toplev.h.
(cppmain.o): Depend on gansidecl.h.
(cpplib.o): Likewise.
(cpperror.o): Likewise.
(cppexp.o): Likewise.
(cpphash.o): Likewise.
(cppalloc.o): Likewise.
(fix-header.o): Depend on cpplib.h and cpphash.h.
(scan-decls.o): Depend on gansidecl.h.
* basic-block.h (free_regset_vector): Add prototype.
* cccp.c (check_precompiled): Mark parameter `fname' with
ATTRIBUTE_UNUSED.
(do_assert): Likewise for `op' and `keyword'.
(do_unassert): Likewise.
(do_line): Likewise for `keyword'.
(do_error): Likewise for `op' and `keyword'.
(do_warning): Likewise.
(do_ident): Likewise for `keyword'.
(do_pragma): Likewise for `limit', `op' and `keyword'.
(do_sccs): Likewise.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(do_else): Likewise.
(do_endif): Likewise.
* collect2.c (getenv): Remove redundant prototype.
(collect_exit, collect_execute, dump_file): Likewise.
(dump_list): Wrap prototype and definition in COLLECT_EXPORT_LIST.
(dump_prefix_list): Hide prototype and definition.
* sparc.c: Include toplev.h.
(intreg_operand): Mark parameter `mode' with ATTRIBUTE_UNUSED.
(symbolic_memory_operand): Likewise.
(sp64_medium_pic_operand): Likewise.
(data_segment_operand): Likewise.
(text_segment_operand): Likewise.
(splittable_symbolic_memory_operand): Likewise.
(splittable_immediate_memory_operand): Likewise.
(eq_or_neq): Likewise.
(normal_comp_operator): Likewise.
(noov_compare_op): Likewise.
(v9_regcmp_op): Likewise.
(v8plus_regcmp_op): Likewise.
(extend_op): Likewise.
(cc_arithop): Likewise.
(cc_arithopn): Likewise.
(small_int): Likewise.
(uns_small_int): Likewise.
(clobbered_register): Likewise.
(legitimize_pic_address): Likewise.
(delay_operand): Likewise.
(sparc_builtin_saveregs): Remove unused variable `stdarg'.
* sparc.h (order_regs_for_local_alloc, eligible_for_return_delay,
sparc_issue_rate, v8plus_regcmp_p): Add prototypes.
* sparc.md (cmpdi_v8plus): Add abort for default case in switch.
* cppalloc.c: Include gansidecl.h.
* cpperror.c: Include stdarg.h/varargs.h and gansidecl.h.
(cpp_file_line_for_message): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
(v_cpp_message): New function.
(cpp_message): Use it. Also convert to variable arguments.
(cpp_fatal): Likewise.
(cpp_pfatal_with_name): Constify parameter `name'.
* cppexp.c: Move gansidecl.h before cpplib.h.
* cpphash.c: Likewise.
* cpphash.h (hashf, delete_macro): Add prototypes.
* cpplib.c: Include stdarg.h/varargs.h and move gansidecl.h before
cpplib.h. Don't include errno.h.
(update_path): Add arguments to prototype.
(cpp_fatal, cpp_file_line_for_message, cpp_message, delete_macro,
cpp_print_containing_files): Remove redundant prototypes.
(cpp_hash_cleanup, add_import, append_include_chain,
make_assertion, path_include, initialize_builtins,
initialize_char_syntax, finclude, validate_else, comp_def_part,
lookup_import, redundant_include_p, is_system_include,
read_name_map, read_filename_string, open_include_file,
check_macro_name, compare_defs, compare_token_lists,
eval_if_expression, change_newlines): Add prototype arguments.
(hashf): Remove redundant prototype.
(read_token_list, free_token_list, safe_read, xcalloc, savestring,
conditional_skip, skip_if_group): Add prototype arguments.
(fdopen): Remove redundant prototype.
(do_define, do_line, do_include, do_undef, do_error, do_pragma,
do_ident, do_if, do_xifdef, do_else, do_elif, do_endif, do_sccs,
do_once, do_assert, do_unassert, do_warning): Add prototype arguments.
(struct directive): Add prototype arguments to function pointer
member `func'.
(handle_directive): Add missing arguments to call to `do_line'.
(do_include): Mark parameters `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_line): Likewise for `keyword' and new parameters `unused1' and
`unused2'.
(do_error): Likewise for `keyword'.
(do_warning): Likewise. Also add missing argument `pfile' in call
to cpp_pedwarn.
(do_once): Mark parameter `keyword', `unused1' and `unused2' with
ATTRIBUTE_UNUSED.
(do_ident): Likewise for `keyword', `buf' and `limit'.
(do_pragma): Likewise. Also add missing arguments in call to do_once.
(do_sccs): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_if): Likewise for `keyword'.
(do_elif): Likewise.
(eval_if_expression): Likewise for `buf' and `length'.
(do_xifdef): Likewise for `unused1' and `unused2'.
(do_else): Likewise for `keyword', `buf' and `limit'.
(do_endif): Likewise.
(parse_name): Add missing argument `pfile' in call to cpp_pedwarn.
(cpp_handle_options): Remove superfluous NULL argument in call to
cpp_fatal.
(cpp_handle_options): Likewise.
(do_assert): Mark parameter `keyword', `buf' and `limit' with
ATTRIBUTE_UNUSED.
(do_unassert): Likewise.
(cpp_print_file_and_line): Add missing argument `pfile' in call to
cpp_file_line_for_message.
(v_cpp_error): New function.
(cpp_error): Use it. Also accept variable arguments.
(v_cpp_warning): New function.
(cpp_warning): Use it. Also accept variable arguments.
(cpp_pedwarn): Accept variable arguments.
(v_cpp_error_with_line): New function
(cpp_error_with_line): Use it. Accept variable arguments.
(v_cpp_warning_with_line): New function.
(cpp_warning_with_line): Use it. Accept variable arguments. Hide
definition.
(cpp_pedwarn_with_line): Accept variable arguments.
(cpp_pedwarn_with_file_and_line): Likewise.
(cpp_error_from_errno): Constify parameter `name'. Add missing
argument `pfile' in call to cpp_file_line_for_message.
(cpp_perror_with_name): Constify parameter `name'.
* cpplib.h: Define PARAMS() in terms of PROTO().
(fatal): Remove redundant prototype.
(cpp_error, cpp_warning, cpp_pedwarn, cpp_error_with_line,
cpp_pedwarn_with_line, cpp_pedwarn_with_file_and_line,
cpp_error_from_errno, cpp_perror_with_name, cpp_pfatal_with_name,
cpp_fatal, cpp_message, cpp_pfatal_with_name,
cpp_file_line_for_message, cpp_print_containing_files): Add
arguments to prototypes.
(scan_decls, cpp_finish): Add prototypes.
* cppmain.c: Include gansidecl.h.
(main): Remove unused variable `i'.
* dbxout.c: Include toplev.h.
* demangle.h (do_tlink, collect_execute, collect_exit,
collect_wait, dump_file, file_exists): Add prototype.
* dwarf2out.c (dwarf_type_encoding_name, decl_start_label): Hide
prototype and definition.
(gen_unspecified_parameters_die): Don't assign results of call to
function new_die() to unused variable `parm_die'.
(dwarf2out_line): Mark parameter `filename' with ATTRIBUTE_UNUSED.
(dwarf2out_define): Likewise for `lineno' and `buffer'.
* dwarfout.c (output_unsigned_leb128, output_signed_leb128): Hide
prototype and definition.
(output_die): Add prototype arguments to function pointer arg.
(output_unspecified_parameters_die): Mark parameter `arg' with
ATTRIBUTE_UNUSED.
* except.c (output_exception_table_entry): Remove unused variable
`eh_entry'.
* except.h (expand_fixup_region_start, expand_fixup_region_end):
Add prototypes.
* expr.c (do_jump_by_parts_equality_rtx): Remove prototype.
* expr.h (do_jump_by_parts_equality_rtx): Add prototype.
* fix-header.c: Include stdarg.h/varargs.h, move gansidecl.h
before cpplib.h, include cpphash.h, remove redundant prototype of
cpp_fatal, don't define `const', add a prototype for `fatal'.
(cpp_file_line_for_message): Add missing arguments `pfile'.
(v_cpp_message): New function.
(cpp_message): Use it.
(v_fatal): New function.
(fatal, cpp_fatal): Use it.
(cpp_pfatal_with_name): Constify parameter `name'.
* flow.c (free_regset_vector): Remove redundant prototype.
* function.c (round_down): Wrap prototype and definition with
macro ARGS_GROW_DOWNWARD.
(record_insns): Wrap prototype and definition with
defined (HAVE_prologue) || defined (HAVE_epilogue).
* gansidecl.h (ATTRIBUTE_PRINTF_4, ATTRIBUTE_PRINTF_5): New macros.
* gen-protos.c: Include gansidecl.h.
(hashf): Don't make it static, constify parameter `name'.
* genattrtab.c (check_attr_test): Change XEXP() to XSTR() to match
specifier %s in calls to function `fatal'.
* haifa-sched.c: Include toplev.h.
(find_rgns): Remove unused variable `j'.
* integrate.c (note_modified_parmregs): Mark parameter `x' with
ATTRIBUTE_UNUSED.
(mark_stores): Likewise.
* jump.c (mark_modified_reg): Likewise.
* output.h (insn_current_reference_address): Add prototype.
(eh_frame_section): Likewise.
* print-rtl.c: Include bitmap.h.
* reload1.c (reload): Wrap variables `note' and `next' in macro
PRESERVE_DEATH_INFO_REGNO_P.
(forget_old_reloads_1): Mark parameter `ignored' with
ATTRIBUTE_UNUSED.
(choose_reload_regs): Remove unused variable `in'.
(reload_cse_invalidate_mem): Mark parameter `ignore' with
ATTRIBUTE_UNUSED.
(reload_cse_check_clobber): Likewise.
* rtl.h (expand_null_return, reg_classes_intersect_p): Add prototype.
(mark_elimination): Fix typo in prototype.
* scan-decls.c: Include gansidecl.h.
* tree.h (using_eh_for_cleanups, supports_one_only): Add prototype.
From-SVN: r19867
1998-05-19 10:42:48 +02:00
|
|
|
|
}
|