1995-03-16 22:59:07 +01:00
|
|
|
/* Default error handlers for CPP Library.
|
2002-01-03 22:43:09 +01:00
|
|
|
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
|
2004-01-22 01:15:25 +01:00
|
|
|
2001, 2002, 2004 Free Software Foundation, Inc.
|
1995-03-16 22:59:07 +01:00
|
|
|
Written by Per Bothner, 1994.
|
1998-05-06 23:09:07 +02:00
|
|
|
Based on CCCP program by Paul Rubin, June 1986
|
1995-03-16 22:59:07 +01:00
|
|
|
Adapted to ANSI C, Richard Stallman, Jan 1987
|
|
|
|
|
|
|
|
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
|
2005-06-29 04:34:39 +02:00
|
|
|
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1995-03-16 22:59:07 +01:00
|
|
|
|
|
|
|
In other words, you are welcome to use, share and improve this program.
|
|
|
|
You are forbidden to forbid anyone else to use, share and improve
|
|
|
|
what you give them. Help stamp out software-hoarding! */
|
|
|
|
|
1995-05-17 00:02:38 +02:00
|
|
|
#include "config.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"
|
1995-05-20 12:51:33 +02:00
|
|
|
#include "cpplib.h"
|
2004-05-24 12:50:45 +02:00
|
|
|
#include "internal.h"
|
1995-05-20 12:51:33 +02:00
|
|
|
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
static void print_location (cpp_reader *, source_location, unsigned int);
|
2001-04-23 00:33:45 +02:00
|
|
|
|
2002-01-03 22:43:09 +01:00
|
|
|
/* Print the logical file location (LINE, COL) in preparation for a
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
diagnostic. Outputs the #include chain if it has changed. A line
|
|
|
|
of zero suppresses the include stack, and outputs the program name
|
|
|
|
instead. */
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
static void
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
print_location (cpp_reader *pfile, source_location line, unsigned int col)
|
1995-03-16 22:59:07 +01:00
|
|
|
{
|
2003-08-28 02:21:34 +02:00
|
|
|
if (line == 0)
|
2000-12-11 08:45:16 +01:00
|
|
|
fprintf (stderr, "%s: ", progname);
|
2000-11-17 20:21:15 +01:00
|
|
|
else
|
2000-12-11 08:45:16 +01:00
|
|
|
{
|
2001-08-18 00:23:49 +02:00
|
|
|
const struct line_map *map;
|
2003-08-27 00:53:22 +02:00
|
|
|
unsigned int lin;
|
2000-12-11 08:45:16 +01:00
|
|
|
|
2004-01-20 06:30:18 +01:00
|
|
|
map = linemap_lookup (pfile->line_table, line);
|
|
|
|
linemap_print_containing_files (pfile->line_table, map);
|
2000-12-11 08:45:16 +01:00
|
|
|
|
2003-08-27 00:53:22 +02:00
|
|
|
lin = SOURCE_LINE (map, line);
|
2001-08-18 00:23:49 +02:00
|
|
|
if (col == 0)
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
{
|
|
|
|
col = SOURCE_COLUMN (map, line);
|
|
|
|
if (col == 0)
|
|
|
|
col = 1;
|
|
|
|
}
|
2000-12-11 08:45:16 +01:00
|
|
|
|
2003-08-27 00:53:22 +02:00
|
|
|
if (lin == 0)
|
2001-08-18 00:23:49 +02:00
|
|
|
fprintf (stderr, "%s:", map->to_file);
|
2000-12-11 08:45:16 +01:00
|
|
|
else if (CPP_OPTION (pfile, show_column) == 0)
|
2003-08-27 00:53:22 +02:00
|
|
|
fprintf (stderr, "%s:%u:", map->to_file, lin);
|
2000-12-11 08:45:16 +01:00
|
|
|
else
|
2003-08-27 00:53:22 +02:00
|
|
|
fprintf (stderr, "%s:%u:%u:", map->to_file, lin, col);
|
2000-12-11 08:45:16 +01:00
|
|
|
|
2001-08-03 01:03:31 +02:00
|
|
|
fputc (' ', stderr);
|
2000-12-11 08:45:16 +01:00
|
|
|
}
|
1995-03-16 22:59:07 +01:00
|
|
|
}
|
|
|
|
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
/* Set up for a diagnostic: print the file and line, bump the error
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
counter, etc. SRC_LOC is the logical line number; zero means to print
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
at the location of the previously lexed token, which tends to be
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
the correct place by default. The column number can be specified either
|
|
|
|
using COLUMN or (if COLUMN==0) extracting SOURCE_COLUMN from SRC_LOC.
|
|
|
|
(This may seem redundant, but is useful when pre-scanning (cleaning) a line,
|
|
|
|
when we haven't yet verified whether the current line_map has a
|
|
|
|
big enough max_column_hint.)
|
|
|
|
|
|
|
|
Returns 0 if the error has been suppressed. */
|
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and
v_message macro. All callers updated.
(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
checks here.
* cppfiles.c (cpp_syshdr_flags): New function.
(read_include_file): Don't call cpp_output_tokens. Call
enter_file hook.
* cppinit.c (dump_macros_helper): Moved to cppmain.c.
(cpp_reader_init): Don't initialize token_buffer. Call
_cpp_init_internal_pragmas.
(cpp_cleanup): Don't clear token_buffer.
(cpp_start_read): Don't worry about output from -D processing.
Don't call cpp_output_tokens.
(cpp_finish): Don't dump macros here. Don't call
cpp_output_tokens.
* cppmacro.c (_cpp_dump_definition): Rename
cpp_dump_definition. Write directly to a FILE *.
(dump_funlike_macro): Delete.
(dump_macro_args): New.
* cpplex.c (TOKEN_LEN): Convert to inline function.
(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
cpp_scan_line, _cpp_dump_list): Delete.
(cpp_printf, cpp_output_list): New.
(output_line_command): Don't worry about entering or leaving files.
(cpp_scan_buffer): Just output each token as we hit it.
(process_directive): Don't call cpp_output_tokens.
(_cpp_glue_header_name): Don't use token_buffer.
(output_token, dump_param_spelling): Write directly to a FILE *.
* cpplib.c (pass_thru_directive, dump_macro_name,
pragma_dispatch, do_pragma_gcc): Delete.
(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
functions.
(do_error, do_warning, pragma_dependency): Call
_cpp_begin_message, then cpp_output_list.
(cpp_register_pragma, cpp_register_pragma_space,
_cpp_init_internal_pragmas): New.
(do_pragma): Walk the pragmas table here.
(do_pragma_once, do_pragma_poison, do_pragma_system_header,
do_pragma_dependency): Return void.
(do_pragma_implementation): Moved to cppmain.c.
* cpplib.h: Update prototypes.
(struct cpp_reader): Remove printer, token_buffer,
token_buffer_size, and limit. Add struct cb, and pragmas.
(struct cpp_printer): Remove last_id and written.
(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
CPP_ADJUST_WRITTEN): Delete.
* cpphash.h: Update prototypes.
(ufputs): New wrapper.
* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
(main): Set up callbacks. Register #pragma implementation.
Dump macros from here.
From-SVN: r35415
2000-08-02 03:13:45 +02:00
|
|
|
int
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
_cpp_begin_message (cpp_reader *pfile, int code,
|
|
|
|
source_location src_loc, unsigned int column)
|
1995-03-16 22:59:07 +01:00
|
|
|
{
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
int level = CPP_DL_EXTRACT (code);
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
switch (level)
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
{
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
case CPP_DL_WARNING:
|
|
|
|
case CPP_DL_PEDWARN:
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
if (cpp_in_system_header (pfile)
|
2000-09-28 07:55:22 +02:00
|
|
|
&& ! CPP_OPTION (pfile, warn_system_headers))
|
|
|
|
return 0;
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
/* Fall through. */
|
|
|
|
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
case CPP_DL_WARNING_SYSHDR:
|
2001-01-23 20:20:14 +01:00
|
|
|
if (CPP_OPTION (pfile, warnings_are_errors)
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
|| (level == CPP_DL_PEDWARN && CPP_OPTION (pfile, pedantic_errors)))
|
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and
v_message macro. All callers updated.
(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
checks here.
* cppfiles.c (cpp_syshdr_flags): New function.
(read_include_file): Don't call cpp_output_tokens. Call
enter_file hook.
* cppinit.c (dump_macros_helper): Moved to cppmain.c.
(cpp_reader_init): Don't initialize token_buffer. Call
_cpp_init_internal_pragmas.
(cpp_cleanup): Don't clear token_buffer.
(cpp_start_read): Don't worry about output from -D processing.
Don't call cpp_output_tokens.
(cpp_finish): Don't dump macros here. Don't call
cpp_output_tokens.
* cppmacro.c (_cpp_dump_definition): Rename
cpp_dump_definition. Write directly to a FILE *.
(dump_funlike_macro): Delete.
(dump_macro_args): New.
* cpplex.c (TOKEN_LEN): Convert to inline function.
(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
cpp_scan_line, _cpp_dump_list): Delete.
(cpp_printf, cpp_output_list): New.
(output_line_command): Don't worry about entering or leaving files.
(cpp_scan_buffer): Just output each token as we hit it.
(process_directive): Don't call cpp_output_tokens.
(_cpp_glue_header_name): Don't use token_buffer.
(output_token, dump_param_spelling): Write directly to a FILE *.
* cpplib.c (pass_thru_directive, dump_macro_name,
pragma_dispatch, do_pragma_gcc): Delete.
(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
functions.
(do_error, do_warning, pragma_dependency): Call
_cpp_begin_message, then cpp_output_list.
(cpp_register_pragma, cpp_register_pragma_space,
_cpp_init_internal_pragmas): New.
(do_pragma): Walk the pragmas table here.
(do_pragma_once, do_pragma_poison, do_pragma_system_header,
do_pragma_dependency): Return void.
(do_pragma_implementation): Moved to cppmain.c.
* cpplib.h: Update prototypes.
(struct cpp_reader): Remove printer, token_buffer,
token_buffer_size, and limit. Add struct cb, and pragmas.
(struct cpp_printer): Remove last_id and written.
(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
CPP_ADJUST_WRITTEN): Delete.
* cpphash.h: Update prototypes.
(ufputs): New wrapper.
* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
(main): Set up callbacks. Register #pragma implementation.
Dump macros from here.
From-SVN: r35415
2000-08-02 03:13:45 +02:00
|
|
|
{
|
|
|
|
if (CPP_OPTION (pfile, inhibit_errors))
|
|
|
|
return 0;
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
level = CPP_DL_ERROR;
|
2002-05-23 08:07:45 +02:00
|
|
|
pfile->errors++;
|
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and
v_message macro. All callers updated.
(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
checks here.
* cppfiles.c (cpp_syshdr_flags): New function.
(read_include_file): Don't call cpp_output_tokens. Call
enter_file hook.
* cppinit.c (dump_macros_helper): Moved to cppmain.c.
(cpp_reader_init): Don't initialize token_buffer. Call
_cpp_init_internal_pragmas.
(cpp_cleanup): Don't clear token_buffer.
(cpp_start_read): Don't worry about output from -D processing.
Don't call cpp_output_tokens.
(cpp_finish): Don't dump macros here. Don't call
cpp_output_tokens.
* cppmacro.c (_cpp_dump_definition): Rename
cpp_dump_definition. Write directly to a FILE *.
(dump_funlike_macro): Delete.
(dump_macro_args): New.
* cpplex.c (TOKEN_LEN): Convert to inline function.
(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
cpp_scan_line, _cpp_dump_list): Delete.
(cpp_printf, cpp_output_list): New.
(output_line_command): Don't worry about entering or leaving files.
(cpp_scan_buffer): Just output each token as we hit it.
(process_directive): Don't call cpp_output_tokens.
(_cpp_glue_header_name): Don't use token_buffer.
(output_token, dump_param_spelling): Write directly to a FILE *.
* cpplib.c (pass_thru_directive, dump_macro_name,
pragma_dispatch, do_pragma_gcc): Delete.
(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
functions.
(do_error, do_warning, pragma_dependency): Call
_cpp_begin_message, then cpp_output_list.
(cpp_register_pragma, cpp_register_pragma_space,
_cpp_init_internal_pragmas): New.
(do_pragma): Walk the pragmas table here.
(do_pragma_once, do_pragma_poison, do_pragma_system_header,
do_pragma_dependency): Return void.
(do_pragma_implementation): Moved to cppmain.c.
* cpplib.h: Update prototypes.
(struct cpp_reader): Remove printer, token_buffer,
token_buffer_size, and limit. Add struct cb, and pragmas.
(struct cpp_printer): Remove last_id and written.
(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
CPP_ADJUST_WRITTEN): Delete.
* cpphash.h: Update prototypes.
(ufputs): New wrapper.
* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
(main): Set up callbacks. Register #pragma implementation.
Dump macros from here.
From-SVN: r35415
2000-08-02 03:13:45 +02:00
|
|
|
}
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
else if (CPP_OPTION (pfile, inhibit_warnings))
|
|
|
|
return 0;
|
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and
v_message macro. All callers updated.
(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
checks here.
* cppfiles.c (cpp_syshdr_flags): New function.
(read_include_file): Don't call cpp_output_tokens. Call
enter_file hook.
* cppinit.c (dump_macros_helper): Moved to cppmain.c.
(cpp_reader_init): Don't initialize token_buffer. Call
_cpp_init_internal_pragmas.
(cpp_cleanup): Don't clear token_buffer.
(cpp_start_read): Don't worry about output from -D processing.
Don't call cpp_output_tokens.
(cpp_finish): Don't dump macros here. Don't call
cpp_output_tokens.
* cppmacro.c (_cpp_dump_definition): Rename
cpp_dump_definition. Write directly to a FILE *.
(dump_funlike_macro): Delete.
(dump_macro_args): New.
* cpplex.c (TOKEN_LEN): Convert to inline function.
(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
cpp_scan_line, _cpp_dump_list): Delete.
(cpp_printf, cpp_output_list): New.
(output_line_command): Don't worry about entering or leaving files.
(cpp_scan_buffer): Just output each token as we hit it.
(process_directive): Don't call cpp_output_tokens.
(_cpp_glue_header_name): Don't use token_buffer.
(output_token, dump_param_spelling): Write directly to a FILE *.
* cpplib.c (pass_thru_directive, dump_macro_name,
pragma_dispatch, do_pragma_gcc): Delete.
(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
functions.
(do_error, do_warning, pragma_dependency): Call
_cpp_begin_message, then cpp_output_list.
(cpp_register_pragma, cpp_register_pragma_space,
_cpp_init_internal_pragmas): New.
(do_pragma): Walk the pragmas table here.
(do_pragma_once, do_pragma_poison, do_pragma_system_header,
do_pragma_dependency): Return void.
(do_pragma_implementation): Moved to cppmain.c.
* cpplib.h: Update prototypes.
(struct cpp_reader): Remove printer, token_buffer,
token_buffer_size, and limit. Add struct cb, and pragmas.
(struct cpp_printer): Remove last_id and written.
(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
CPP_ADJUST_WRITTEN): Delete.
* cpphash.h: Update prototypes.
(ufputs): New wrapper.
* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
(main): Set up callbacks. Register #pragma implementation.
Dump macros from here.
From-SVN: r35415
2000-08-02 03:13:45 +02:00
|
|
|
break;
|
2002-05-23 00:02:16 +02:00
|
|
|
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
case CPP_DL_ERROR:
|
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and
v_message macro. All callers updated.
(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
checks here.
* cppfiles.c (cpp_syshdr_flags): New function.
(read_include_file): Don't call cpp_output_tokens. Call
enter_file hook.
* cppinit.c (dump_macros_helper): Moved to cppmain.c.
(cpp_reader_init): Don't initialize token_buffer. Call
_cpp_init_internal_pragmas.
(cpp_cleanup): Don't clear token_buffer.
(cpp_start_read): Don't worry about output from -D processing.
Don't call cpp_output_tokens.
(cpp_finish): Don't dump macros here. Don't call
cpp_output_tokens.
* cppmacro.c (_cpp_dump_definition): Rename
cpp_dump_definition. Write directly to a FILE *.
(dump_funlike_macro): Delete.
(dump_macro_args): New.
* cpplex.c (TOKEN_LEN): Convert to inline function.
(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
cpp_scan_line, _cpp_dump_list): Delete.
(cpp_printf, cpp_output_list): New.
(output_line_command): Don't worry about entering or leaving files.
(cpp_scan_buffer): Just output each token as we hit it.
(process_directive): Don't call cpp_output_tokens.
(_cpp_glue_header_name): Don't use token_buffer.
(output_token, dump_param_spelling): Write directly to a FILE *.
* cpplib.c (pass_thru_directive, dump_macro_name,
pragma_dispatch, do_pragma_gcc): Delete.
(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
functions.
(do_error, do_warning, pragma_dependency): Call
_cpp_begin_message, then cpp_output_list.
(cpp_register_pragma, cpp_register_pragma_space,
_cpp_init_internal_pragmas): New.
(do_pragma): Walk the pragmas table here.
(do_pragma_once, do_pragma_poison, do_pragma_system_header,
do_pragma_dependency): Return void.
(do_pragma_implementation): Moved to cppmain.c.
* cpplib.h: Update prototypes.
(struct cpp_reader): Remove printer, token_buffer,
token_buffer_size, and limit. Add struct cb, and pragmas.
(struct cpp_printer): Remove last_id and written.
(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
CPP_ADJUST_WRITTEN): Delete.
* cpphash.h: Update prototypes.
(ufputs): New wrapper.
* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
(main): Set up callbacks. Register #pragma implementation.
Dump macros from here.
From-SVN: r35415
2000-08-02 03:13:45 +02:00
|
|
|
if (CPP_OPTION (pfile, inhibit_errors))
|
|
|
|
return 0;
|
2002-05-23 08:07:45 +02:00
|
|
|
/* ICEs cannot be inhibited. */
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
case CPP_DL_ICE:
|
2002-05-23 08:07:45 +02:00
|
|
|
pfile->errors++;
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
break;
|
1999-01-27 02:43:17 +01:00
|
|
|
}
|
|
|
|
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
print_location (pfile, src_loc, column);
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
if (CPP_DL_WARNING_P (level))
|
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and
v_message macro. All callers updated.
(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
checks here.
* cppfiles.c (cpp_syshdr_flags): New function.
(read_include_file): Don't call cpp_output_tokens. Call
enter_file hook.
* cppinit.c (dump_macros_helper): Moved to cppmain.c.
(cpp_reader_init): Don't initialize token_buffer. Call
_cpp_init_internal_pragmas.
(cpp_cleanup): Don't clear token_buffer.
(cpp_start_read): Don't worry about output from -D processing.
Don't call cpp_output_tokens.
(cpp_finish): Don't dump macros here. Don't call
cpp_output_tokens.
* cppmacro.c (_cpp_dump_definition): Rename
cpp_dump_definition. Write directly to a FILE *.
(dump_funlike_macro): Delete.
(dump_macro_args): New.
* cpplex.c (TOKEN_LEN): Convert to inline function.
(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
cpp_scan_line, _cpp_dump_list): Delete.
(cpp_printf, cpp_output_list): New.
(output_line_command): Don't worry about entering or leaving files.
(cpp_scan_buffer): Just output each token as we hit it.
(process_directive): Don't call cpp_output_tokens.
(_cpp_glue_header_name): Don't use token_buffer.
(output_token, dump_param_spelling): Write directly to a FILE *.
* cpplib.c (pass_thru_directive, dump_macro_name,
pragma_dispatch, do_pragma_gcc): Delete.
(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
functions.
(do_error, do_warning, pragma_dependency): Call
_cpp_begin_message, then cpp_output_list.
(cpp_register_pragma, cpp_register_pragma_space,
_cpp_init_internal_pragmas): New.
(do_pragma): Walk the pragmas table here.
(do_pragma_once, do_pragma_poison, do_pragma_system_header,
do_pragma_dependency): Return void.
(do_pragma_implementation): Moved to cppmain.c.
* cpplib.h: Update prototypes.
(struct cpp_reader): Remove printer, token_buffer,
token_buffer_size, and limit. Add struct cb, and pragmas.
(struct cpp_printer): Remove last_id and written.
(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
CPP_ADJUST_WRITTEN): Delete.
* cpphash.h: Update prototypes.
(ufputs): New wrapper.
* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
(main): Set up callbacks. Register #pragma implementation.
Dump macros from here.
From-SVN: r35415
2000-08-02 03:13:45 +02:00
|
|
|
fputs (_("warning: "), stderr);
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
From-SVN: r73183
2003-11-01 23:56:54 +01:00
|
|
|
else if (level == CPP_DL_ICE)
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
fputs (_("internal error: "), stderr);
|
2004-10-14 02:56:22 +02:00
|
|
|
else
|
|
|
|
fputs (_("error: "), stderr);
|
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and
v_message macro. All callers updated.
(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
checks here.
* cppfiles.c (cpp_syshdr_flags): New function.
(read_include_file): Don't call cpp_output_tokens. Call
enter_file hook.
* cppinit.c (dump_macros_helper): Moved to cppmain.c.
(cpp_reader_init): Don't initialize token_buffer. Call
_cpp_init_internal_pragmas.
(cpp_cleanup): Don't clear token_buffer.
(cpp_start_read): Don't worry about output from -D processing.
Don't call cpp_output_tokens.
(cpp_finish): Don't dump macros here. Don't call
cpp_output_tokens.
* cppmacro.c (_cpp_dump_definition): Rename
cpp_dump_definition. Write directly to a FILE *.
(dump_funlike_macro): Delete.
(dump_macro_args): New.
* cpplex.c (TOKEN_LEN): Convert to inline function.
(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
cpp_scan_line, _cpp_dump_list): Delete.
(cpp_printf, cpp_output_list): New.
(output_line_command): Don't worry about entering or leaving files.
(cpp_scan_buffer): Just output each token as we hit it.
(process_directive): Don't call cpp_output_tokens.
(_cpp_glue_header_name): Don't use token_buffer.
(output_token, dump_param_spelling): Write directly to a FILE *.
* cpplib.c (pass_thru_directive, dump_macro_name,
pragma_dispatch, do_pragma_gcc): Delete.
(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
functions.
(do_error, do_warning, pragma_dependency): Call
_cpp_begin_message, then cpp_output_list.
(cpp_register_pragma, cpp_register_pragma_space,
_cpp_init_internal_pragmas): New.
(do_pragma): Walk the pragmas table here.
(do_pragma_once, do_pragma_poison, do_pragma_system_header,
do_pragma_dependency): Return void.
(do_pragma_implementation): Moved to cppmain.c.
* cpplib.h: Update prototypes.
(struct cpp_reader): Remove printer, token_buffer,
token_buffer_size, and limit. Add struct cb, and pragmas.
(struct cpp_printer): Remove last_id and written.
(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
CPP_ADJUST_WRITTEN): Delete.
* cpphash.h: Update prototypes.
(ufputs): New wrapper.
* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
(main): Set up callbacks. Register #pragma implementation.
Dump macros from here.
From-SVN: r35415
2000-08-02 03:13:45 +02:00
|
|
|
|
|
|
|
return 1;
|
1995-03-16 22:59:07 +01:00
|
|
|
}
|
|
|
|
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
/* Don't remove the blank before do, as otherwise the exgettext
|
|
|
|
script will mistake this as a function definition */
|
|
|
|
#define v_message(msgid, ap) \
|
|
|
|
do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0)
|
2001-08-18 22:46:45 +02:00
|
|
|
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
/* Exported interface. */
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
|
2002-01-03 22:43:09 +01:00
|
|
|
/* Print an error at the location of the previously lexed token. */
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
void
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
{
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
source_location src_loc;
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start (ap, msgid);
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
|
2005-11-04 00:08:18 +01:00
|
|
|
if (CPP_OPTION (pfile, client_diagnostic))
|
2005-11-04 02:16:32 +01:00
|
|
|
pfile->cb.error (pfile, level, _(msgid), &ap);
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
else
|
2003-08-28 02:21:34 +02:00
|
|
|
{
|
2005-11-04 00:08:18 +01:00
|
|
|
if (CPP_OPTION (pfile, traditional))
|
|
|
|
{
|
|
|
|
if (pfile->state.in_directive)
|
|
|
|
src_loc = pfile->directive_line;
|
|
|
|
else
|
|
|
|
src_loc = pfile->line_table->highest_line;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
src_loc = pfile->cur_token[-1].src_loc;
|
|
|
|
}
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
|
2005-11-04 00:08:18 +01:00
|
|
|
if (_cpp_begin_message (pfile, level, src_loc, 0))
|
|
|
|
v_message (msgid, ap);
|
|
|
|
}
|
2001-08-18 22:46:45 +02:00
|
|
|
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
va_end (ap);
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
}
|
|
|
|
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
/* Print an error at a specific location. */
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
void
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
cpp_error_with_line (cpp_reader *pfile, int level,
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
source_location src_loc, unsigned int column,
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
const char *msgid, ...)
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
{
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start (ap, msgid);
|
1999-01-27 02:43:17 +01:00
|
|
|
|
Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
line-maps.c rather than by clients.
* line-map.h (struct line_map): New field column_bits.
<from_line>: Rename field to start_location.
(struct line_maps): New fields highest_location and max_column_hint.
(linemap_check_files_exited): New declaration.
(linemap_line_start): New declaration.
(linemap_add): Remove from_line parameter; use highest_location field.
(SOURCE_LINE, LAST_SOURCE_LINE): Modify to use column_bits.
(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION): New macros.
(CURRENT_LINE_MAP): Remove macro.
(linemap_position_for_column): New inline function.
* line-map.c (linemap_init): Clear new fields.
(linemap_check_files_exited): New function, extracted from ...
(linemap_free): Use linemap_check_files_exited.
(linemap_add): Remove from_line parameter. Various updates.
(linemap_line_start): New function.
(linemap_lookeup): Update for new field names.
* cpphash.h (struct cpp_reader) <map>: Field removed. Because
linemap_position_for_column may unpredictably change the current map,
it is cleaner and simpler for us to not cache it in cpp_reader.
(struct cpp_buffer): New sysp field.
Changed warned_cplusplus_comments and from_stage3 to bitfields.
* cppinit.c (cpp_read_min_file): pfile->map no longer exists.
* cpplib.c (do_line, do_linemarker, _cpp_do_file_change): Get
current map using linemap_lookup.
(do_linemarker): Also set buffer's sysp field.
(destringize_and_run): No longer need to decrement current line.
* cppfiles.c (_cpp_stack_file): Set sysp from and in buffer.
(search_path_head, open_file_failed): Use buffer's sysp.
(cpp_make_system_header): Get current map using linemap_lookup.
Also set buffer's sysp flag.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use linemap_lookup.
* cpphash.h (CPP_INCREMENT_LINE): New macro.
(struct cpp_buffer): Moved fields saved_cur, saved_rlimit to ...
(struct cpp_reader): ... and adding saved_line_base field.
* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
Update accordingly. Don't adjust line.
(_cpp_scan_out_logical_line): Use CPP_INCREMENT_LINE.
* cpphash.c (CPP_IN_SYSTEM_HEADER): Replaced macro by ...
(cpp_in_system_header): ... new inline function, using buffer's sysp.
* cpperror.c (_cpp_begin_message): Update to use cpp_in_system_header.
* cpplex.c (_cpp_lex_direct): Likewise.
* cppmacro.c (_cpp_builtin_macro_text): Likewise.
* cppmacro.c (_cpp_create_definition): Use buffer's sysp field.
* cpplib.h (struct cpp_token): Rename line field to src_loc.
Remove col field as it is now subsumed by src_loc.
* cpperror.c: Update various field, parameter, and macro names.
(print_location): If col==0, try SOURCE_COLUMN of line.
(cpp_error): Use cur_token's src_loc field, rather than line+col.
* cpplib.c (do_diagnostic): Token's src_loc fields replaces line+col.
* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
_cpp_skip_block_comment): Use CPP_INCREMENT_LINE.
(_cpp_temp_token): Replace cpp_token's line+col fields by src_loc.
(_cpp_get_fresh_line): Don't need to adjust line for missing newline.
(_cpp_lex_direct): Use linemap_position_for_column.
* c-ppoutput.c (maybe_print_line, print_line): Don't take map
parameter. Instead get it from the line_table global. Adjust callers.
(print): Remove map field. Replace line field to src_line.
(init_pp_output, account_for_newlines, maybe_print_line): Adjust.
(cb_line_change): Use SOURCE_COLUMN. Minor optimizations.
(pp_file_change): Use MAIN_FILE_P since we cannot checked print.map.
Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
* cpptrad.c (copy_comment): Rename variable.
* c-lex.c (map): Remove static variable, for same reason we removed
cpp_reader's map field.
(cb_line_change, cb_def_pragma, cb_define, cb_undef): Hence we need
to call linemap_lookup.
(cb_line_change): Token's line field replaced by src_loc.
(fe_file_change): Use MAINFILE_P and LAST_SOURCE_LINE macros.
Don't save new_map.
* cpphash.h, cpperror.c, cpplib.h: Some renames of fileline to
source_location.
From-SVN: r77663
2004-02-11 16:29:30 +01:00
|
|
|
if (_cpp_begin_message (pfile, level, src_loc, column))
|
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and
v_message macro. All callers updated.
(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
checks here.
* cppfiles.c (cpp_syshdr_flags): New function.
(read_include_file): Don't call cpp_output_tokens. Call
enter_file hook.
* cppinit.c (dump_macros_helper): Moved to cppmain.c.
(cpp_reader_init): Don't initialize token_buffer. Call
_cpp_init_internal_pragmas.
(cpp_cleanup): Don't clear token_buffer.
(cpp_start_read): Don't worry about output from -D processing.
Don't call cpp_output_tokens.
(cpp_finish): Don't dump macros here. Don't call
cpp_output_tokens.
* cppmacro.c (_cpp_dump_definition): Rename
cpp_dump_definition. Write directly to a FILE *.
(dump_funlike_macro): Delete.
(dump_macro_args): New.
* cpplex.c (TOKEN_LEN): Convert to inline function.
(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
cpp_scan_line, _cpp_dump_list): Delete.
(cpp_printf, cpp_output_list): New.
(output_line_command): Don't worry about entering or leaving files.
(cpp_scan_buffer): Just output each token as we hit it.
(process_directive): Don't call cpp_output_tokens.
(_cpp_glue_header_name): Don't use token_buffer.
(output_token, dump_param_spelling): Write directly to a FILE *.
* cpplib.c (pass_thru_directive, dump_macro_name,
pragma_dispatch, do_pragma_gcc): Delete.
(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
functions.
(do_error, do_warning, pragma_dependency): Call
_cpp_begin_message, then cpp_output_list.
(cpp_register_pragma, cpp_register_pragma_space,
_cpp_init_internal_pragmas): New.
(do_pragma): Walk the pragmas table here.
(do_pragma_once, do_pragma_poison, do_pragma_system_header,
do_pragma_dependency): Return void.
(do_pragma_implementation): Moved to cppmain.c.
* cpplib.h: Update prototypes.
(struct cpp_reader): Remove printer, token_buffer,
token_buffer_size, and limit. Add struct cb, and pragmas.
(struct cpp_printer): Remove last_id and written.
(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
CPP_ADJUST_WRITTEN): Delete.
* cpphash.h: Update prototypes.
(ufputs): New wrapper.
* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
(main): Set up callbacks. Register #pragma implementation.
Dump macros from here.
From-SVN: r35415
2000-08-02 03:13:45 +02:00
|
|
|
v_message (msgid, ap);
|
2001-08-18 22:46:45 +02:00
|
|
|
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
va_end (ap);
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
* cpplib.h, cpphash.h, cppcharset.c, cpperror.c, cppexp.c
* cppfiles.c, cpphash.c, cppinit.c, cpplex.c, cpplib.c
* cppmacro.c, cpppch.c, cpptrad.c, cppspec.c: Convert to
ISO C: new-style function declarations, no need for PARAMS,
no special punctuation on indirect function calls, use string
constant concatenation where convenient.
From-SVN: r68070
2003-06-17 08:17:44 +02:00
|
|
|
cpp_errno (cpp_reader *pfile, int level, const char *msgid)
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
{
|
cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
if line == 0.
(cpp_begin_message): Update to use DL_ macros.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppexp.c (CPP_ICE): Remove.
(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
lex, integer_overflow, _cpp_parse_expr): Update.
* cppfiles.c (read_include_file, find_include_file,
handle_missing_header, _cpp_read_file, remap_filename): Update.
* cpphash.h (enum error_type): Remove.
(_cpp_begin_message): Update.
* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
cpp_handle_option, cpp_post_options): Update.
* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
skip_whitespace, parse_identifier, parse_slow, parse_string,
_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
cpp_interpret_charconst): Update.
* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
lex_macro_node, do_undef, glue_header_name, parse_include,
do_include_common, read_flag, do_line, do_linemarker, do_ident,
cpp_register_pragma, do_pragma_once, do_pragma_system_header,
do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
do_elif, do_endif, parse_answer, parse_assertion, do_assert,
_cpp_pop_buffer, do_diagnostic): Update.
* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
cpp_notice, cpp_notice_from_errno): Remove.
(cpp_error, cpp_error_with_line): Update to take a diagnostic
level.
(cpp_errno): New.
* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
collect_args, enter_macro_context, save_parameter, parse_params,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Update.
* cppmain.c (cpp_preprocess_file): Update.
* fix-header.c (read_scan_file): Update.
From-SVN: r52302
2002-04-14 20:42:47 +02:00
|
|
|
if (msgid[0] == '\0')
|
|
|
|
msgid = _("stdout");
|
|
|
|
|
|
|
|
cpp_error (pfile, level, "%s: %s", msgid, xstrerror (errno));
|
cpplib.c (my_strerror, [...]): Move to cpperror.c.
* cpplib.c (my_strerror, cpp_error, cpp_error_with_line,
cpp_error_from_errno, cpp_warning, cpp_warning_with_line,
cpp_pedwarn, cpp_pedwarn_with_line,
cpp_pedwarn_with_file_and_line): Move to cpperror.c.
(cpp_print_file_and_line, v_cpp_error, v_cpp_warning,
v_cpp_error_with_line, v_cpp_warning_with_line,
cpp_message_from_errno, cpp_perror_with_name): Delete.
* cpperror.c (cpp_print_containing_files): Take starting
buffer as argument.
(cpp_file_line_for_message): Rename to cpp_print_file_and_line.
(v_cpp_message): Now called directly by all entry points.
Remove -1 case.
(cpp_pfatal_with_name, cpp_message): Delete.
(cpp_notice_from_errno, cpp_ice): New functions.
(cpp_notice): Is now for reporting error conditions, just
without an associated file.
(cpp_error, cpp_error_with_line): Don't do anything if
opts->inhibit_errors is on.
(cpp_pedwarn_with_file_and_line): Take column argument also.
* cpplib.h: Update prototypes of exported functions.
(struct cpp_options): Add inhibit_errors.
* cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for
non-error messages. Include intl.h.
* cppinit.c, cppmain.c: Likewise. Also, use
cpp_notice_from_errno instead of cpp_perror_with_name or
cpp_pfatal_with_name, and cpp_notice instead of cpp_message.
* cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to
report internal errors.
* cpplib.c (do_define): Switch bcopy to memcpy.
Give cpp_pedwarn_with_file_and_line a dummy column argument.
From-SVN: r31829
2000-02-07 00:46:18 +01:00
|
|
|
}
|