Integrated preprocessor.

top level:
	* Makefile.in: Remove all references to c-parse.gperf,
	c-gperf.h, and c-parse.h.  Remove -d from yacc command line
	generating c-parse.c.  Update dependencies.
	* c-parse.gperf, c-gperf.h: Delete.

	* c-common.c: Don't define parse_options, cpp_token, yy_cur,
	yy_lim, or yy_get_token.  Don't define get_directive_line if
	USE_CPPLIB.
	* c-common.h: Add multiple include guard.  Define RID values
	for every keyword in C, C++, and Objective C.  Put all the
	modifiers first.
	(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
	* c-decl.c (c_decode_option): Handle -lang-objc here.
	(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
	(grokdeclarator): Adjust for new RID scheme.
	(extract_interface_info): New stub.
	* c-lang.c: Don't declare yy_cur or parse_options.
	(lang_init_options): Call cpp_init.  Don't call
	cpp_options_init.
	(lang_init): Don't call check_newline if USE_CPPLIB.

	* c-lex.c: Don't include c-parse.h.  Do include timevar.h.
	Elide lots of unnecessary code if USE_CPPLIB.  Delete code
	rendered unnecessary by new architecture.  Move routines not
	shared with C++ to c-parse.in.  Maintain a local idea of the
	line number.    Handle C++ as well as C.
	[USE_CPPLIB]: Declare and register callbacks for #ident and
	for entering/leaving files.
	(init_c_lex, c_lex): Are now the entry points to this file.
	(check_newline): Break out directive handling to
	process_directive.
	(read_ucs, is_extended_char, utf8_extend_token): Moved here
	from C++ front end.
	(readescape, parse_float): Overhaul.
	(lex_number, lex_string, lex_charconst): Break out of c_lex
	(n'ee yylex).
	(get_fileinfo, update_header_times, dump_one_header,
	dump_time_statistics): New and/or moved here from C++.
	Support per-file data needed by C++ and per-header timing
	statistics (C++ only, at the moment).
	* c-lex.h: Update prototypes.  Add multiple include guard.
	* c-tree.h (struct lang_identifier): Add rid_code field.
	(C_IS_RESERVED_WORD, C_RID_CODE): New.

	* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
	reinit_parse_for_function and/or position_after_white_space.
	(save_filename, save_lineno): Look ahead before saving.
	(label -> identifier ':'): Save file and line before shifting ':'.
	(reservedwords): No need to call get_identifier.
	(init_parse, finish_parse, yyerror, yylex, yyprint,
	make_pointer_declarator): Are now here for C/ObjC.
	(rid_to_yy): Conversion table from RID constants to Yacc codes.

	* c-pragma.c: Rewrite parsing logic to fit with cpplib's
	#pragma registry.  Provide dummy implementation of that
	interface if !USE_CPPLIB.
	* c-pragma.h: Update to match.

	* flags.h: Add multiple include guard.
	(flag_detailed_statistics): Moved here from C++.
	* toplev.c: Define flag_detailed_statistics.

	* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
	#if USE_CPPLIB.
	* timevar.def (TV_CPP, TV_LEX): New.
	* timevar.h: Add multiple include guard.

	* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
	#if USE_CPPLIB.
	* objc/objc-act.c: Don't mention yy_cur or parse_options.
	Initialize cpplib properly.  Force lineno to 0 after first
	call to check_newline.  Don't handle -lang-objc here.
	Move forget_protocol_qualifiers and remember_protocol_qualifiers here.

cp:
	* Make-lang.in, Makefile.in: Remove all references to input.c,
	gxx.gperf, and hash.h.  Add ../c-lex.o to C_OBJS.
	* gxx.gperf, hash.h, input.c: Delete.
	* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
	initialized properly.

	* class.c (fixup_pending_inline): Take a tree, not a
	struct pending_inline *.  All callers changed.
	(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
	RID_PROTECTED entries in ridpointers[] array here.
	* decl.c (duplicate_decls): Do not refer to struct
	pending_inline.
	(record_builtin_type, init_decl_processing): Use RID_MAX not
	CP_RID_MAX.
	(grokdeclarator): Use C_IS_RESERVED_WORD.
	* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
	cpplib.
	(grok_x_components): Do not inspect pending_inlines chain.

	* cp-tree.h (struct lang_identifier): Add rid_code entry.
	(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
	(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
	(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
	TIME_IDENTIFIER_FILEINFO): Kill.
	Update prototypes.
	* lex.h: Expunge cp_rid.  Rewrite RIDBIT macros to use just a
	single 32-bit word.
	* parse.y: Call do_pending_inlines unconditionally.
	reinit_parse_for_method is now snarf_method.  fn.defpen is no
	longer necessary.  Remove unnecessary <itype> annotation on
	SCOPE.  Do not refer to end_of_file or struct pending_inline.
	* semantics.c (begin_inline_definitions): Call
	do_pending_inlines unconditionally.

	* lex.c: Remove all code now shared with C front end.
	Initialize cpplib properly if USE_CPPLIB.  Put reserved words
	into the get_identifier table.  Rewrite pragma handling to
	work with the registry.  Move code to save tokens for later
	processing to spew.c.

	* spew.c: Rewrite everything in terms of token streams instead
	of text.  Move routines here from lex.c / input.c as
	appropriate.  GC-mark trees hanging off the pending inlines
	chain.

testsuite:
	* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
	ERROR markers.
	* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
	* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
	* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
	* gcc.dg/wtr-suffix-1.c: Correct error regexps.
	* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
	Preprocess only.
	* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
	* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.

From-SVN: r36216
This commit is contained in:
Zack Weinberg 2000-09-07 00:37:14 +00:00
parent 26aa75bef9
commit 0e5921e8a0
49 changed files with 5051 additions and 7585 deletions

View File

@ -1,3 +1,81 @@
2000-09-06 Zack Weinberg <zack@wolery.cumb.org>
Integrated preprocessor.
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
2000-09-06 David Edelsohn <edelsohn@gnu.org> 2000-09-06 David Edelsohn <edelsohn@gnu.org>
* rs6000.md: Correct function unit definitions for cr_logical and * rs6000.md: Correct function unit definitions for cr_logical and
@ -171,8 +249,8 @@
2000-09-05 Bruce Korb <bkorb@gnu.org> 2000-09-05 Bruce Korb <bkorb@gnu.org>
* fixinc/fixincl.c (load_file): always read header files * fixinc/fixincl.c (load_file): always read header files
with sizes that are a multiple of the page size. with sizes that are a multiple of the page size.
& use libiberty's getpagesize for determining that. & use libiberty's getpagesize for determining that.
2000-09-05 Alexandre Oliva <aoliva@redhat.com> 2000-09-05 Alexandre Oliva <aoliva@redhat.com>
@ -202,7 +280,7 @@ Wed Jan 1 00:23:59 MET 1997 Jan Hubicka <jh@suse.cz>
Wed Jan 1 00:17:32 MET 1997 Jan Hubicka <jh@suse.cz> Wed Jan 1 00:17:32 MET 1997 Jan Hubicka <jh@suse.cz>
* i386.md (pushsi2, pushhi2, pophi2, swapsf, swapdf, * i386.md (pushsi2, pushhi2, pophi2, swapsf, swapdf,
umulsi3_highpart, smulsi3_highpart, testqi_ccno_1, xorqi_ext_1): umulsi3_highpart, smulsi3_highpart, testqi_ccno_1, xorqi_ext_1):
Add '*' to insn pattern name. Add '*' to insn pattern name.
@ -222,7 +300,7 @@ Wed Jan 1 00:17:32 MET 1997 Jan Hubicka <jh@suse.cz>
2000-09-03 Richard Earnshaw <rearnsha@arm.com> 2000-09-03 Richard Earnshaw <rearnsha@arm.com>
* arm.c (final_prescan_insn): If the form of a jump insn isn't * arm.c (final_prescan_insn): If the form of a jump insn isn't
recognized, don't try to conditionally execute it. recognized, don't try to conditionally execute it.
Sun Sep 3 13:10:56 2000 Denis Chertykov <denisc@overta.ru> Sun Sep 3 13:10:56 2000 Denis Chertykov <denisc@overta.ru>
@ -316,7 +394,7 @@ Sat Sep 2 13:58:23 2000 Marek Michalkiewicz <marekm@linux.org.pl>
(prepare_move_operands): Call emit_pic_move or (prepare_move_operands): Call emit_pic_move or
emit_pic_const_move if appropriate. emit_pic_const_move if appropriate.
(output_far_jump): For PIC, use braf and output long offset. (output_far_jump): For PIC, use braf and output long offset.
(machine_dependent_reorg): (machine_dependent_reorg):
(sh_expand_prologue): Save and initialize the PIC register. (sh_expand_prologue): Save and initialize the PIC register.
(sh_expand_epilogue): Restore it. (sh_expand_epilogue): Restore it.
(initial_elimination_offset): Account for it. (initial_elimination_offset): Account for it.
@ -349,7 +427,7 @@ Sat Sep 2 13:58:23 2000 Marek Michalkiewicz <marekm@linux.org.pl>
* fix-header.c (write_rbrac): Add putc and getc to list of * fix-header.c (write_rbrac): Add putc and getc to list of
functions to protect against prior definition as a macro. functions to protect against prior definition as a macro.
2000-09-01 Joseph S. Myers <jsm28@cam.ac.uk> 2000-09-01 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.h (enum c_tree_index): Add CTI_C_SIZE_TYPE. * c-common.h (enum c_tree_index): Add CTI_C_SIZE_TYPE.
@ -414,18 +492,18 @@ Fri Sep 1 10:59:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2000-09-01 Andrew Haley <aph@redhat.com> 2000-09-01 Andrew Haley <aph@redhat.com>
* dwarf2out.c (stack_adjust_offset): New function. * dwarf2out.c (stack_adjust_offset): New function.
(dwarf2out_stack_adjust): Break out stack adjust logic into (dwarf2out_stack_adjust): Break out stack adjust logic into
new stack_adjust_offset function. Look inside parallels and new stack_adjust_offset function. Look inside parallels and
sequences for stack adjustments. sequences for stack adjustments.
2000-08-31 Jeff Law <law@cygnus.com> 2000-08-31 Jeff Law <law@cygnus.com>
* arm.md: Use no_new_pseudos to determine when it is safe * arm.md: Use no_new_pseudos to determine when it is safe
to create new pseudo registers. to create new pseudo registers.
* arm.c (legitimize_pic_address): Use no_new_pseudos to determine * arm.c (legitimize_pic_address): Use no_new_pseudos to determine
when we can safely allocate new registers. when we can safely allocate new registers.
2000-08-31 Geoffrey Keating <geoffk@cygnus.com> 2000-08-31 Geoffrey Keating <geoffk@cygnus.com>
@ -441,7 +519,7 @@ Fri Sep 1 10:59:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* toplev.c (rest_of_compilation): No CONCATs after RTL generation. * toplev.c (rest_of_compilation): No CONCATs after RTL generation.
2000-08-22 Philipp Thomas <pthomas@suse.de> 2000-08-22 Philipp Thomas <pthomas@suse.de>
Masanobu Yuhara <yuhara@flab.fujitsu.co.jp> Masanobu Yuhara <yuhara@flab.fujitsu.co.jp>
* gmicro.h (TARGET_SWITCHES): Add descriptions and mark them * gmicro.h (TARGET_SWITCHES): Add descriptions and mark them
for translation. for translation.
@ -496,7 +574,7 @@ Tue Aug 29 22:09:59 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* c-common.c (declare_function_name): Use func_id_node, * c-common.c (declare_function_name): Use func_id_node,
function_id_node, and pretty_function_id_node. Do not make function_id_node, and pretty_function_id_node. Do not make
__func__ visible at file scope. __func__ visible at file scope.
* c-common.h (c_tree_index): Add CTI_FUNCTION_ID, * c-common.h (c_tree_index): Add CTI_FUNCTION_ID,
CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID. CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID.
(function_id_node, pretty_function_id_node, func_id_node): New (function_id_node, pretty_function_id_node, func_id_node): New
@ -509,7 +587,7 @@ Tue Aug 29 22:09:59 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* c-decl.c (pushdecl, implicit_decl_warning): Constify a char *. * c-decl.c (pushdecl, implicit_decl_warning): Constify a char *.
* c-pragma.h (struct weak_syms): Constify name and value members. * c-pragma.h (struct weak_syms): Constify name and value members.
(add_weak): Constify arguments. (add_weak): Constify arguments.
* calls.c (special_function_p): Constify a char *. * calls.c (special_function_p): Constify a char *.
(expand_call): Remove variable which is initialized and then (expand_call): Remove variable which is initialized and then
@ -590,7 +668,7 @@ Tue Aug 29 22:29:58 2000 Denis Chertykov <denisc@overta.ru> & Marek Michalkiew
(output_movqi): New prototype. (output_movqi): New prototype.
(output_movhi): New prototype. (output_movhi): New prototype.
(call_insn_operand): Likewise. (call_insn_operand): Likewise.
(final_prescan_insn): Likewise. (final_prescan_insn): Likewise.
(avr_simplify_comparision_p): Likewise. (avr_simplify_comparision_p): Likewise.
(avr_normalize_condition): Likewise. (avr_normalize_condition): Likewise.
(compare_eq_p): Likewise. (compare_eq_p): Likewise.
@ -800,7 +878,7 @@ Tue Aug 29 15:17:54 EDT 2000 John Wehle (john@feith.com)
(gen_internal_sym, output_die_symbol, output_symbolic_ref): New fns. (gen_internal_sym, output_die_symbol, output_symbolic_ref): New fns.
(output_die): Call output_die_symbol and AT_ref_external. (output_die): Call output_die_symbol and AT_ref_external.
(output_comdat_comp_unit): New fn, split out from... (output_comdat_comp_unit): New fn, split out from...
(dwarf2out_finish): ...here. Also call add_sibling_attributes for (dwarf2out_finish): ...here. Also call add_sibling_attributes for
secondary CUs. secondary CUs.
(output_pubnames, output_aranges): Abort if we see entries from (output_pubnames, output_aranges): Abort if we see entries from
secondary CUs. secondary CUs.
@ -928,9 +1006,9 @@ Fri Aug 25 12:52:49 EDT 2000 John Wehle (john@feith.com)
(flow_loops_find): Call flow_loop_entry_edges_find. (flow_loops_find): Call flow_loop_entry_edges_find.
(flow_loop_dump): Dump entry_edges list. (flow_loop_dump): Dump entry_edges list.
(flow_loops_free): Free entry_edges. (flow_loops_free): Free entry_edges.
2000-08-26 Michael Hayes <mhayes@cygnus.com> 2000-08-26 Michael Hayes <mhayes@cygnus.com>
* loop.c (loop_dump_aux, debug_loop): New functions. * loop.c (loop_dump_aux, debug_loop): New functions.
(LOOP_BLOCK_NUM_1, LOOP_BLOCK_NUM, LOOP_INSN_UID): New macros. (LOOP_BLOCK_NUM_1, LOOP_BLOCK_NUM, LOOP_INSN_UID): New macros.
@ -943,14 +1021,14 @@ Fri Aug 25 12:52:49 EDT 2000 John Wehle (john@feith.com)
* toplev.c (rest_of_compilation): Add NULL callback function pointer * toplev.c (rest_of_compilation): Add NULL callback function pointer
to call to flow_loops_dump. to call to flow_loops_dump.
2000-08-26 Michael Hayes <mhayes@cygnus.com> 2000-08-26 Michael Hayes <mhayes@cygnus.com>
* loop.c (count_loop_regs_set): Replace start and end arguments * loop.c (count_loop_regs_set): Replace start and end arguments
with loop argument. All callers udated. with loop argument. All callers udated.
2000-08-26 Michael Hayes <mhayes@cygnus.com> 2000-08-26 Michael Hayes <mhayes@cygnus.com>
* loop.c (constant_high_bytes): Delete. * loop.c (constant_high_bytes): Delete.
2000-08-26 Michael Hayes <mhayes@cygnus.com> 2000-08-26 Michael Hayes <mhayes@cygnus.com>
@ -1000,7 +1078,7 @@ Fri 25-Aug-2000 08:03:27 BST Neil Booth <NeilB@earthling.net>
* gcc/c-typeck.c (decl_constant_value): Don't check ITERATOR_P. * gcc/c-typeck.c (decl_constant_value): Don't check ITERATOR_P.
(readonly_warning): Likewise. (readonly_warning): Likewise.
* gcc/tree.h (ITERATOR_BOUND_P): Don't mention it. * gcc/tree.h (ITERATOR_BOUND_P): Don't mention it.
2000-08-24 Jim Wilson <wilson@cygnus.com> 2000-08-24 Jim Wilson <wilson@cygnus.com>
* c-common.c (decl_attributes, case A_ALIGN): Revert last change. * c-common.c (decl_attributes, case A_ALIGN): Revert last change.
@ -1012,7 +1090,7 @@ Fri 25-Aug-2000 08:03:27 BST Neil Booth <NeilB@earthling.net>
2000-08-24 Zack Weinberg <zack@wolery.cumb.org> 2000-08-24 Zack Weinberg <zack@wolery.cumb.org>
* ggc-page.c (alloc_page): If HAVE_MMAP_ANYWHERE and we're * ggc-page.c (alloc_page): If HAVE_MMAP_ANYWHERE and we're
asked for one page, allocate GGC_QUIRE_SIZE of them and put asked for one page, allocate GGC_QUIRE_SIZE of them and put
the extras on the free list. the extras on the free list.
(release_pages): Clean up. (release_pages): Clean up.
@ -1032,7 +1110,7 @@ Fri 25-Aug-2000 08:03:27 BST Neil Booth <NeilB@earthling.net>
(fr_register_operand, grfr_register_operand): New. (fr_register_operand, grfr_register_operand): New.
(gr_nonimmediate_operand, grfr_nonimmediate_operand): New. (gr_nonimmediate_operand, grfr_nonimmediate_operand): New.
(grfr_reg_or_8bit_operand): New. (grfr_reg_or_8bit_operand): New.
(gr_reg_or_0_operand): Rename from reg_or_0_operand and (gr_reg_or_0_operand): Rename from reg_or_0_operand and
use gr_register_operand. use gr_register_operand.
(gr_reg_or_5bit_operand, gr_reg_or_6bit_operand): Likewise. (gr_reg_or_5bit_operand, gr_reg_or_6bit_operand): Likewise.
(gr_reg_or_8bit_operand, gr_reg_or_8bit_adjusted_operand): Likewise. (gr_reg_or_8bit_operand, gr_reg_or_8bit_adjusted_operand): Likewise.
@ -1059,7 +1137,7 @@ Fri 25-Aug-2000 08:03:27 BST Neil Booth <NeilB@earthling.net>
* config/ia64/ia64.md (*): Use gr_register_operand and co. * config/ia64/ia64.md (*): Use gr_register_operand and co.
(mf): Indicate that we set memory as well as use it. (mf): Indicate that we set memory as well as use it.
(fetchadd_acq_si): Show memory being modified as well. (fetchadd_acq_si): Show memory being modified as well.
(fetchadd_acq_di, cmpxchg_acq_si, cmpxchg_acq_di): Likewise. (fetchadd_acq_di, cmpxchg_acq_si, cmpxchg_acq_di): Likewise.
(val_compare_and_swap_si, val_compare_and_swap_di): Remove. (val_compare_and_swap_si, val_compare_and_swap_di): Remove.
(lock_test_and_set_si, lock_test_and_set_di): Remove. (lock_test_and_set_si, lock_test_and_set_di): Remove.
(fetch_and_add_si, fetch_and_sub_si, fetch_and_or_si): Remove. (fetch_and_add_si, fetch_and_sub_si, fetch_and_or_si): Remove.
@ -1082,7 +1160,7 @@ Fri 25-Aug-2000 08:03:27 BST Neil Booth <NeilB@earthling.net>
* dwarf2out.c (AT_flag, AT_int, AT_unsigned, AT_string, AT_ref, * dwarf2out.c (AT_flag, AT_int, AT_unsigned, AT_string, AT_ref,
AT_loc, AT_addr, AT_lbl): Abort on unsuitable input. AT_loc, AT_addr, AT_lbl): Abort on unsuitable input.
(get_AT_low_pc, get_AT_hi_pc, get_AT_string, get_AT_flag, (get_AT_low_pc, get_AT_hi_pc, get_AT_string, get_AT_flag,
get_AT_unsigned, get_AT_ref): Don't call them if get_AT fails. get_AT_unsigned, get_AT_ref): Don't call them if get_AT fails.
2000-08-24 Greg McGary <greg@mcgary.org> 2000-08-24 Greg McGary <greg@mcgary.org>
@ -1286,7 +1364,7 @@ Tue Aug 22 21:21:05 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
(THUMB_FUNCTION_START): New macro: Common code at the start of (THUMB_FUNCTION_START): New macro: Common code at the start of
Thumb functions. Thumb functions.
(__divsi3, __udivsi3, __modsi3, __umodsi3): Use new macros. (__divsi3, __udivsi3, __modsi3, __umodsi3): Use new macros.
Tue Aug 22 20:34:52 2000 Kaz Kojima <kkojima@rr.iij4u.or.jp> Tue Aug 22 20:34:52 2000 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* config/sh/sh.md (cmpeqdi_t splitter): Fix a reverse testing. * config/sh/sh.md (cmpeqdi_t splitter): Fix a reverse testing.
@ -1327,7 +1405,7 @@ Tue Aug 22 20:34:52 2000 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* Makefile.in (OBJS): Add dependence.o. * Makefile.in (OBJS): Add dependence.o.
* dependence.c: New file. * dependence.c: New file.
2000-08-22 Alexandre Oliva <aoliva@redhat.com>, John David Anglin <dave.anglin@nrc.ca> 2000-08-22 Alexandre Oliva <aoliva@redhat.com>, John David Anglin <dave.anglin@nrc.ca>
* calls.c (check_sibcall_argument_overlap_1): Adjust for * calls.c (check_sibcall_argument_overlap_1): Adjust for
@ -1459,10 +1537,10 @@ Tue Aug 22 02:31:26 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* mips/linux.h (LINK_SPEC): Use %(endian_spec). * mips/linux.h (LINK_SPEC): Use %(endian_spec).
* mips/mips.h: Change LINKER_ENDIAN_SPEC to ENDIAN_SPEC * mips/mips.h: Change LINKER_ENDIAN_SPEC to ENDIAN_SPEC
and linker_endian_spec to endian_spec. and linker_endian_spec to endian_spec.
(ENDIAN_SPEC): Add %{EB} and %{EL}. (ENDIAN_SPEC): Add %{EB} and %{EL}.
(LINK_SPEC): Remove %{EB} and %{EL}. (LINK_SPEC): Remove %{EB} and %{EL}.
(ASM_SPEC): Likewise. Use %(endian_spec). (ASM_SPEC): Likewise. Use %(endian_spec).
2000-08-21 Joseph S. Myers <jsm28@cam.ac.uk> 2000-08-21 Joseph S. Myers <jsm28@cam.ac.uk>
@ -1676,7 +1754,7 @@ Fri Aug 18 14:23:18 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
(fixup_match_1): Likewise. (fixup_match_1): Likewise.
(fixup_match_1, combine_stack_adjustments_for_block): Add casts to (fixup_match_1, combine_stack_adjustments_for_block): Add casts to
avoid signed/unsigned warnings. avoid signed/unsigned warnings.
* function.c (fixup_var_refs_1, case MEM): Update CODE after * function.c (fixup_var_refs_1, case MEM): Update CODE after
updating X. updating X.
@ -1869,7 +1947,7 @@ Tue Aug 15 17:33:05 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
expands. expands.
(arm_buneq, arm_bltgt, arm_buneq_reversed, arm_bltgt_reveresed): New (arm_buneq, arm_bltgt, arm_buneq_reversed, arm_bltgt_reveresed): New
patterns. patterns.
Tue Aug 15 00:36:36 2000 Ovidiu Predescu <ovidiu@cup.hp.com> Tue Aug 15 00:36:36 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
* gthr-posix.h: Conditionally include <sched.h>; include * gthr-posix.h: Conditionally include <sched.h>; include
@ -1939,7 +2017,7 @@ Tue Aug 15 00:36:36 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
2000-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cse.c (fold_rtx): Avoid empty body in an if-statement. * cse.c (fold_rtx): Avoid empty body in an if-statement.
* doloop.c (doloop_iterations_max, doloop_modify): Avoid using the * doloop.c (doloop_iterations_max, doloop_modify): Avoid using the
`U' integer constant suffix. `U' integer constant suffix.
@ -1977,7 +2055,7 @@ Tue Aug 15 00:36:36 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
* configure.in: Accept *-*-linux* not just *-*-linux-gnu*. * configure.in: Accept *-*-linux* not just *-*-linux-gnu*.
* fixinc/inclhack.def: Likewise. * fixinc/inclhack.def: Likewise.
* fixinc/mkfixinc.sh: Likewise. * fixinc/mkfixinc.sh: Likewise.
* configure: Regenerate. * configure: Regenerate.
* fixinc/fixincl.x: Regenerate. * fixinc/fixincl.x: Regenerate.
* install.texi: Document equivalence of linux and linux-gnu. * install.texi: Document equivalence of linux and linux-gnu.
@ -2067,7 +2145,7 @@ Mon Aug 14 18:51:44 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
(do_restore): Likewise. (do_restore): Likewise.
(gen_movdi_x, gen_fr_spill_x, gen_fr_restore_x): New. (gen_movdi_x, gen_fr_spill_x, gen_fr_restore_x): New.
(ia64_expand_prologue, ia64_expand_epilogue): Use them. (ia64_expand_prologue, ia64_expand_epilogue): Use them.
(rtx_needs_barrier): Track actual bit manipulation for (rtx_needs_barrier): Track actual bit manipulation for
ar.unat moves, gr_spill, and gr_restore. ar.unat moves, gr_spill, and gr_restore.
(emit_insn_group_barriers): Special case gr_spill/gr_restore. (emit_insn_group_barriers): Special case gr_spill/gr_restore.
(process_set): Don't handle varargs spills. (process_set): Don't handle varargs spills.
@ -2080,7 +2158,7 @@ Mon Aug 14 18:51:44 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
* config/ia64/ia64.h (PROMOTE_MODE): Only extend to SImode. * config/ia64/ia64.h (PROMOTE_MODE): Only extend to SImode.
2000-08-11 Mark Elbrecht <snowball3@bigfoot.com> 2000-08-11 Mark Elbrecht <snowball3@bigfoot.com>
* gcc.texi (The Configuration File): Document * gcc.texi (The Configuration File): Document
COLLECT2_HOST_INITIALIZATION, GCC_DRIVER_HOST_INITIALIZATION, and COLLECT2_HOST_INITIALIZATION, GCC_DRIVER_HOST_INITIALIZATION, and
UPDATE_PATH_HOST_CANONICALIZATION. UPDATE_PATH_HOST_CANONICALIZATION.
@ -2281,7 +2359,7 @@ Thu Aug 10 00:11:04 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
2000-08-08 David Edelsohn <edelsohn@gnu.org> 2000-08-08 David Edelsohn <edelsohn@gnu.org>
* rs6000.c (optimization_options): Decorate 'level' as * rs6000.c (optimization_options): Decorate 'level' as
ATTRIBUTE_UNUSED. ATTRIBUTE_UNUSED.
(mask64_operand): Remove sign-extend thinko. (mask64_operand): Remove sign-extend thinko.
(rldic_operand): New function. (rldic_operand): New function.
(load_multiple_operation): regno's are unsigned ints. (load_multiple_operation): regno's are unsigned ints.
@ -2346,7 +2424,7 @@ Thu Aug 10 00:11:04 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
(ia64_encode_section_info): Silence signed/unsigned warnings. (ia64_encode_section_info): Silence signed/unsigned warnings.
(spill_offset, sp_offset, spill_offset_emitted): Remove. (spill_offset, sp_offset, spill_offset_emitted): Remove.
(tmp_reg, tmp_saved): Remove. (tmp_reg, tmp_saved): Remove.
(process_set): Rewrite to expect complicated bits via (process_set): Rewrite to expect complicated bits via
REG_FRAME_RELATED_EXPR. REG_FRAME_RELATED_EXPR.
(ia64_expand_fetch_and_op): Use emit_move_insn; be explicit (ia64_expand_fetch_and_op): Use emit_move_insn; be explicit
in the use of ar.ccv; never set RTX_UNCHANGING_P. in the use of ar.ccv; never set RTX_UNCHANGING_P.
@ -2436,7 +2514,7 @@ Thu Aug 10 00:11:04 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
* mn10300.md: Use nonimmediate_operand instead of general_operand * mn10300.md: Use nonimmediate_operand instead of general_operand
on output operands. on output operands.
* mn10300.h (PREFERRED_RELOAD_CLASS): Limit memory reloads. * mn10300.h (PREFERRED_RELOAD_CLASS): Limit memory reloads.
2000-08-07 Alexandre Oliva <aoliva@redhat.com> 2000-08-07 Alexandre Oliva <aoliva@redhat.com>
@ -2578,7 +2656,7 @@ Sun Aug 6 00:54:42 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
* tree.c (tree_expr_nonnegative_p): Move to... * tree.c (tree_expr_nonnegative_p): Move to...
* fold-const.c: ... here. Also handle BIND_EXPR and RTL_EXPR. * fold-const.c: ... here. Also handle BIND_EXPR and RTL_EXPR.
(rtl_expr_nonnegative_p): New. (rtl_expr_nonnegative_p): New.
* tree.h: Add prototype for rtl_expr_nonnegative_p. * tree.h: Add prototype for rtl_expr_nonnegative_p.
* real.h (CONST_DOUBLE_LOW, CONST_DOUBLE_HIGH, CONST_DOUBLE_MEM, * real.h (CONST_DOUBLE_LOW, CONST_DOUBLE_HIGH, CONST_DOUBLE_MEM,
@ -2880,9 +2958,9 @@ Fri Aug 4 11:43:49 2000 John Wehle (john@feith.com)
Fri Aug 4 06:53:46 2000 Clinton Popetz <cpopetz@cygnus.com> Fri Aug 4 06:53:46 2000 Clinton Popetz <cpopetz@cygnus.com>
* (mips_legitimate_address_p): Don't allow register+offset * (mips_legitimate_address_p): Don't allow register+offset
if the offset is large and negative, and we are compiling if the offset is large and negative, and we are compiling
for 64 bit registers. for 64 bit registers.
2000-08-04 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl> 2000-08-04 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>

View File

@ -1080,13 +1080,12 @@ s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
c-errors.o: c-errors.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \ c-errors.o: c-errors.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
diagnostic.h diagnostic.h
c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h $(GGC_H) \ c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h $(GGC_H) intl.h \
$(srcdir)/c-parse.h c-tree.h c-common.h input.h flags.h system.h \ c-tree.h c-common.h input.h flags.h system.h toplev.h output.h cpplib.h
toplev.h output.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
$(srcdir)/c-parse.c: $(srcdir)/c-parse.y $(srcdir)/c-parse.c: $(srcdir)/c-parse.y
cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o c-parse.c c-parse.y cd $(srcdir); $(BISON) $(BISONFLAGS) -o c-parse.c c-parse.y
$(srcdir)/c-parse.y: c-parse.in $(srcdir)/c-parse.y: c-parse.in
echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
@ -1094,13 +1093,6 @@ $(srcdir)/c-parse.y: c-parse.in
$(srcdir)/c-parse.in >>tmp-c-parse.y $(srcdir)/c-parse.in >>tmp-c-parse.y
$(SHELL) $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y $(SHELL) $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
$(srcdir)/c-gperf.h: c-parse.gperf
gperf -L C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \
-k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h || ( \
echo "See $(website)/cvs.html#generated_files" >&2 ; \
exit 1 )
$(SHELL) $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \ c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
c-common.h $(GGC_H) c-lex.h flags.h function.h output.h $(EXPR_H) \ c-common.h $(GGC_H) c-lex.h flags.h function.h output.h $(EXPR_H) \
toplev.h defaults.h intl.h toplev.h defaults.h intl.h
@ -1109,8 +1101,8 @@ c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \
c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \ c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \
$(GGC_H) c-lex.h toplev.h diagnostic.h output.h function.h $(GGC_H) c-lex.h toplev.h diagnostic.h output.h function.h
c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \ c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
c-common.h $(srcdir)/c-parse.h $(srcdir)/c-gperf.h c-pragma.h input.h \ c-common.h c-pragma.h input.h intl.h flags.h toplev.h output.h \
intl.h flags.h toplev.h output.h mbchar.h $(GGC_H) mbchar.h $(GGC_H) cpplib.h $(SPLAY_TREE_H)
c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h \ c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h \
c-common.h flags.h toplev.h c-common.h flags.h toplev.h
c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
@ -1769,8 +1761,7 @@ intl.o: intl.c intl.h gansidecl.h Makefile
$(top_builddir)/intl/libintl.a: intl.all $(top_builddir)/intl/libintl.a: intl.all
# Make sure all the headers are there for xgettext to scan. # Make sure all the headers are there for xgettext to scan.
$(INTL_TARGETS): $(srcdir)/c-gperf.h \ $(INTL_TARGETS): $(srcdir)/c-parse.c
$(srcdir)/c-parse.c $(srcdir)/c-parse.h
intl.all intl.install intl.uninstall intl.distdir \ intl.all intl.install intl.uninstall intl.distdir \
intl.mostlyclean intl.clean intl.distclean intl.maintainer-clean: intl.mostlyclean intl.clean intl.distclean intl.maintainer-clean:
@ -2238,8 +2229,7 @@ maintainer-clean:
@echo 'deletes files that may need special tools to rebuild.' @echo 'deletes files that may need special tools to rebuild.'
$(MAKE) INTL_DISTCLEAN= INTL_CLEAN= INTL_MOSTLYCLEAN= \ $(MAKE) INTL_DISTCLEAN= INTL_CLEAN= INTL_MOSTLYCLEAN= \
intl.maintainer-clean lang.maintainer-clean distclean intl.maintainer-clean lang.maintainer-clean distclean
-rm -f c-parse.y c-gperf.h -rm -f c-parse.y c-parse.c c-parse.output TAGS
-rm -f c-parse.c c-parse.h c-parse.output TAGS
-rm -f cpp.info* cpp.??s cpp.*aux -rm -f cpp.info* cpp.??s cpp.*aux
-rm -f gcc.info* gcc.??s gcc.*aux -rm -f gcc.info* gcc.??s gcc.*aux
# #
@ -2681,7 +2671,7 @@ distdir-cvs: force
# This target exists to do the initial work before the language specific # This target exists to do the initial work before the language specific
# stuff gets done. # stuff gets done.
distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \ distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y \
$(srcdir)/c-parse.c $(srcdir)/config.in $(srcdir)/version.c TAGS $(srcdir)/c-parse.c $(srcdir)/config.in $(srcdir)/version.c TAGS
@case '$(USE_NLS)' in \ @case '$(USE_NLS)' in \
yes) ;; \ yes) ;; \
@ -2760,7 +2750,7 @@ distdir: distdir-cvs distdir-start intl.distdir intl.distdir-fixup \
# creates a diff file between an older distribution and this one. # creates a diff file between an older distribution and this one.
# The -P option assumes this is GNU diff. # The -P option assumes this is GNU diff.
diff: diff:
diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \ diff -rc2P -x c-parse.y -x c-parse.c \
-x TAGS -x INSTALL -x configure -x config.in \ -x TAGS -x INSTALL -x configure -x config.in \
-x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \ -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
-x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \ -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \

View File

@ -35,8 +35,6 @@ Boston, MA 02111-1307, USA. */
#if USE_CPPLIB #if USE_CPPLIB
#include "cpplib.h" #include "cpplib.h"
cpp_reader parse_in; cpp_reader parse_in;
cpp_options parse_options;
enum cpp_token cpp_token;
#endif #endif
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
@ -3518,105 +3516,7 @@ truthvalue_conversion (expr)
return build_binary_op (NE_EXPR, expr, integer_zero_node, 1); return build_binary_op (NE_EXPR, expr, integer_zero_node, 1);
} }
#if USE_CPPLIB #if !USE_CPPLIB
/* Read the rest of a #-directive from input stream FINPUT.
In normal use, the directive name and the white space after it
have already been read, so they won't be included in the result.
We allow for the fact that the directive line may contain
a newline embedded within a character or string literal which forms
a part of the directive.
The value is a string in a reusable buffer. It remains valid
only until the next time this function is called. */
unsigned char *yy_cur, *yy_lim;
#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
#define UNGETC(c) ((c) == EOF ? 0 : yy_cur--)
int
yy_get_token ()
{
for (;;)
{
parse_in.limit = parse_in.token_buffer;
cpp_token = cpp_get_token (&parse_in);
if (cpp_token == CPP_EOF)
return -1;
yy_lim = CPP_PWRITTEN (&parse_in);
yy_cur = parse_in.token_buffer;
if (yy_cur < yy_lim)
return *yy_cur++;
}
}
char *
get_directive_line ()
{
static char *directive_buffer = NULL;
static unsigned buffer_length = 0;
register char *p;
register char *buffer_limit;
register int looking_for = 0;
register int char_escaped = 0;
if (buffer_length == 0)
{
directive_buffer = (char *)xmalloc (128);
buffer_length = 128;
}
buffer_limit = &directive_buffer[buffer_length];
for (p = directive_buffer; ; )
{
int c;
/* Make buffer bigger if it is full. */
if (p >= buffer_limit)
{
register unsigned bytes_used = (p - directive_buffer);
buffer_length *= 2;
directive_buffer
= (char *)xrealloc (directive_buffer, buffer_length);
p = &directive_buffer[bytes_used];
buffer_limit = &directive_buffer[buffer_length];
}
c = GETC ();
/* Discard initial whitespace. */
if ((c == ' ' || c == '\t') && p == directive_buffer)
continue;
/* Detect the end of the directive. */
if (c == '\n' && looking_for == 0)
{
UNGETC (c);
c = '\0';
}
*p++ = c;
if (c == 0)
return directive_buffer;
/* Handle string and character constant syntax. */
if (looking_for)
{
if (looking_for == c && !char_escaped)
looking_for = 0; /* Found terminator... stop looking. */
}
else
if (c == '\'' || c == '"')
looking_for = c; /* Don't stop buffering until we see another
another one of these (or an EOF). */
/* Handle backslash. */
char_escaped = (c == '\\' && ! char_escaped);
}
}
#else
/* Read the rest of a #-directive from input stream FINPUT. /* Read the rest of a #-directive from input stream FINPUT.
In normal use, the directive name and the white space after it In normal use, the directive name and the white space after it
have already been read, so they won't be included in the result. have already been read, so they won't be included in the result.
@ -3699,7 +3599,7 @@ get_directive_line (finput)
char_escaped = (c == '\\' && ! char_escaped); char_escaped = (c == '\\' && ! char_escaped);
} }
} }
#endif /* !USE_CPPLIB */ #endif /* USE_CPPLIB */
/* Make a variant type in the proper way for C/C++, propagating qualifiers /* Make a variant type in the proper way for C/C++, propagating qualifiers
down to the element type of an array. */ down to the element type of an array. */

View File

@ -19,6 +19,9 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef GCC_C_COMMON_H
#define GCC_C_COMMON_H
/* Usage of TREE_LANG_FLAG_?: /* Usage of TREE_LANG_FLAG_?:
0: COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT). 0: COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
TREE_NEGATED_INT (in INTEGER_CST). TREE_NEGATED_INT (in INTEGER_CST).
@ -33,52 +36,72 @@ Boston, MA 02111-1307, USA. */
4: SCOPE_PARTIAL_P (in SCOPE_STMT) 4: SCOPE_PARTIAL_P (in SCOPE_STMT)
*/ */
/* Reserved identifiers. */ /* Reserved identifiers. This is the union of all the keywords for C,
C++, and Objective C. All the type modifiers have to be in one
block at the beginning, because they are used as mask bits. There
are 27 type modifiers; if we add many more we will have to redesign
the mask mechanism. */
enum rid enum rid
{ {
RID_UNUSED, /* Modifiers: */
RID_INT, /* C, in empirical order of frequency. */
RID_CHAR, RID_STATIC = 0,
RID_FLOAT, RID_UNSIGNED, RID_LONG, RID_CONST, RID_EXTERN,
RID_DOUBLE, RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
RID_VOID, RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
RID_UNUSED1,
/* The first seven are in the order of most frequently used, /* C extensions */
as emiprically determined. */ RID_BOUNDED, RID_UNBOUNDED, RID_COMPLEX,
RID_FIRST_MODIFIER,
RID_EXTERN = RID_FIRST_MODIFIER,
RID_CONST,
RID_LONG,
RID_TYPEDEF,
RID_UNSIGNED,
RID_SHORT,
RID_INLINE,
RID_AUTO,
RID_STATIC,
RID_REGISTER,
RID_SIGNED,
RID_RESTRICT,
RID_VOLATILE,
RID_BOUNDED,
RID_UNBOUNDED,
RID_NOALIAS,
RID_COMPLEX,
RID_IN, /* C++ */
RID_OUT, RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
RID_INOUT,
RID_BYCOPY,
RID_BYREF,
RID_ONEWAY,
RID_ID,
RID_MAX /* ObjC */
RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
/* C */
RID_INT, RID_CHAR, RID_FLOAT, RID_DOUBLE, RID_VOID,
RID_ENUM, RID_STRUCT, RID_UNION, RID_IF, RID_ELSE,
RID_WHILE, RID_DO, RID_FOR, RID_SWITCH, RID_CASE,
RID_DEFAULT, RID_BREAK, RID_CONTINUE, RID_RETURN, RID_GOTO,
RID_SIZEOF,
/* C extensions */
RID_ASM, RID_TYPEOF, RID_ALIGNOF, RID_ATTRIBUTE, RID_VA_ARG,
RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL, RID_PTRBASE,
RID_PTREXTENT, RID_PTRVALUE,
/* C++ */
RID_BOOL, RID_WCHAR, RID_CLASS,
RID_PUBLIC, RID_PRIVATE, RID_PROTECTED,
RID_TEMPLATE, RID_NULL, RID_CATCH,
RID_DELETE, RID_FALSE, RID_NAMESPACE,
RID_NEW, RID_OPERATOR, RID_THIS,
RID_THROW, RID_TRUE, RID_TRY,
RID_TYPENAME, RID_TYPEID, RID_USING,
/* casts */
RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
/* alternate spellings */
RID_AND, RID_AND_EQ, RID_NOT, RID_NOT_EQ,
RID_OR, RID_OR_EQ, RID_XOR, RID_XOR_EQ,
RID_BITAND, RID_BITOR, RID_COMPL,
/* Objective C */
RID_ID, RID_AT_ENCODE, RID_AT_END,
RID_AT_CLASS, RID_AT_ALIAS, RID_AT_DEFS,
RID_AT_PRIVATE, RID_AT_PROTECTED, RID_AT_PUBLIC,
RID_AT_PROTOCOL, RID_AT_SELECTOR, RID_AT_INTERFACE,
RID_AT_IMPLEMENTATION,
RID_MAX,
RID_FIRST_MODIFIER = RID_STATIC,
RID_LAST_MODIFIER = RID_ONEWAY
}; };
#define NORID RID_UNUSED
/* The elements of `ridpointers' are identifier nodes for the reserved /* The elements of `ridpointers' are identifier nodes for the reserved
type names and storage classes. It is indexed by a RID_... value. */ type names and storage classes. It is indexed by a RID_... value. */
extern tree *ridpointers; extern tree *ridpointers;
@ -523,3 +546,21 @@ extern tree default_conversion PARAMS ((tree));
extern tree common_type PARAMS ((tree, tree)); extern tree common_type PARAMS ((tree, tree));
extern tree expand_tree_builtin PARAMS ((tree, tree, tree)); extern tree expand_tree_builtin PARAMS ((tree, tree, tree));
/* Hook currently used only by the C++ front end to reset internal state
after entering or leaving a header file. */
extern void extract_interface_info PARAMS ((void));
/* Information recorded about each file examined during compilation. */
struct c_fileinfo
{
int time; /* Time spent in the file. */
short interface_only; /* Flags - used only by C++ */
short interface_unknown;
};
struct c_fileinfo *get_fileinfo PARAMS ((const char *));
extern void dump_time_statistics PARAMS ((void));
#endif

View File

@ -503,7 +503,9 @@ c_decode_option (argc, argv)
strings_processed = 0; strings_processed = 0;
#endif /* ! USE_CPPLIB */ #endif /* ! USE_CPPLIB */
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) if (!strcmp (p, "-lang-objc"))
c_language = clk_objective_c;
else if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
{ {
flag_traditional = 1; flag_traditional = 1;
flag_writable_strings = 1; flag_writable_strings = 1;
@ -845,6 +847,14 @@ print_lang_identifier (file, node, indent)
print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4); print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);
print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4); print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);
print_node (file, "limbo value", IDENTIFIER_LIMBO_VALUE (node), indent + 4); print_node (file, "limbo value", IDENTIFIER_LIMBO_VALUE (node), indent + 4);
if (C_IS_RESERVED_WORD (node))
{
tree rid = ridpointers[C_RID_CODE (node)];
indent_to (file, indent + 4);
fprintf (file, "rid ");
fprintf (file, HOST_PTR_PRINTF, (void *)rid);
fprintf (file, " \"%s\"", IDENTIFIER_POINTER (rid));
}
} }
/* Hook called at end of compilation to assume 1 elt /* Hook called at end of compilation to assume 1 elt
@ -2896,6 +2906,7 @@ lookup_name (name)
tree name; tree name;
{ {
register tree val; register tree val;
if (current_binding_level != global_binding_level if (current_binding_level != global_binding_level
&& IDENTIFIER_LOCAL_VALUE (name)) && IDENTIFIER_LOCAL_VALUE (name))
val = IDENTIFIER_LOCAL_VALUE (name); val = IDENTIFIER_LOCAL_VALUE (name);
@ -3986,7 +3997,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
for (spec = declspecs; spec; spec = TREE_CHAIN (spec)) for (spec = declspecs; spec; spec = TREE_CHAIN (spec))
{ {
register int i;
register tree id = TREE_VALUE (spec); register tree id = TREE_VALUE (spec);
if (id == ridpointers[(int) RID_INT]) if (id == ridpointers[(int) RID_INT])
@ -3994,29 +4004,29 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if (id == ridpointers[(int) RID_CHAR]) if (id == ridpointers[(int) RID_CHAR])
explicit_char = 1; explicit_char = 1;
if (TREE_CODE (id) == IDENTIFIER_NODE) if (TREE_CODE (id) == IDENTIFIER_NODE && C_IS_RESERVED_WORD (id))
for (i = (int) RID_FIRST_MODIFIER; i < (int) RID_MAX; i++) {
{ enum rid i = C_RID_CODE (id);
if (ridpointers[i] == id) if (i <= RID_LAST_MODIFIER)
{ {
if (i == (int) RID_LONG && specbits & (1 << i)) if (i == RID_LONG && specbits & (1<<i))
{ {
if (longlong) if (longlong)
error ("`long long long' is too long for GCC"); error ("`long long long' is too long for GCC");
else else
{ {
if (pedantic && !flag_isoc99 && ! in_system_header if (pedantic && !flag_isoc99 && ! in_system_header
&& warn_long_long) && warn_long_long)
pedwarn ("ISO C89 does not support `long long'"); pedwarn ("ISO C89 does not support `long long'");
longlong = 1; longlong = 1;
} }
} }
else if (specbits & (1 << i)) else if (specbits & (1 << i))
pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id)); pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
specbits |= 1 << i; specbits |= 1 << i;
goto found; goto found;
} }
} }
if (type) if (type)
error ("two or more data types in declaration of `%s'", name); error ("two or more data types in declaration of `%s'", name);
/* Actual typedefs come to us as TYPE_DECL nodes. */ /* Actual typedefs come to us as TYPE_DECL nodes. */
@ -4560,18 +4570,23 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
{ {
tree qualifier = TREE_VALUE (typemodlist); tree qualifier = TREE_VALUE (typemodlist);
if (qualifier == ridpointers[(int) RID_CONST]) if (C_IS_RESERVED_WORD (qualifier))
constp++;
else if (qualifier == ridpointers[(int) RID_VOLATILE])
volatilep++;
else if (qualifier == ridpointers[(int) RID_RESTRICT])
restrictp++;
else if (!erred)
{ {
erred = 1; if (C_RID_CODE (qualifier) == RID_CONST)
error ("invalid type modifier within pointer declarator"); constp++;
else if (C_RID_CODE (qualifier) == RID_VOLATILE)
volatilep++;
else if (C_RID_CODE (qualifier) == RID_RESTRICT)
restrictp++;
else
erred++;
} }
else
erred++;
} }
if (erred)
error ("invalid type modifier within pointer declarator");
if (constp > 1 && ! flag_isoc99) if (constp > 1 && ! flag_isoc99)
pedwarn ("duplicate `const'"); pedwarn ("duplicate `const'");
if (volatilep > 1 && ! flag_isoc99) if (volatilep > 1 && ! flag_isoc99)
@ -6990,3 +7005,9 @@ set_current_function_name_declared (i)
{ {
abort (); abort ();
} }
/* Dummy function in place of callback used by C++. */
void
extract_interface_info ()
{
}

View File

@ -1,252 +0,0 @@
/* C code produced by gperf version 2.7.1 (19981006 egcs) */
/* Command-line: gperf -L C -F , 0, 0 -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$ ../../gcc/c-parse.gperf */
/* Command-line: gperf -L C -F ', 0, 0' -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
struct resword { const char *name; short token; enum rid rid; };
#ifdef __GNUC__
__inline
#endif
static unsigned int hash PARAMS ((const char *, unsigned int));
#ifdef __GNUC__
__inline
#endif
struct resword *is_reserved_word PARAMS ((const char *, unsigned int));
#define TOTAL_KEYWORDS 92
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 20
#define MIN_HASH_VALUE 17
#define MAX_HASH_VALUE 301
/* maximum key range = 285, duplicates = 0 */
#ifdef __GNUC__
__inline
#endif
static unsigned int
hash (str, len)
register const char *str;
register unsigned int len;
{
static unsigned short asso_values[] =
{
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 113, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 1, 302, 78, 52, 111,
34, 9, 46, 59, 1, 20, 302, 1, 118, 17,
18, 39, 58, 302, 7, 6, 33, 70, 21, 2,
5, 1, 1, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 302, 302, 302, 302, 302
};
register int hval = len;
switch (hval)
{
default:
case 3:
hval += asso_values[(unsigned char)str[2]];
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
}
static struct resword wordlist[] =
{
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__real__", REALPART, NORID},
{"__signed__", TYPESPEC, RID_SIGNED},
{"", 0, 0}, {"", 0, 0},
{"__restrict__", TYPE_QUAL, RID_RESTRICT},
{"", 0, 0}, {"", 0, 0},
{"__extension__", EXTENSION, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"else", ELSE, NORID},
{"", 0, 0},
{"__imag__", IMAGPART, NORID},
{"", 0, 0},
{"__inline__", SCSPEC, RID_INLINE},
{"switch", SWITCH, NORID},
{"", 0, 0},
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
{"while", WHILE, NORID},
{"", 0, 0},
{"__inline", SCSPEC, RID_INLINE},
{"", 0, 0},
{"in", TYPE_QUAL, RID_IN},
{"__volatile", TYPE_QUAL, RID_VOLATILE},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__typeof__", TYPEOF, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__signed", TYPESPEC, RID_SIGNED},
{"", 0, 0},
{"__restrict", TYPE_QUAL, RID_RESTRICT},
{"struct", STRUCT, NORID},
{"", 0, 0},
{"restrict", TYPE_QUAL, RID_RESTRICT},
{"oneway", TYPE_QUAL, RID_ONEWAY},
{"id", OBJECTNAME, RID_ID},
{"", 0, 0}, {"", 0, 0},
{"sizeof", SIZEOF, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"for", FOR, NORID},
{"return", RETURN, NORID},
{"__bounded__", TYPE_QUAL, RID_BOUNDED},
{"extern", SCSPEC, RID_EXTERN},
{"break", BREAK, NORID},
{"if", IF, NORID},
{"", 0, 0}, {"", 0, 0},
{"__ptrbase__", PTR_BASE, NORID},
{"__ptrvalue__", PTR_VALUE, NORID},
{"__ptrextent__", PTR_EXTENT, NORID},
{"", 0, 0},
{"do", DO, NORID},
{"", 0, 0},
{"__ptrbase", PTR_BASE, NORID},
{"__ptrvalue", PTR_VALUE, NORID},
{"void", TYPESPEC, RID_VOID},
{"", 0, 0},
{"register", SCSPEC, RID_REGISTER},
{"", 0, 0},
{"short", TYPESPEC, RID_SHORT},
{"", 0, 0},
{"__unbounded__", TYPE_QUAL, RID_UNBOUNDED},
{"__imag", IMAGPART, NORID},
{"__asm__", ASM_KEYWORD, NORID},
{"__typeof", TYPEOF, NORID},
{"int", TYPESPEC, RID_INT},
{"", 0, 0},
{"__alignof__", ALIGNOF, NORID},
{"", 0, 0},
{"__attribute__", ATTRIBUTE, NORID},
{"", 0, 0}, {"", 0, 0},
{"__bounded", TYPE_QUAL, RID_BOUNDED},
{"inout", TYPE_QUAL, RID_INOUT},
{"", 0, 0},
{"__attribute", ATTRIBUTE, NORID},
{"enum", ENUM, NORID},
{"__asm", ASM_KEYWORD, NORID},
{"", 0, 0},
{"__ptrextent", PTR_EXTENT, NORID},
{"", 0, 0},
{"signed", TYPESPEC, RID_SIGNED},
{"", 0, 0}, {"", 0, 0},
{"out", TYPE_QUAL, RID_OUT},
{"", 0, 0},
{"byref", TYPE_QUAL, RID_BYREF},
{"", 0, 0}, {"", 0, 0},
{"union", UNION, NORID},
{"", 0, 0},
{"asm", ASM_KEYWORD, NORID},
{"__unbounded", TYPE_QUAL, RID_UNBOUNDED},
{"", 0, 0},
{"unsigned", TYPESPEC, RID_UNSIGNED},
{"double", TYPESPEC, RID_DOUBLE},
{"default", DEFAULT, NORID},
{"", 0, 0},
{"__const__", TYPE_QUAL, RID_CONST},
{"float", TYPESPEC, RID_FLOAT},
{"__complex__", TYPESPEC, RID_COMPLEX},
{"", 0, 0},
{"__complex", TYPESPEC, RID_COMPLEX},
{"", 0, 0},
{"__builtin_va_arg", VA_ARG, NORID},
{"__label__", LABEL, NORID},
{"case", CASE, NORID},
{"", 0, 0},
{"__real", REALPART, NORID},
{"@defs", DEFS, NORID},
{"__alignof", ALIGNOF, NORID},
{"goto", GOTO, NORID},
{"", 0, 0},
{"@private", PRIVATE, NORID},
{"@selector", SELECTOR, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"typeof", TYPEOF, NORID},
{"typedef", SCSPEC, RID_TYPEDEF},
{"", 0, 0},
{"continue", CONTINUE, NORID},
{"@encode", ENCODE, NORID},
{"", 0, 0}, {"", 0, 0},
{"@interface", INTERFACE, NORID},
{"", 0, 0},
{"__const", TYPE_QUAL, RID_CONST},
{"inline", SCSPEC, RID_INLINE},
{"auto", SCSPEC, RID_AUTO},
{"", 0, 0},
{"volatile", TYPE_QUAL, RID_VOLATILE},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@implementation", IMPLEMENTATION, NORID},
{"@protected", PROTECTED, NORID},
{"", 0, 0}, {"", 0, 0},
{"const", TYPE_QUAL, RID_CONST},
{"", 0, 0},
{"@end", END, NORID},
{"bycopy", TYPE_QUAL, RID_BYCOPY},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@compatibility_alias", ALIAS, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0},
{"long", TYPESPEC, RID_LONG},
{"char", TYPESPEC, RID_CHAR},
{"static", SCSPEC, RID_STATIC},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@class", CLASS, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@protocol", PROTOCOL, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@public", PUBLIC, NORID}
};
#ifdef __GNUC__
__inline
#endif
struct resword *
is_reserved_word (str, len)
register const char *str;
register unsigned int len;
{
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
register const char *s = wordlist[key].name;
if (*str == *s && !strcmp (str + 1, s + 1))
return &wordlist[key];
}
}
return 0;
}

View File

@ -37,9 +37,7 @@ static int c_tree_printer PARAMS ((output_buffer *));
#if USE_CPPLIB #if USE_CPPLIB
#include "cpplib.h" #include "cpplib.h"
extern char *yy_cur;
extern cpp_reader parse_in; extern cpp_reader parse_in;
extern cpp_options parse_options;
#endif #endif
/* Each of the functions defined here /* Each of the functions defined here
@ -57,9 +55,8 @@ void
lang_init_options () lang_init_options ()
{ {
#if USE_CPPLIB #if USE_CPPLIB
cpp_init ();
cpp_reader_init (&parse_in); cpp_reader_init (&parse_in);
parse_in.opts = &parse_options;
cpp_options_init (&parse_options);
#endif #endif
/* Mark as "unspecified". */ /* Mark as "unspecified". */
flag_bounds_check = -1; flag_bounds_check = -1;
@ -86,10 +83,7 @@ lang_init ()
and put it in input_filename. */ and put it in input_filename. */
#if !USE_CPPLIB #if !USE_CPPLIB
ungetc (check_newline (), finput); ungetc (check_newline (), finput);
#else #endif
check_newline ();
yy_cur--;
#endif
save_lang_status = &push_c_function_context; save_lang_status = &push_c_function_context;
restore_lang_status = &pop_c_function_context; restore_lang_status = &pop_c_function_context;

File diff suppressed because it is too large Load Diff

View File

@ -18,16 +18,20 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
extern char *token_buffer; /* Pointer to token buffer. */ #ifndef _C_LEX_H
#define _C_LEX_H
extern tree make_pointer_declarator PARAMS ((tree, tree)); extern tree make_pointer_declarator PARAMS ((tree, tree));
extern void reinit_parse_for_function PARAMS ((void));
extern void position_after_white_space PARAMS ((void)); extern void position_after_white_space PARAMS ((void));
extern int check_newline PARAMS ((void)); extern int check_newline PARAMS ((void));
extern int yylex PARAMS ((void)); extern int c_lex PARAMS ((tree *));
extern void yyerror PARAMS ((const char *)); extern const char *init_c_lex PARAMS ((const char *));
extern void forget_protocol_qualifiers PARAMS ((void)); extern void forget_protocol_qualifiers PARAMS ((void));
extern void remember_protocol_qualifiers PARAMS ((void)); extern void remember_protocol_qualifiers PARAMS ((void));
extern tree is_class_name PARAMS ((tree)); extern tree is_class_name PARAMS ((tree));
extern int indent_level;
#endif

View File

@ -1,105 +0,0 @@
%{
/* Command-line: gperf -L C -F ', 0, 0' -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
%}
struct resword { const char *name; short token; enum rid rid; };
#ifdef __GNUC__
__inline
#endif
static unsigned int hash PARAMS ((const char *, unsigned int));
#ifdef __GNUC__
__inline
#endif
struct resword *is_reserved_word PARAMS ((const char *, unsigned int));
%%
@class, CLASS, NORID
@compatibility_alias, ALIAS, NORID
@defs, DEFS, NORID
@encode, ENCODE, NORID
@end, END, NORID
@implementation, IMPLEMENTATION, NORID
@interface, INTERFACE, NORID
@private, PRIVATE, NORID
@protected, PROTECTED, NORID
@protocol, PROTOCOL, NORID
@public, PUBLIC, NORID
@selector, SELECTOR, NORID
__alignof, ALIGNOF, NORID
__alignof__, ALIGNOF, NORID
__asm, ASM_KEYWORD, NORID
__asm__, ASM_KEYWORD, NORID
__attribute, ATTRIBUTE, NORID
__attribute__, ATTRIBUTE, NORID
__bounded, TYPE_QUAL, RID_BOUNDED
__bounded__, TYPE_QUAL, RID_BOUNDED
__builtin_va_arg, VA_ARG, NORID
__complex, TYPESPEC, RID_COMPLEX
__complex__, TYPESPEC, RID_COMPLEX
__const, TYPE_QUAL, RID_CONST
__const__, TYPE_QUAL, RID_CONST
__extension__, EXTENSION, NORID
__imag, IMAGPART, NORID
__imag__, IMAGPART, NORID
__inline, SCSPEC, RID_INLINE
__inline__, SCSPEC, RID_INLINE
__label__, LABEL, NORID
__ptrbase, PTR_BASE, NORID
__ptrbase__, PTR_BASE, NORID
__ptrextent, PTR_EXTENT, NORID
__ptrextent__, PTR_EXTENT, NORID
__ptrvalue, PTR_VALUE, NORID
__ptrvalue__, PTR_VALUE, NORID
__real, REALPART, NORID
__real__, REALPART, NORID
__restrict, TYPE_QUAL, RID_RESTRICT
__restrict__, TYPE_QUAL, RID_RESTRICT
__signed, TYPESPEC, RID_SIGNED
__signed__, TYPESPEC, RID_SIGNED
__typeof, TYPEOF, NORID
__typeof__, TYPEOF, NORID
__unbounded, TYPE_QUAL, RID_UNBOUNDED
__unbounded__, TYPE_QUAL, RID_UNBOUNDED
__volatile, TYPE_QUAL, RID_VOLATILE
__volatile__, TYPE_QUAL, RID_VOLATILE
asm, ASM_KEYWORD, NORID
auto, SCSPEC, RID_AUTO
break, BREAK, NORID
bycopy, TYPE_QUAL, RID_BYCOPY
byref, TYPE_QUAL, RID_BYREF
case, CASE, NORID
char, TYPESPEC, RID_CHAR
const, TYPE_QUAL, RID_CONST
continue, CONTINUE, NORID
default, DEFAULT, NORID
do, DO, NORID
double, TYPESPEC, RID_DOUBLE
else, ELSE, NORID
enum, ENUM, NORID
extern, SCSPEC, RID_EXTERN
float, TYPESPEC, RID_FLOAT
for, FOR, NORID
goto, GOTO, NORID
id, OBJECTNAME, RID_ID
if, IF, NORID
in, TYPE_QUAL, RID_IN
inout, TYPE_QUAL, RID_INOUT
inline, SCSPEC, RID_INLINE
int, TYPESPEC, RID_INT
long, TYPESPEC, RID_LONG
oneway, TYPE_QUAL, RID_ONEWAY
out, TYPE_QUAL, RID_OUT
register, SCSPEC, RID_REGISTER
restrict, TYPE_QUAL, RID_RESTRICT
return, RETURN, NORID
short, TYPESPEC, RID_SHORT
signed, TYPESPEC, RID_SIGNED
sizeof, SIZEOF, NORID
static, SCSPEC, RID_STATIC
struct, STRUCT, NORID
switch, SWITCH, NORID
typedef, SCSPEC, RID_TYPEDEF
typeof, TYPEOF, NORID
union, UNION, NORID
unsigned, TYPESPEC, RID_UNSIGNED
void, TYPESPEC, RID_VOID
volatile, TYPE_QUAL, RID_VOLATILE
while, WHILE, NORID

View File

@ -43,6 +43,7 @@ end ifc
#include "input.h" #include "input.h"
#include "c-lex.h" #include "c-lex.h"
#include "c-tree.h" #include "c-tree.h"
#include "c-pragma.h"
#include "flags.h" #include "flags.h"
#include "output.h" #include "output.h"
#include "toplev.h" #include "toplev.h"
@ -117,9 +118,6 @@ end ifc
%token REALPART IMAGPART VA_ARG %token REALPART IMAGPART VA_ARG
%token PTR_VALUE PTR_BASE PTR_EXTENT %token PTR_VALUE PTR_BASE PTR_EXTENT
/* Used in c-lex.c for parsing pragmas. */
%token END_OF_LINE
/* Add precedence rules to solve dangling else s/r conflict */ /* Add precedence rules to solve dangling else s/r conflict */
%nonassoc IF %nonassoc IF
%nonassoc ELSE %nonassoc ELSE
@ -155,6 +153,8 @@ end ifc
%type <code> unop %type <code> unop
%type <ttype> ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
%type <ttype> BREAK CONTINUE RETURN GOTO ASM_KEYWORD SIZEOF TYPEOF ALIGNOF
%type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
%type <ttype> expr_no_commas cast_expr unary_expr primary string STRING %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
@ -254,7 +254,12 @@ end ifobjc
/* Tell yyparse how to print a token's value, if yydebug is set. */ /* Tell yyparse how to print a token's value, if yydebug is set. */
#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL) #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
static void yyprint PARAMS ((FILE *, int, YYSTYPE));
static void yyerror PARAMS ((const char *));
static inline int _yylex PARAMS ((void));
static int yylex PARAMS ((void));
static void init_reswords PARAMS ((void));
/* Add GC roots for variables local to this file. */ /* Add GC roots for variables local to this file. */
void void
@ -351,7 +356,7 @@ fndef:
{ if (! start_function (current_declspecs, $3, { if (! start_function (current_declspecs, $3,
prefix_attributes, NULL_TREE)) prefix_attributes, NULL_TREE))
YYERROR1; YYERROR1;
reinit_parse_for_function (); } }
old_style_parm_decls old_style_parm_decls
{ store_parm_decls (); } { store_parm_decls (); }
compstmt_or_error compstmt_or_error
@ -367,7 +372,7 @@ fndef:
{ if (! start_function (current_declspecs, $3, { if (! start_function (current_declspecs, $3,
prefix_attributes, NULL_TREE)) prefix_attributes, NULL_TREE))
YYERROR1; YYERROR1;
reinit_parse_for_function (); } }
old_style_parm_decls old_style_parm_decls
{ store_parm_decls (); } { store_parm_decls (); }
compstmt_or_error compstmt_or_error
@ -383,7 +388,7 @@ fndef:
{ if (! start_function (NULL_TREE, $2, { if (! start_function (NULL_TREE, $2,
prefix_attributes, NULL_TREE)) prefix_attributes, NULL_TREE))
YYERROR1; YYERROR1;
reinit_parse_for_function (); } }
old_style_parm_decls old_style_parm_decls
{ store_parm_decls (); } { store_parm_decls (); }
compstmt_or_error compstmt_or_error
@ -1178,7 +1183,7 @@ nested_function:
pop_function_context (); pop_function_context ();
YYERROR1; YYERROR1;
} }
reinit_parse_for_function (); } }
old_style_parm_decls old_style_parm_decls
{ store_parm_decls (); } { store_parm_decls (); }
/* This used to use compstmt_or_error. /* This used to use compstmt_or_error.
@ -1204,7 +1209,7 @@ notype_nested_function:
pop_function_context (); pop_function_context ();
YYERROR1; YYERROR1;
} }
reinit_parse_for_function (); } }
old_style_parm_decls old_style_parm_decls
{ store_parm_decls (); } { store_parm_decls (); }
/* This used to use compstmt_or_error. /* This used to use compstmt_or_error.
@ -1696,8 +1701,7 @@ if_prefix:
compstmt_count); compstmt_count);
$<itype>$ = stmt_count; $<itype>$ = stmt_count;
if_stmt_file = $<filename>-1; if_stmt_file = $<filename>-1;
if_stmt_line = $<lineno>0; if_stmt_line = $<lineno>0; }
position_after_white_space (); }
; ;
/* This is a subroutine of stmt. /* This is a subroutine of stmt.
@ -1710,18 +1714,24 @@ do_stmt_start:
emit_line_note ($<filename>-1, $<lineno>0); emit_line_note ($<filename>-1, $<lineno>0);
/* See comment in `while' alternative, above. */ /* See comment in `while' alternative, above. */
emit_nop (); emit_nop ();
expand_start_loop_continue_elsewhere (1); expand_start_loop_continue_elsewhere (1); }
position_after_white_space (); }
lineno_labeled_stmt WHILE lineno_labeled_stmt WHILE
{ expand_loop_continue_here (); } { expand_loop_continue_here (); }
; ;
/* The forced readahead in here is because we might be at the end of a
line, and the line and file won't be bumped until yylex absorbs the
first token on the next line. */
save_filename: save_filename:
{ $$ = input_filename; } { if (yychar == YYEMPTY)
yychar = YYLEX;
$$ = input_filename; }
; ;
save_lineno: save_lineno:
{ $$ = lineno; } { if (yychar == YYEMPTY)
yychar = YYLEX;
$$ = lineno; }
; ;
lineno_labeled_stmt: lineno_labeled_stmt:
@ -1768,8 +1778,7 @@ stmt:
expand_expr_stmt ($1); } expand_expr_stmt ($1); }
| simple_if ELSE | simple_if ELSE
{ c_expand_start_else (); { c_expand_start_else ();
$<itype>1 = stmt_count; $<itype>1 = stmt_count; }
position_after_white_space (); }
lineno_labeled_stmt lineno_labeled_stmt
{ c_expand_end_cond (); { c_expand_end_cond ();
if (extra_warnings && stmt_count == $<itype>1) if (extra_warnings && stmt_count == $<itype>1)
@ -1805,8 +1814,7 @@ stmt:
expand_start_loop (1); expand_start_loop (1);
emit_line_note (input_filename, lineno); emit_line_note (input_filename, lineno);
expand_exit_loop_if_false (NULL_PTR, expand_exit_loop_if_false (NULL_PTR,
truthvalue_conversion ($4)); truthvalue_conversion ($4)); }
position_after_white_space (); }
lineno_labeled_stmt lineno_labeled_stmt
{ expand_end_loop (); } { expand_end_loop (); }
| do_stmt_start | do_stmt_start
@ -1845,8 +1853,7 @@ stmt:
expand_exit_loop_if_false (NULL_PTR, expand_exit_loop_if_false (NULL_PTR,
truthvalue_conversion ($6)); truthvalue_conversion ($6));
$<lineno>7 = lineno; $<lineno>7 = lineno;
$<filename>8 = input_filename; $<filename>8 = input_filename; }
position_after_white_space (); }
lineno_labeled_stmt lineno_labeled_stmt
{ /* Emit the increment expression, with a line number. */ { /* Emit the increment expression, with a line number. */
emit_line_note ($<filename>8, $<lineno>7); emit_line_note ($<filename>8, $<lineno>7);
@ -1857,8 +1864,7 @@ stmt:
| SWITCH '(' expr ')' | SWITCH '(' expr ')'
{ stmt_count++; { stmt_count++;
emit_line_note ($<filename>-1, $<lineno>0); emit_line_note ($<filename>-1, $<lineno>0);
c_expand_start_case ($3); c_expand_start_case ($3); }
position_after_white_space (); }
lineno_labeled_stmt lineno_labeled_stmt
{ expand_end_case ($3); } { expand_end_case ($3); }
| BREAK ';' | BREAK ';'
@ -1937,22 +1943,19 @@ label: CASE expr_no_commas ':'
{ tree case_label_tree = build_case_label ($2, NULL_TREE); { tree case_label_tree = build_case_label ($2, NULL_TREE);
stmt_count++; stmt_count++;
genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree)); genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree));
position_after_white_space ();
} }
| CASE expr_no_commas ELLIPSIS expr_no_commas ':' | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
{ tree case_label_tree = build_case_label ($2, $4); { tree case_label_tree = build_case_label ($2, $4);
stmt_count++; stmt_count++;
genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree)); genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree));
position_after_white_space ();
} }
| DEFAULT ':' | DEFAULT ':'
{ tree case_label_tree = build_case_label (NULL_TREE, NULL_TREE); { tree case_label_tree = build_case_label (NULL_TREE, NULL_TREE);
stmt_count++; stmt_count++;
genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree)); genrtl_case_label(CASE_LOW(case_label_tree), CASE_HIGH(case_label_tree));
position_after_white_space ();
} }
| identifier ':' save_filename save_lineno maybe_attribute | identifier save_filename save_lineno ':' maybe_attribute
{ tree label = define_label ($3, $4, $1); { tree label = define_label ($2, $3, $1);
stmt_count++; stmt_count++;
emit_nop (); emit_nop ();
if (label) if (label)
@ -1960,7 +1963,7 @@ label: CASE expr_no_commas ':'
expand_label (label); expand_label (label);
decl_attributes (label, $5, NULL_TREE); decl_attributes (label, $5, NULL_TREE);
} }
position_after_white_space (); } }
; ;
/* Either a type-qualifier or nothing. First thing in an `asm' statement. */ /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
@ -2658,25 +2661,9 @@ selector:
; ;
reservedwords: reservedwords:
ENUM { $$ = get_identifier (token_buffer); } ENUM | STRUCT | UNION | IF | ELSE | WHILE | DO | FOR
| STRUCT { $$ = get_identifier (token_buffer); } | SWITCH | CASE | DEFAULT | BREAK | CONTINUE | RETURN
| UNION { $$ = get_identifier (token_buffer); } | GOTO | ASM_KEYWORD | SIZEOF | TYPEOF | ALIGNOF
| IF { $$ = get_identifier (token_buffer); }
| ELSE { $$ = get_identifier (token_buffer); }
| WHILE { $$ = get_identifier (token_buffer); }
| DO { $$ = get_identifier (token_buffer); }
| FOR { $$ = get_identifier (token_buffer); }
| SWITCH { $$ = get_identifier (token_buffer); }
| CASE { $$ = get_identifier (token_buffer); }
| DEFAULT { $$ = get_identifier (token_buffer); }
| BREAK { $$ = get_identifier (token_buffer); }
| CONTINUE { $$ = get_identifier (token_buffer); }
| RETURN { $$ = get_identifier (token_buffer); }
| GOTO { $$ = get_identifier (token_buffer); }
| ASM_KEYWORD { $$ = get_identifier (token_buffer); }
| SIZEOF { $$ = get_identifier (token_buffer); }
| TYPEOF { $$ = get_identifier (token_buffer); }
| ALIGNOF { $$ = get_identifier (token_buffer); }
| TYPESPEC | TYPE_QUAL | TYPESPEC | TYPE_QUAL
; ;
@ -2807,3 +2794,606 @@ objcencodeexpr:
end ifobjc end ifobjc
%% %%
/* yylex() is a thin wrapper around c_lex(), all it does is translate
cpplib.h's token codes into yacc's token codes. */
#include "cpplib.h"
#include "intl.h"
#include "timevar.h"
static enum cpp_ttype last_token;
#if USE_CPPLIB
extern cpp_reader parse_in;
#endif
/* The reserved keyword table. */
struct resword
{
const char *word;
ENUM_BITFIELD(rid) rid : 16;
unsigned int disable : 16;
};
/* Disable mask. Keywords are disabled if (reswords[i].disable & mask) is
_true_. */
#define D_TRAD 0x01 /* not in traditional C */
#define D_C89 0x02 /* not in C89 */
#define D_EXT 0x04 /* GCC extension */
#define D_EXT89 0x08 /* GCC extension incorporated in C99 */
#define D_OBJC 0x10 /* Objective C only */
#define D_YES 0x20 /* always starts disabled */
static const struct resword reswords[] =
{
{ "__alignof", RID_ALIGNOF, 0 },
{ "__alignof__", RID_ALIGNOF, 0 },
{ "__asm", RID_ASM, 0 },
{ "__asm__", RID_ASM, 0 },
{ "__attribute", RID_ATTRIBUTE, 0 },
{ "__attribute__", RID_ATTRIBUTE, 0 },
{ "__bounded", RID_BOUNDED, 0 },
{ "__bounded__", RID_BOUNDED, 0 },
{ "__builtin_va_arg", RID_VA_ARG, 0 },
{ "__complex", RID_COMPLEX, 0 },
{ "__complex__", RID_COMPLEX, 0 },
{ "__const", RID_CONST, 0 },
{ "__const__", RID_CONST, 0 },
{ "__extension__", RID_EXTENSION, 0 },
{ "__imag", RID_IMAGPART, 0 },
{ "__imag__", RID_IMAGPART, 0 },
{ "__inline", RID_INLINE, 0 },
{ "__inline__", RID_INLINE, 0 },
{ "__label__", RID_LABEL, 0 },
{ "__ptrbase", RID_PTRBASE, 0 },
{ "__ptrbase__", RID_PTRBASE, 0 },
{ "__ptrextent", RID_PTREXTENT, 0 },
{ "__ptrextent__", RID_PTREXTENT, 0 },
{ "__ptrvalue", RID_PTRVALUE, 0 },
{ "__ptrvalue__", RID_PTRVALUE, 0 },
{ "__real", RID_REALPART, 0 },
{ "__real__", RID_REALPART, 0 },
{ "__restrict", RID_RESTRICT, 0 },
{ "__restrict__", RID_RESTRICT, 0 },
{ "__signed", RID_SIGNED, 0 },
{ "__signed__", RID_SIGNED, 0 },
{ "__typeof", RID_TYPEOF, 0 },
{ "__typeof__", RID_TYPEOF, 0 },
{ "__unbounded", RID_UNBOUNDED, 0 },
{ "__unbounded__", RID_UNBOUNDED, 0 },
{ "__volatile", RID_VOLATILE, 0 },
{ "__volatile__", RID_VOLATILE, 0 },
{ "asm", RID_ASM, D_EXT },
{ "auto", RID_AUTO, 0 },
{ "break", RID_BREAK, 0 },
{ "case", RID_CASE, 0 },
{ "char", RID_CHAR, 0 },
{ "const", RID_CONST, D_TRAD },
{ "continue", RID_CONTINUE, 0 },
{ "default", RID_DEFAULT, 0 },
{ "do", RID_DO, 0 },
{ "double", RID_DOUBLE, 0 },
{ "else", RID_ELSE, 0 },
{ "enum", RID_ENUM, 0 },
{ "extern", RID_EXTERN, 0 },
{ "float", RID_FLOAT, 0 },
{ "for", RID_FOR, 0 },
{ "goto", RID_GOTO, 0 },
{ "if", RID_IF, 0 },
{ "inline", RID_INLINE, D_TRAD|D_EXT89 },
{ "int", RID_INT, 0 },
{ "long", RID_LONG, 0 },
{ "register", RID_REGISTER, 0 },
{ "restrict", RID_RESTRICT, D_TRAD|D_C89 },
{ "return", RID_RETURN, 0 },
{ "short", RID_SHORT, 0 },
{ "signed", RID_SIGNED, D_TRAD },
{ "sizeof", RID_SIZEOF, 0 },
{ "static", RID_STATIC, 0 },
{ "struct", RID_STRUCT, 0 },
{ "switch", RID_SWITCH, 0 },
{ "typedef", RID_TYPEDEF, 0 },
{ "typeof", RID_TYPEOF, D_TRAD|D_EXT },
{ "union", RID_UNION, 0 },
{ "unsigned", RID_UNSIGNED, 0 },
{ "void", RID_VOID, 0 },
{ "volatile", RID_VOLATILE, D_TRAD },
{ "while", RID_WHILE, 0 },
ifobjc
{ "@class", RID_AT_CLASS, D_OBJC },
{ "@compatibility_alias", RID_AT_ALIAS, D_OBJC },
{ "@defs", RID_AT_DEFS, D_OBJC },
{ "@encode", RID_AT_ENCODE, D_OBJC },
{ "@end", RID_AT_END, D_OBJC },
{ "@implementation", RID_AT_IMPLEMENTATION, D_OBJC },
{ "@interface", RID_AT_INTERFACE, D_OBJC },
{ "@private", RID_AT_PRIVATE, D_OBJC },
{ "@protected", RID_AT_PROTECTED, D_OBJC },
{ "@protocol", RID_AT_PROTOCOL, D_OBJC },
{ "@public", RID_AT_PUBLIC, D_OBJC },
{ "@selector", RID_AT_SELECTOR, D_OBJC },
{ "id", RID_ID, D_OBJC },
{ "bycopy", RID_BYCOPY, D_OBJC|D_YES },
{ "byref", RID_BYREF, D_OBJC|D_YES },
{ "in", RID_IN, D_OBJC|D_YES },
{ "inout", RID_INOUT, D_OBJC|D_YES },
{ "oneway", RID_ONEWAY, D_OBJC|D_YES },
{ "out", RID_OUT, D_OBJC|D_YES },
end ifobjc
};
#define N_reswords (sizeof reswords / sizeof (struct resword))
/* Table mapping from RID_* constants to yacc token numbers.
Unfortunately we have to have entries for all the keywords in all
three languages. */
static const short rid_to_yy[RID_MAX] =
{
/* RID_STATIC */ SCSPEC,
/* RID_UNSIGNED */ TYPESPEC,
/* RID_LONG */ TYPESPEC,
/* RID_CONST */ TYPE_QUAL,
/* RID_EXTERN */ SCSPEC,
/* RID_REGISTER */ SCSPEC,
/* RID_TYPEDEF */ SCSPEC,
/* RID_SHORT */ TYPESPEC,
/* RID_INLINE */ SCSPEC,
/* RID_VOLATILE */ TYPE_QUAL,
/* RID_SIGNED */ TYPESPEC,
/* RID_AUTO */ SCSPEC,
/* RID_RESTRICT */ TYPE_QUAL,
/* C extensions */
/* RID_BOUNDED */ TYPE_QUAL,
/* RID_UNBOUNDED */ TYPE_QUAL,
/* RID_COMPLEX */ TYPESPEC,
/* C++ */
/* RID_FRIEND */ 0,
/* RID_VIRTUAL */ 0,
/* RID_EXPLICIT */ 0,
/* RID_EXPORT */ 0,
/* RID_MUTABLE */ 0,
/* ObjC */
/* RID_IN */ TYPE_QUAL,
/* RID_OUT */ TYPE_QUAL,
/* RID_INOUT */ TYPE_QUAL,
/* RID_BYCOPY */ TYPE_QUAL,
/* RID_BYREF */ TYPE_QUAL,
/* RID_ONEWAY */ TYPE_QUAL,
/* C */
/* RID_INT */ TYPESPEC,
/* RID_CHAR */ TYPESPEC,
/* RID_FLOAT */ TYPESPEC,
/* RID_DOUBLE */ TYPESPEC,
/* RID_VOID */ TYPESPEC,
/* RID_ENUM */ ENUM,
/* RID_STRUCT */ STRUCT,
/* RID_UNION */ UNION,
/* RID_IF */ IF,
/* RID_ELSE */ ELSE,
/* RID_WHILE */ WHILE,
/* RID_DO */ DO,
/* RID_FOR */ FOR,
/* RID_SWITCH */ SWITCH,
/* RID_CASE */ CASE,
/* RID_DEFAULT */ DEFAULT,
/* RID_BREAK */ BREAK,
/* RID_CONTINUE */ CONTINUE,
/* RID_RETURN */ RETURN,
/* RID_GOTO */ GOTO,
/* RID_SIZEOF */ SIZEOF,
/* C extensions */
/* RID_ASM */ ASM_KEYWORD,
/* RID_TYPEOF */ TYPEOF,
/* RID_ALIGNOF */ ALIGNOF,
/* RID_ATTRIBUTE */ ATTRIBUTE,
/* RID_VA_ARG */ VA_ARG,
/* RID_EXTENSION */ EXTENSION,
/* RID_IMAGPART */ IMAGPART,
/* RID_REALPART */ REALPART,
/* RID_LABEL */ LABEL,
/* RID_PTRBASE */ PTR_BASE,
/* RID_PTREXTENT */ PTR_EXTENT,
/* RID_PTRVALUE */ PTR_VALUE,
/* C++ */
/* RID_BOOL */ 0,
/* RID_WCHAR */ 0,
/* RID_CLASS */ 0,
/* RID_PUBLIC */ 0,
/* RID_PRIVATE */ 0,
/* RID_PROTECTED */ 0,
/* RID_TEMPLATE */ 0,
/* RID_NULL */ 0,
/* RID_CATCH */ 0,
/* RID_DELETE */ 0,
/* RID_FALSE */ 0,
/* RID_NAMESPACE */ 0,
/* RID_NEW */ 0,
/* RID_OPERATOR */ 0,
/* RID_THIS */ 0,
/* RID_THROW */ 0,
/* RID_TRUE */ 0,
/* RID_TRY */ 0,
/* RID_TYPENAME */ 0,
/* RID_TYPEID */ 0,
/* RID_USING */ 0,
/* casts */
/* RID_CONSTCAST */ 0,
/* RID_DYNCAST */ 0,
/* RID_REINTCAST */ 0,
/* RID_STATCAST */ 0,
/* alternate spellings */
/* RID_AND */ 0,
/* RID_AND_EQ */ 0,
/* RID_NOT */ 0,
/* RID_NOT_EQ */ 0,
/* RID_OR */ 0,
/* RID_OR_EQ */ 0,
/* RID_XOR */ 0,
/* RID_XOR_EQ */ 0,
/* RID_BITAND */ 0,
/* RID_BITOR */ 0,
/* RID_COMPL */ 0,
/* Objective C */
/* RID_ID */ OBJECTNAME,
/* RID_AT_ENCODE */ ENCODE,
/* RID_AT_END */ END,
/* RID_AT_CLASS */ CLASS,
/* RID_AT_ALIAS */ ALIAS,
/* RID_AT_DEFS */ DEFS,
/* RID_AT_PRIVATE */ PRIVATE,
/* RID_AT_PROTECTED */ PROTECTED,
/* RID_AT_PUBLIC */ PUBLIC,
/* RID_AT_PROTOCOL */ PROTOCOL,
/* RID_AT_SELECTOR */ SELECTOR,
/* RID_AT_INTERFACE */ INTERFACE,
/* RID_AT_IMPLEMENTATION */ IMPLEMENTATION
};
static void
init_reswords ()
{
unsigned int i;
tree id;
int mask = (D_YES
| (doing_objc_thang ? 0 : D_OBJC)
| (flag_isoc99 ? 0 : D_C89)
| (flag_traditional ? D_TRAD : 0)
| (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0));
/* It is not necessary to register ridpointers as a GC root, because
all the trees it points to are permanently interned in the
get_identifier hash anyway. */
ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
for (i = 0; i < N_reswords; i++)
{
id = get_identifier (reswords[i].word);
C_RID_CODE (id) = reswords[i].rid;
ridpointers [(int) reswords[i].rid] = id;
if (! (reswords[i].disable & mask))
C_IS_RESERVED_WORD (id) = 1;
}
}
const char *
init_parse (filename)
const char *filename;
{
add_c_tree_codes ();
/* Make identifier nodes long enough for the language-specific slots. */
set_identifier_size (sizeof (struct lang_identifier));
init_reswords ();
init_pragma ();
return init_c_lex (filename);
}
void
finish_parse ()
{
#if USE_CPPLIB
cpp_finish (&parse_in, 0 /* no printer */);
errorcount += parse_in.errors;
#else
fclose (finput);
#endif
}
#if USE_CPPLIB
#define NAME(type) cpp_type2name (type)
#else
/* Bleah */
#include "symcat.h"
#define OP(e, s) s,
#define TK(e, s) STRINGX(e),
static const char *type2name[N_TTYPES] = { TTYPE_TABLE };
#define NAME(type) type2name[type]
#endif
static void
yyerror (msgid)
const char *msgid;
{
const char *string = _(msgid);
if (last_token == CPP_EOF)
error ("%s at end of input", string);
else if (last_token == CPP_CHAR || last_token == CPP_WCHAR)
{
unsigned int val = TREE_INT_CST_LOW (yylval.ttype);
const char *ell = (last_token == CPP_CHAR) ? "" : "L";
if (val <= UCHAR_MAX && ISGRAPH (val))
error ("%s before %s'%c'", string, ell, val);
else
error ("%s before %s'\\x%x'", string, ell, val);
}
else if (last_token == CPP_STRING
|| last_token == CPP_WSTRING
|| last_token == CPP_OSTRING)
error ("%s before string constant", string);
else if (last_token == CPP_NUMBER
|| last_token == CPP_INT
|| last_token == CPP_FLOAT)
error ("%s before numeric constant", string);
else if (last_token == CPP_NAME)
error ("%s before \"%s\"", string, IDENTIFIER_POINTER (yylval.ttype));
else
error ("%s before '%s' token", string, NAME(last_token));
}
static inline int
_yylex ()
{
retry:
last_token = c_lex (&yylval.ttype);
switch (last_token)
{
case CPP_EQ: return '=';
case CPP_NOT: return '!';
case CPP_GREATER: yylval.code = GT_EXPR; return ARITHCOMPARE;
case CPP_LESS: yylval.code = LT_EXPR; return ARITHCOMPARE;
case CPP_PLUS: yylval.code = PLUS_EXPR; return '+';
case CPP_MINUS: yylval.code = MINUS_EXPR; return '-';
case CPP_MULT: yylval.code = MULT_EXPR; return '*';
case CPP_DIV: yylval.code = TRUNC_DIV_EXPR; return '/';
case CPP_MOD: yylval.code = TRUNC_MOD_EXPR; return '%';
case CPP_AND: yylval.code = BIT_AND_EXPR; return '&';
case CPP_OR: yylval.code = BIT_IOR_EXPR; return '|';
case CPP_XOR: yylval.code = BIT_XOR_EXPR; return '^';
case CPP_RSHIFT: yylval.code = RSHIFT_EXPR; return RSHIFT;
case CPP_LSHIFT: yylval.code = LSHIFT_EXPR; return LSHIFT;
case CPP_COMPL: return '~';
case CPP_AND_AND: return ANDAND;
case CPP_OR_OR: return OROR;
case CPP_QUERY: return '?';
case CPP_COLON: return ':';
case CPP_COMMA: return ',';
case CPP_OPEN_PAREN: return '(';
case CPP_CLOSE_PAREN: return ')';
case CPP_EQ_EQ: yylval.code = EQ_EXPR; return EQCOMPARE;
case CPP_NOT_EQ: yylval.code = NE_EXPR; return EQCOMPARE;
case CPP_GREATER_EQ:yylval.code = GE_EXPR; return ARITHCOMPARE;
case CPP_LESS_EQ: yylval.code = LE_EXPR; return ARITHCOMPARE;
case CPP_PLUS_EQ: yylval.code = PLUS_EXPR; return ASSIGN;
case CPP_MINUS_EQ: yylval.code = MINUS_EXPR; return ASSIGN;
case CPP_MULT_EQ: yylval.code = MULT_EXPR; return ASSIGN;
case CPP_DIV_EQ: yylval.code = TRUNC_DIV_EXPR; return ASSIGN;
case CPP_MOD_EQ: yylval.code = TRUNC_MOD_EXPR; return ASSIGN;
case CPP_AND_EQ: yylval.code = BIT_AND_EXPR; return ASSIGN;
case CPP_OR_EQ: yylval.code = BIT_IOR_EXPR; return ASSIGN;
case CPP_XOR_EQ: yylval.code = BIT_XOR_EXPR; return ASSIGN;
case CPP_RSHIFT_EQ: yylval.code = RSHIFT_EXPR; return ASSIGN;
case CPP_LSHIFT_EQ: yylval.code = LSHIFT_EXPR; return ASSIGN;
case CPP_OPEN_SQUARE: return '[';
case CPP_CLOSE_SQUARE: return ']';
case CPP_OPEN_BRACE: return '{';
case CPP_CLOSE_BRACE: return '}';
case CPP_SEMICOLON: return ';';
case CPP_ELLIPSIS: return ELLIPSIS;
case CPP_PLUS_PLUS: return PLUSPLUS;
case CPP_MINUS_MINUS: return MINUSMINUS;
case CPP_DEREF: return POINTSAT;
case CPP_DOT: return '.';
case CPP_EOF:
#if USE_CPPLIB
cpp_pop_buffer (&parse_in);
if (! CPP_BUFFER (&parse_in))
#endif
return 0;
goto retry;
case CPP_NAME:
if (C_IS_RESERVED_WORD (yylval.ttype))
return rid_to_yy[C_RID_CODE (yylval.ttype)];
if (IDENTIFIER_POINTER (yylval.ttype)[0] == '@')
{
error ("invalid identifier `%s'", IDENTIFIER_POINTER (yylval.ttype));
return IDENTIFIER;
}
{
tree decl;
decl = lookup_name (yylval.ttype);
if (decl)
{
if (TREE_CODE (decl) == TYPE_DECL)
return TYPENAME;
/* A user-invisible read-only initialized variable
should be replaced by its value.
We handle only strings since that's the only case used in C. */
else if (TREE_CODE (decl) == VAR_DECL
&& DECL_IGNORED_P (decl)
&& TREE_READONLY (decl)
&& DECL_INITIAL (decl) != 0
&& TREE_CODE (DECL_INITIAL (decl)) == STRING_CST)
{
tree stringval = DECL_INITIAL (decl);
/* Copy the string value so that we won't clobber anything
if we put something in the TREE_CHAIN of this one. */
yylval.ttype = build_string (TREE_STRING_LENGTH (stringval),
TREE_STRING_POINTER (stringval));
return STRING;
}
}
else if (doing_objc_thang)
{
tree objc_interface_decl = is_class_name (yylval.ttype);
if (objc_interface_decl)
{
yylval.ttype = objc_interface_decl;
return CLASSNAME;
}
}
return IDENTIFIER;
}
case CPP_INT:
case CPP_FLOAT:
case CPP_NUMBER:
case CPP_CHAR:
case CPP_WCHAR:
return CONSTANT;
case CPP_STRING:
case CPP_WSTRING:
return STRING;
case CPP_OSTRING:
return OBJC_STRING;
/* These tokens are C++ specific (and will not be generated
in C mode, but let's be cautious). */
case CPP_SCOPE:
case CPP_DEREF_STAR:
case CPP_DOT_STAR:
case CPP_MIN_EQ:
case CPP_MAX_EQ:
case CPP_MIN:
case CPP_MAX:
/* These tokens should not survive translation phase 4. */
case CPP_HASH:
case CPP_PASTE:
case CPP_BACKSLASH:
error ("syntax error before '%s' token", NAME(last_token));
goto retry;
default:
abort ();
}
/* NOTREACHED */
}
static int
yylex()
{
int r;
timevar_push (TV_LEX);
r = _yylex();
timevar_pop (TV_LEX);
return r;
}
/* Sets the value of the 'yydebug' variable to VALUE.
This is a function so we don't have to have YYDEBUG defined
in order to build the compiler. */
void
set_yydebug (value)
int value;
{
#if YYDEBUG != 0
yydebug = value;
#else
warning ("YYDEBUG not defined.");
#endif
}
/* Function used when yydebug is set, to print a token in more detail. */
static void
yyprint (file, yychar, yyl)
FILE *file;
int yychar;
YYSTYPE yyl;
{
tree t = yyl.ttype;
fprintf (file, " [%s]", NAME(last_token));
switch (yychar)
{
case IDENTIFIER:
case TYPENAME:
case OBJECTNAME:
case TYPESPEC:
case TYPE_QUAL:
case SCSPEC:
if (IDENTIFIER_POINTER (t))
fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
break;
case CONSTANT:
fprintf (file, " %s", GET_MODE_NAME (TYPE_MODE (TREE_TYPE (t))));
if (TREE_CODE (t) == INTEGER_CST)
fprintf (file,
#if HOST_BITS_PER_WIDE_INT == 64
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
" 0x%x%016x",
#else
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
" 0x%lx%016lx",
#else
" 0x%llx%016llx",
#endif
#endif
#else
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%08lx",
#else
" 0x%x%08x",
#endif
#endif
TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
break;
}
}
/* This is not the ideal place to put these, but we have to get them out
of c-lex.c because cp/lex.c has its own versions. */
/* Return something to represent absolute declarators containing a *.
TARGET is the absolute declarator that the * contains.
TYPE_QUALS is a list of modifiers such as const or volatile
to apply to the pointer type, represented as identifiers.
We return an INDIRECT_REF whose "contents" are TARGET
and whose type is the modifier list. */
tree
make_pointer_declarator (type_quals, target)
tree type_quals, target;
{
return build1 (INDIRECT_REF, type_quals, target);
}

View File

@ -28,9 +28,28 @@ Boston, MA 02111-1307, USA. */
#include "flags.h" #include "flags.h"
#include "toplev.h" #include "toplev.h"
#include "ggc.h" #include "ggc.h"
#include "c-lex.h"
#include "cpplib.h"
#ifdef HANDLE_GENERIC_PRAGMAS #ifdef HANDLE_GENERIC_PRAGMAS
#if USE_CPPLIB
extern cpp_reader parse_in;
#else
struct pragma_entry;
static struct pragma_entry *pragmas;
void cpp_register_pragma PARAMS ((cpp_reader *, const char *, const char *,
void (*) PARAMS ((cpp_reader *)) ));
void cpp_register_pragma_space PARAMS ((cpp_reader *, const char *));
#endif
#define BAD(msgid) do { warning (msgid); return; } while (0)
#define BAD2(msgid, arg) do { warning (msgid, arg); return; } while (0)
#ifdef HANDLE_PRAGMA_PACK
static void handle_pragma_pack PARAMS ((cpp_reader *));
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP #ifdef HANDLE_PRAGMA_PACK_PUSH_POP
typedef struct align_stack typedef struct align_stack
{ {
@ -48,34 +67,19 @@ static struct align_stack * alignment_stack = NULL;
happens, we restore the value to this, not to a value of 0 for happens, we restore the value to this, not to a value of 0 for
maximum_field_alignment. Value is in bits. */ maximum_field_alignment. Value is in bits. */
static int default_alignment; static int default_alignment;
#define SET_GLOBAL_ALIGNMENT(ALIGN) \
(default_alignment = maximum_field_alignment = (ALIGN))
static int push_alignment PARAMS ((int, tree)); static void push_alignment PARAMS ((int, tree));
static int pop_alignment PARAMS ((tree)); static void pop_alignment PARAMS ((tree));
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
static void mark_align_stack PARAMS ((void *)); static void mark_align_stack PARAMS ((void *));
#endif
/* Push an alignment value onto the stack. */ /* Push an alignment value onto the stack. */
static int static void
push_alignment (alignment, id) push_alignment (alignment, id)
int alignment; int alignment;
tree id; tree id;
{ {
switch (alignment)
{
case 0:
case 1:
case 2:
case 4:
case 8:
case 16:
break;
default:
warning ("\
Alignment must be a small power of two, not %d, in #pragma pack",
alignment);
return 0;
}
if (alignment_stack == NULL if (alignment_stack == NULL
|| alignment_stack->alignment != alignment || alignment_stack->alignment != alignment
@ -98,16 +102,14 @@ Alignment must be a small power of two, not %d, in #pragma pack",
alignment_stack = entry; alignment_stack = entry;
maximum_field_alignment = alignment * BITS_PER_UNIT; maximum_field_alignment = alignment;
} }
else else
alignment_stack->num_pushes ++; alignment_stack->num_pushes ++;
return 1;
} }
/* Undo a push of an alignment onto the stack. */ /* Undo a push of an alignment onto the stack. */
static int static void
pop_alignment (id) pop_alignment (id)
tree id; tree id;
{ {
@ -118,7 +120,7 @@ pop_alignment (id)
warning ("\ warning ("\
#pragma pack (pop) encountered without matching #pragma pack (push, <n>)" #pragma pack (pop) encountered without matching #pragma pack (push, <n>)"
); );
return 0; return;
} }
/* If we got an identifier, strip away everything above the target /* If we got an identifier, strip away everything above the target
@ -145,301 +147,14 @@ pop_alignment (id)
if (entry == NULL) if (entry == NULL)
maximum_field_alignment = default_alignment; maximum_field_alignment = default_alignment;
else else
maximum_field_alignment = entry->alignment * BITS_PER_UNIT; maximum_field_alignment = entry->alignment;
free (alignment_stack); free (alignment_stack);
alignment_stack = entry; alignment_stack = entry;
} }
return 1;
} }
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
/* Handle one token of a pragma directive. TOKEN is the current token, and
STRING is its printable form. Some front ends do not support generating
tokens, and will only pass in a STRING. Also some front ends will reuse
the buffer containing STRING, so it must be copied to a local buffer if
it needs to be preserved.
If STRING is non-NULL, then the return value will be ignored, and there
will be futher calls to handle_pragma_token in order to handle the rest of
the line containing the #pragma directive. If STRING is NULL, the entire
line has now been presented to handle_pragma_token and the return value
should be zero if the pragma flawed in some way, or if the pragma was not
recognised, and non-zero if it was successfully handled. */
int
handle_pragma_token (string, token)
const char *string;
tree token;
{
static enum pragma_state state = ps_start;
static enum pragma_state type;
#ifdef HANDLE_PRAGMA_WEAK
static char *name;
static char *value;
#endif
#if defined(HANDLE_PRAGMA_PACK) || defined(HANDLE_PRAGMA_PACK_PUSH_POP)
static unsigned int align;
#endif
static tree id;
/* If we have reached the end of the #pragma directive then
determine what value we should return. */
if (string == NULL)
{
int ret_val = 0;
switch (type)
{
default:
abort ();
break;
case ps_done:
/* The pragma was not recognised. */
break;
#ifdef HANDLE_PRAGMA_PACK
case ps_pack:
if (state == ps_right)
{
maximum_field_alignment = align * BITS_PER_UNIT;
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
default_alignment = maximum_field_alignment;
#endif
ret_val = 1;
}
else
warning ("malformed `#pragma pack'");
break;
#endif /* HANDLE_PRAGMA_PACK */
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
case ps_push:
if (state == ps_right)
ret_val = push_alignment (align, id);
else
warning ("malformed '#pragma pack(push[,id],<n>)'");
break;
case ps_pop:
if (state == ps_right)
ret_val = pop_alignment (id);
else
warning ("malformed '#pragma pack(pop[,id])'");
break;
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
#ifdef HANDLE_PRAGMA_WEAK
case ps_weak:
if (HANDLE_PRAGMA_WEAK)
{
if (state == ps_name)
ret_val = add_weak (name, NULL);
else if (state == ps_value)
ret_val = add_weak (name, value);
else
warning ("malformed `#pragma weak'");
}
else
ret_val = 1; /* Ignore the pragma. */
break;
#endif /* HANDLE_PRAGMA_WEAK */
case ps_poison:
ret_val = 1;
break;
}
type = state = ps_start;
id = NULL_TREE;
return ret_val;
}
/* If we have been given a token, but it is not an identifier,
or a small constant, then something has gone wrong. */
if (token)
{
switch (TREE_CODE (token))
{
case IDENTIFIER_NODE:
break;
case INTEGER_CST:
if (TREE_INT_CST_HIGH (token) != 0)
return 0;
break;
default:
return 0;
}
}
switch (state)
{
case ps_start:
type = state = ps_done;
#ifdef HANDLE_PRAGMA_PACK
if (strcmp (string, "pack") == 0)
type = state = ps_pack;
#endif
#ifdef HANDLE_PRAGMA_WEAK
if (strcmp (string, "weak") == 0)
type = state = ps_weak;
#endif
if (strcmp (string, "poison") == 0)
type = state = ps_poison;
break;
#ifdef HANDLE_PRAGMA_WEAK
case ps_weak:
name = xstrdup (string);
state = ps_name;
break;
case ps_name:
state = (strcmp (string, "=") ? ps_bad : ps_equals);
break;
case ps_equals:
value = xstrdup (string);
state = ps_value;
break;
case ps_value:
state = ps_bad;
break;
#endif /* HANDLE_PRAGMA_WEAK */
#ifdef HANDLE_PRAGMA_PACK
case ps_pack:
state = (strcmp (string, "(") ? ps_bad : ps_left);
break;
case ps_left:
if (token == NULL_TREE)
{
/* #pragma pack () resets packing rules to their
defaults. */
if (strcmp (string, ")") == 0)
{
align = 0;
state = ps_right;
}
else
state = ps_bad;
}
else if (TREE_CODE (token) == INTEGER_CST)
goto handle_align;
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
else if (TREE_CODE (token) == IDENTIFIER_NODE)
{
if (strcmp (string, "push") == 0)
type = state = ps_push;
else if (strcmp (string, "pop") == 0)
type = state = ps_pop;
else
state = ps_bad;
}
#endif
else
state = ps_bad;
break;
handle_align:
switch (tree_log2 (token))
{
case 0:
case 1:
case 2:
case 3:
case 4:
state = ps_align;
align = 1 << tree_log2 (token);
break;
default:
state = ps_bad;
break;
}
break;
case ps_align:
state = (strcmp (string, ")") ? ps_bad : ps_right);
break;
case ps_right:
state = ps_bad;
break;
#endif /* HANDLE_PRAGMA_PACK */
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
case ps_push:
state = (strcmp (string, ",") ? ps_bad : ps_pushcomma);
break;
case ps_pushid:
state = (strcmp (string, ",") ? ps_bad : ps_pushcomma2);
break;
case ps_pushcomma:
if (token && TREE_CODE (token) == IDENTIFIER_NODE)
{
id = token;
state = ps_pushid;
break;
}
/* else fall through */
case ps_pushcomma2:
if (token && TREE_CODE (token) == INTEGER_CST)
goto handle_align;
else
state = ps_bad;
break;
case ps_pop:
if (strcmp (string, ",") == 0)
state = ps_popcomma;
else
state = (strcmp (string, ")") ? ps_bad : ps_right);
break;
case ps_popcomma:
if (token && TREE_CODE (token) == IDENTIFIER_NODE)
{
id = token;
state = ps_align;
}
else
state = ps_bad;
break;
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
case ps_poison:
if (token && TREE_CODE (token) != IDENTIFIER_NODE)
state = ps_bad;
break;
case ps_bad:
case ps_done:
break;
default:
abort ();
}
return 1;
}
#endif /* HANDLE_GENERIC_PRAGMAS */
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
static void static void
mark_align_stack (p) mark_align_stack (p)
void *p; void *p;
@ -452,13 +167,287 @@ mark_align_stack (p)
a = a->prev; a = a->prev;
} }
} }
#else /* not HANDLE_PRAGMA_PACK_PUSH_POP */
#define SET_GLOBAL_ALIGNMENT(ALIGN) (maximum_field_alignment = (ALIGN))
#define push_alignment(ID, N) \
BAD("#pragma pack(push[, id], <n>) is not supported on this target")
#define pop_alignment(ID) \
BAD("#pragma pack(pop[, id], <n>) is not supported on this target")
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
/* #pragma pack ()
#pragma pack (N)
#pragma pack (push, N)
#pragma pack (push, ID, N)
#pragma pack (pop)
#pragma pack (pop, ID) */
static void
handle_pragma_pack (dummy)
cpp_reader *dummy ATTRIBUTE_UNUSED;
{
tree x, id = 0;
int align;
enum cpp_ttype token;
enum { set, reset, push, pop } action;
if (c_lex (&x) != CPP_OPEN_PAREN)
BAD ("missing '(' after '#pragma pack' - ignored");
token = c_lex (&x);
if (token == CPP_CLOSE_PAREN)
action = reset;
else if (token == CPP_NUMBER)
{
align = TREE_INT_CST_LOW (x);
action = set;
}
else if (token == CPP_NAME)
{
if (!strcmp (IDENTIFIER_POINTER (x), "push"))
action = push;
else if (!strcmp (IDENTIFIER_POINTER (x), "pop"))
action = pop;
else
BAD2 ("unknown action '%s' for '#pragma pack' - ignored",
IDENTIFIER_POINTER (x));
}
else
BAD ("malformed '#pragma pack' - ignored");
token = c_lex (&x);
if ((action == set || action == reset) && token != CPP_CLOSE_PAREN)
BAD ("malformed '#pragma pack' - ignored");
if ((action == push || action == pop) && token != CPP_COMMA)
BAD2 ("malformed '#pragma pack(%s[, id], <n>)' - ignored",
action == push ? "push" : "pop");
if (action == push || action == pop)
{
token = c_lex (&x);
if (token == CPP_NAME)
{
id = x;
if (c_lex (&x) != CPP_COMMA)
BAD2 ("malformed '#pragma pack(%s[, id], <n>)' - ignored",
action == push ? "push" : "pop");
token = c_lex (&x);
}
if (token == CPP_NUMBER)
align = TREE_INT_CST_LOW (x);
else
BAD2 ("malformed '#pragma pack(%s[, id], <n>)' - ignored",
action == push ? "push" : "pop");
if (c_lex (&x) != CPP_CLOSE_PAREN)
BAD ("malformed '#pragma pack' - ignored");
}
if (c_lex (&x) != CPP_EOF)
warning ("junk at end of '#pragma pack'");
switch (align)
{
case 0:
case 1:
case 2:
case 4:
case 8:
case 16:
align *= BITS_PER_UNIT;
break;
default:
BAD2 ("alignment must be a small power of two, not %d", align);
}
switch (action)
{
case set: SET_GLOBAL_ALIGNMENT (align); break;
case reset: SET_GLOBAL_ALIGNMENT (0); break;
case push: push_alignment (align, id); break;
case pop: pop_alignment (id); break;
}
}
#endif /* HANDLE_PRAGMA_PACK */
#ifdef HANDLE_PRAGMA_WEAK
static void handle_pragma_weak PARAMS ((cpp_reader *));
/* #pragma weak name [= value] */
static void
handle_pragma_weak (dummy)
cpp_reader *dummy ATTRIBUTE_UNUSED;
{
tree name, value, x;
enum cpp_ttype t;
value = 0;
if (c_lex (&name) != CPP_NAME)
BAD ("malformed #pragma weak, ignored");
t = c_lex (&x);
if (t == CPP_EQ)
{
if (c_lex (&value) != CPP_NAME)
BAD ("malformed #pragma weak, ignored");
t = c_lex (&x);
}
if (t != CPP_EOF)
warning ("junk at end of #pragma weak");
add_weak (IDENTIFIER_POINTER (name), value ? IDENTIFIER_POINTER (value) : 0);
}
#endif
#if !USE_CPPLIB
/* Glue version of cpplib's pragma registration and dispatch system. */
struct pragma_entry
{
struct pragma_entry *next;
const char *name;
size_t len;
int isnspace;
union {
void (*handler) PARAMS ((cpp_reader *));
struct pragma_entry *space;
} u;
};
void
cpp_register_pragma_space (pfile, space)
cpp_reader *pfile ATTRIBUTE_UNUSED;
const char *space;
{
struct pragma_entry *new;
const struct pragma_entry *p = pragmas;
size_t len = strlen (space);
while (p)
{
if (p->isnspace && p->len == len && !memcmp (p->name, space, len))
return;
p = p->next;
}
new = (struct pragma_entry *) xmalloc (sizeof (struct pragma_entry));
new->name = space;
new->len = len;
new->isnspace = 1;
new->u.space = 0;
new->next = pragmas;
pragmas = new;
}
void
cpp_register_pragma (pfile, space, name, handler)
cpp_reader *pfile ATTRIBUTE_UNUSED;
const char *space;
const char *name;
void (*handler) PARAMS ((cpp_reader *));
{
struct pragma_entry **x, *new;
size_t len;
x = &pragmas;
if (space)
{
struct pragma_entry *p = pragmas;
len = strlen (space);
while (p)
{
if (p->isnspace && p->len == len && !memcmp (p->name, space, len))
{
x = &p->u.space;
goto found;
}
p = p->next;
}
abort ();
}
found:
new = (struct pragma_entry *) xmalloc (sizeof (struct pragma_entry));
new->name = name;
new->len = strlen (name);
new->isnspace = 0;
new->u.handler = handler;
new->next = *x;
*x = new;
}
/* Called from process_directive() for #pragma lines. */
void
dispatch_pragma ()
{
enum cpp_ttype t;
tree x;
const struct pragma_entry *p;
const char *name;
size_t len;
p = pragmas;
new_space:
t = c_lex (&x);
if (t == CPP_EOF)
return;
if (t != CPP_NAME)
{
warning ("malformed #pragma directive");
return;
}
name = IDENTIFIER_POINTER (x);
len = IDENTIFIER_LENGTH (x);
while (p)
{
if (strlen (p->name) == len && !memcmp (p->name, name, len))
{
if (p->isnspace)
{
p = p->u.space;
goto new_space;
}
else
{
(*p->u.handler) (0);
return;
}
}
p = p->next;
}
/* Issue a warning message if we have been asked to do so. Ignore
unknown pragmas in system header file unless an explcit
-Wunknown-pragmas has been given. */
if (warn_unknown_pragmas > in_system_header)
warning ("ignoring pragma %s", name);
}
#endif #endif
void void
init_pragma () init_pragma ()
{ {
#if !USE_CPPLIB
cpp_reader *pfile = 0;
#else
cpp_reader *pfile = &parse_in;
#endif
#ifdef HANDLE_PRAGMA_PACK
cpp_register_pragma (pfile, 0, "pack", handle_pragma_pack);
#endif
#ifdef HANDLE_PRAGMA_WEAK
cpp_register_pragma (pfile, 0, "weak", handle_pragma_weak);
#endif
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP #ifdef HANDLE_PRAGMA_PACK_PUSH_POP
ggc_add_root (&alignment_stack, 1, sizeof(alignment_stack), ggc_add_root (&alignment_stack, 1, sizeof(alignment_stack),
mark_align_stack); mark_align_stack);
#endif #endif
} }
#endif /* HANDLE_GENERIC_PRAGMAS */

View File

@ -61,41 +61,20 @@ extern int add_weak PARAMS ((const char *, const char *));
/* Define HANDLE_GENERIC_PRAGMAS if any kind of front-end pragma /* Define HANDLE_GENERIC_PRAGMAS if any kind of front-end pragma
parsing is to be done. The code in GCC's generic C source files parsing is to be done. The code in GCC's generic C source files
will only look for the definition of this constant. They will will only look for the definition of this constant. They will
ignore definitions of HANDLE_PRAGMA_PACK and so on. ignore definitions of HANDLE_PRAGMA_PACK and so on. */
With #pragma poison, this is always set. */ #if defined HANDLE_PRAGMA_PACK || defined HANDLE_PRAGMA_WEAK
#define HANDLE_GENERIC_PRAGMAS 1 #define HANDLE_GENERIC_PRAGMAS
#endif
#ifdef HANDLE_GENERIC_PRAGMAS #ifdef HANDLE_GENERIC_PRAGMAS
enum pragma_state
{
ps_start,
ps_done,
#ifdef HANDLE_PRAGMA_WEAK
ps_weak,
ps_name,
ps_equals,
ps_value,
#endif
#ifdef HANDLE_PRAGMA_PACK
ps_pack,
ps_left,
ps_align,
ps_right,
#endif
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
ps_push, ps_pushcomma, ps_pushid, ps_pushcomma2,
ps_pop, ps_popcomma,
#endif
ps_poison,
ps_bad
};
/* Handle a C style pragma */
extern int handle_pragma_token PARAMS ((const char *, tree));
#endif /* HANDLE_GENERIC_PRAGMAS */
extern void init_pragma PARAMS ((void)); extern void init_pragma PARAMS ((void));
# if !USE_CPPLIB
extern void dispatch_pragma PARAMS ((void));
# endif
#else
# define init_pragma()
#endif
#endif /* _C_PRAGMA_H */ #endif /* _C_PRAGMA_H */

View File

@ -28,13 +28,18 @@ Boston, MA 02111-1307, USA. */
/* The limbo_value is used for block level extern declarations, which need /* The limbo_value is used for block level extern declarations, which need
to be type checked against subsequent extern declarations. They can't to be type checked against subsequent extern declarations. They can't
be referenced after they fall out of scope, so they can't be global. */ be referenced after they fall out of scope, so they can't be global.
The rid_code field is used for keywords. It is in all
lang_identifier nodes, because some keywords are only special in a
particular context. */
struct lang_identifier struct lang_identifier
{ {
struct tree_identifier ignore; struct tree_identifier ignore;
tree global_value, local_value, label_value, implicit_decl; tree global_value, local_value, label_value, implicit_decl;
tree error_locus, limbo_value; tree error_locus, limbo_value;
enum rid rid_code;
}; };
/* Macros for access to language-specific slots in an identifier. */ /* Macros for access to language-specific slots in an identifier. */
@ -83,6 +88,14 @@ extern int pedantic;
nonzero if the definition of the type has already started. */ nonzero if the definition of the type has already started. */
#define C_TYPE_BEING_DEFINED(type) TYPE_LANG_FLAG_0 (type) #define C_TYPE_BEING_DEFINED(type) TYPE_LANG_FLAG_0 (type)
/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
keyword. C_RID_CODE (node) is then the RID_* value of the keyword,
and C_RID_YYCODE is the token number wanted by Yacc. */
#define C_IS_RESERVED_WORD(id) TREE_LANG_FLAG_0 (id)
#define C_RID_CODE(id) \
(((struct lang_identifier *) (id))->rid_code)
/* In a RECORD_TYPE, a sorted array of the fields of the type. */ /* In a RECORD_TYPE, a sorted array of the fields of the type. */
struct lang_type struct lang_type
{ {

File diff suppressed because it is too large Load Diff

View File

@ -115,7 +115,7 @@ CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/class.c $(srcdir)/cp/cp-tree.def \
$(srcdir)/cp/decl.h $(srcdir)/cp/decl2.c $(srcdir)/cp/dump.c \ $(srcdir)/cp/decl.h $(srcdir)/cp/decl2.c $(srcdir)/cp/dump.c \
$(srcdir)/cp/errfn.c $(srcdir)/cp/error.c $(srcdir)/cp/except.c \ $(srcdir)/cp/errfn.c $(srcdir)/cp/error.c $(srcdir)/cp/except.c \
$(srcdir)/cp/expr.c $(srcdir)/cp/friend.c $(srcdir)/cp/init.c \ $(srcdir)/cp/expr.c $(srcdir)/cp/friend.c $(srcdir)/cp/init.c \
$(srcdir)/cp/input.c $(srcdir)/cp/lex.c $(srcdir)/cp/lex.h \ $(srcdir)/cp/lex.c $(srcdir)/cp/lex.h \
$(srcdir)/cp/mangle.c $(srcdir)/cp/method.c $(srcdir)/cp/optimize.c \ $(srcdir)/cp/mangle.c $(srcdir)/cp/method.c $(srcdir)/cp/optimize.c \
$(srcdir)/cp/parse.y $(srcdir)/cp/pt.c $(srcdir)/cp/ptree.c \ $(srcdir)/cp/parse.y $(srcdir)/cp/pt.c $(srcdir)/cp/ptree.c \
$(srcdir)/cp/repo.c $(srcdir)/cp/rtti.c $(srcdir)/cp/search.c \ $(srcdir)/cp/repo.c $(srcdir)/cp/rtti.c $(srcdir)/cp/search.c \
@ -123,8 +123,8 @@ CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/class.c $(srcdir)/cp/cp-tree.def \
$(srcdir)/cp/typeck.c $(srcdir)/cp/typeck2.c $(srcdir)/cp/xref.c $(srcdir)/cp/typeck.c $(srcdir)/cp/typeck2.c $(srcdir)/cp/xref.c
cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) $(BACKEND) c-common.o \ cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) $(BACKEND) c-common.o \
c-pragma.o c-semantics.o $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def \ c-pragma.o c-semantics.o c-lex.o $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def \
$(srcdir)/c-common.def $(srcdir)/cp/gxx.gperf $(srcdir)/cp/cfns.gperf hash.o \ $(srcdir)/c-common.def $(srcdir)/cp/cfns.gperf hash.o \
$(srcdir)/cp/operators.def $(srcdir)/cp/operators.def
cd cp; $(MAKE) $(LANG_FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext) cd cp; $(MAKE) $(LANG_FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
# #

View File

@ -172,7 +172,7 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)
# Lists of files for various purposes. # Lists of files for various purposes.
# Shared with C front end: # Shared with C front end:
C_OBJS = ../c-common.o ../c-pragma.o ../c-semantics.o C_OBJS = ../c-common.o ../c-pragma.o ../c-semantics.o ../c-lex.o
# Language-specific object files for g++ # Language-specific object files for g++
@ -237,16 +237,6 @@ $(PARSE_H) $(PARSE_C) : $(srcdir)/parse.y
# cp $(PARSE_C) y.tab.c # cp $(PARSE_C) y.tab.c
# touch stamp-parse # touch stamp-parse
# We used to try to protect people from having to rerun gperf. But,
# the C front-end already requires this if c-parse.gperf is changed,
# so we should be consistent.
$(srcdir)/hash.h: $(srcdir)/gxx.gperf
gperf -L C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word \
'-k1,4,7,$$' $(srcdir)/gxx.gperf >$(srcdir)/hash.h || ( \
echo "Please update your 'gperf' from the GCC infrastructure" >&2 ; \
echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/gperf*" >&2 ; \
exit 1 )
$(srcdir)/cfns.h: $(srcdir)/cfns.gperf $(srcdir)/cfns.h: $(srcdir)/cfns.gperf
gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \
$(srcdir)/cfns.gperf > $(srcdir)/cfns.h $(srcdir)/cfns.gperf > $(srcdir)/cfns.h
@ -254,7 +244,7 @@ $(srcdir)/cfns.h: $(srcdir)/cfns.gperf
spew.o : spew.c $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \ spew.o : spew.c $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \
lex.h $(srcdir)/../toplev.h lex.h $(srcdir)/../toplev.h
lex.o : lex.c $(CXX_TREE_H) \ lex.o : lex.c $(CXX_TREE_H) \
$(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h \ $(PARSE_H) $(srcdir)/../flags.h lex.h \
$(srcdir)/../c-pragma.h $(srcdir)/../toplev.h \ $(srcdir)/../c-pragma.h $(srcdir)/../toplev.h \
$(srcdir)/../output.h $(srcdir)/../mbchar.h $(GGC_H) \ $(srcdir)/../output.h $(srcdir)/../mbchar.h $(GGC_H) \
$(srcdir)/../input.h $(srcdir)/../diagnostic.h operators.def $(srcdir)/../input.h $(srcdir)/../diagnostic.h operators.def

View File

@ -153,7 +153,7 @@ static void check_bases PARAMS ((tree, int *, int *, int *));
static void check_bases_and_members PARAMS ((tree, int *)); static void check_bases_and_members PARAMS ((tree, int *));
static tree create_vtable_ptr PARAMS ((tree, int *, int *, tree *, tree *)); static tree create_vtable_ptr PARAMS ((tree, int *, int *, tree *, tree *));
static void layout_class_type PARAMS ((tree, int *, int *, tree *, tree *)); static void layout_class_type PARAMS ((tree, int *, int *, tree *, tree *));
static void fixup_pending_inline PARAMS ((struct pending_inline *)); static void fixup_pending_inline PARAMS ((tree));
static void fixup_inline_methods PARAMS ((tree)); static void fixup_inline_methods PARAMS ((tree));
static void set_primary_base PARAMS ((tree, tree, int *)); static void set_primary_base PARAMS ((tree, tree, int *));
static void propagate_binfo_offsets PARAMS ((tree, tree)); static void propagate_binfo_offsets PARAMS ((tree, tree));
@ -4449,15 +4449,12 @@ create_vtable_ptr (t, empty_p, vfuns_p,
complete. */ complete. */
static void static void
fixup_pending_inline (info) fixup_pending_inline (fn)
struct pending_inline *info; tree fn;
{ {
if (info) if (DECL_PENDING_INLINE_INFO (fn))
{ {
tree args; tree args = DECL_ARGUMENTS (fn);
tree fn = info->fndecl;
args = DECL_ARGUMENTS (fn);
while (args) while (args)
{ {
DECL_CONTEXT (args) = fn; DECL_CONTEXT (args) = fn;
@ -4487,13 +4484,13 @@ fixup_inline_methods (type)
/* Do inline member functions. */ /* Do inline member functions. */
for (; method; method = TREE_CHAIN (method)) for (; method; method = TREE_CHAIN (method))
fixup_pending_inline (DECL_PENDING_INLINE_INFO (method)); fixup_pending_inline (method);
/* Do friends. */ /* Do friends. */
for (method = CLASSTYPE_INLINE_FRIENDS (type); for (method = CLASSTYPE_INLINE_FRIENDS (type);
method; method;
method = TREE_CHAIN (method)) method = TREE_CHAIN (method))
fixup_pending_inline (DECL_PENDING_INLINE_INFO (TREE_VALUE (method))); fixup_pending_inline (TREE_VALUE (method));
CLASSTYPE_INLINE_FRIENDS (type) = NULL_TREE; CLASSTYPE_INLINE_FRIENDS (type) = NULL_TREE;
} }
@ -5426,6 +5423,10 @@ init_class_processing ()
access_public_virtual_node = build_int_2 (4 | ak_public, 0); access_public_virtual_node = build_int_2 (4 | ak_public, 0);
access_protected_virtual_node = build_int_2 (4 | ak_protected, 0); access_protected_virtual_node = build_int_2 (4 | ak_protected, 0);
access_private_virtual_node = build_int_2 (4 | ak_private, 0); access_private_virtual_node = build_int_2 (4 | ak_private, 0);
ridpointers[(int) RID_PUBLIC] = access_public_node;
ridpointers[(int) RID_PRIVATE] = access_private_node;
ridpointers[(int) RID_PROTECTED] = access_protected_node;
} }
/* Set current scope to NAME. CODE tells us if this is a /* Set current scope to NAME. CODE tells us if this is a

View File

@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */
/* Usage of TREE_LANG_FLAG_?: /* Usage of TREE_LANG_FLAG_?:
0: BINFO_MARKED (BINFO nodes). 0: BINFO_MARKED (BINFO nodes).
IDENTIFIER_MARKED (IDENTIFIER_NODEs)
NEW_EXPR_USE_GLOBAL (in NEW_EXPR). NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR). DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR). LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
@ -71,7 +72,7 @@ Boston, MA 02111-1307, USA. */
or FIELD_DECL). or FIELD_DECL).
NEED_TEMPORARY_P (in REF_BIND, BASE_CONV) NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE) IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
5: Unused. 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
6: BINFO_ACCESS (in BINFO) 6: BINFO_ACCESS (in BINFO)
Usage of TYPE_LANG_FLAG_?: Usage of TYPE_LANG_FLAG_?:
@ -282,8 +283,21 @@ struct lang_identifier
tree class_value; tree class_value;
tree class_template_info; tree class_template_info;
struct lang_id2 *x; struct lang_id2 *x;
enum rid rid_code;
}; };
/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
keyword. C_RID_CODE (node) is then the RID_* value of the keyword,
and C_RID_YYCODE is the token number wanted by Yacc. */
#define C_IS_RESERVED_WORD(id) TREE_LANG_FLAG_5 (id)
#define C_RID_CODE(id) \
(((struct lang_identifier *) (id))->rid_code)
extern const short rid_to_yy[RID_MAX];
#define C_RID_YYCODE(id) \
rid_to_yy[((struct lang_identifier *) (id))->rid_code]
#define LANG_IDENTIFIER_CAST(NODE) \ #define LANG_IDENTIFIER_CAST(NODE) \
((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE)) ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
@ -468,15 +482,6 @@ struct tree_srcloc
#define IDENTIFIER_CLASS_VALUE(NODE) \ #define IDENTIFIER_CLASS_VALUE(NODE) \
(LANG_IDENTIFIER_CAST (NODE)->class_value) (LANG_IDENTIFIER_CAST (NODE)->class_value)
/* The amount of time used by the file whose special "time identifier"
is NODE, represented as an INTEGER_CST. See get_time_identifier. */
#define TIME_IDENTIFIER_TIME(NODE) IDENTIFIER_BINDING(NODE)
/* For a "time identifier" this is a INTEGER_CST. The
TREE_INT_CST_LOW is 1 if the corresponding file is "interface only".
The TRE_INT_CST_HIGH is 1 if it is "interface unknown". */
#define TIME_IDENTIFIER_FILEINFO(NODE) IDENTIFIER_CLASS_VALUE (NODE)
/* TREE_TYPE only indicates on local and class scope the current /* TREE_TYPE only indicates on local and class scope the current
type. For namespace scope, the presence of a type in any namespace type. For namespace scope, the presence of a type in any namespace
is indicated with global_type_node, and the real type behind must is indicated with global_type_node, and the real type behind must
@ -1039,6 +1044,14 @@ extern int flag_cond_mismatch;
extern int flag_no_asm; extern int flag_no_asm;
/* Nonzero means don't recognize any extended keywords. */
extern int flag_no_gnu_keywords;
/* Nonzero means recognize the named operators from C++98. */
extern int flag_operator_names;
/* For cross referencing. */ /* For cross referencing. */
extern int flag_gnu_xref; extern int flag_gnu_xref;
@ -1896,6 +1909,8 @@ struct lang_decl_flags
} u2; } u2;
}; };
struct unparsed_text;
struct lang_decl struct lang_decl
{ {
struct lang_decl_flags decl_flags; struct lang_decl_flags decl_flags;
@ -1911,7 +1926,7 @@ struct lang_decl
union union
{ {
tree sorted_fields; tree sorted_fields;
struct pending_inline *pending_inline_info; struct unparsed_text *pending_inline_info;
struct language_function *saved_language_function; struct language_function *saved_language_function;
} u; } u;
@ -1925,8 +1940,6 @@ struct lang_decl
} u2; } u2;
}; };
/* An un-parsed default argument looks like an identifier. */
#define DEFARG_LENGTH(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.length)
#define DEFARG_POINTER(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.pointer) #define DEFARG_POINTER(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.pointer)
/* Non-zero if NODE is a _DECL with TREE_READONLY set. */ /* Non-zero if NODE is a _DECL with TREE_READONLY set. */
@ -3212,10 +3225,6 @@ extern int flag_labels_ok;
/* Nonzero means allow Microsoft extensions without a pedwarn. */ /* Nonzero means allow Microsoft extensions without a pedwarn. */
extern int flag_ms_extensions; extern int flag_ms_extensions;
/* Non-zero means to collect statistics which might be expensive
and to print them when we are done. */
extern int flag_detailed_statistics;
/* Non-zero means warn in function declared in derived class has the /* Non-zero means warn in function declared in derived class has the
same name as a virtual in the base class, but fails to match the same name as a virtual in the base class, but fails to match the
type signature of any virtual function in the base class. */ type signature of any virtual function in the base class. */
@ -3503,25 +3512,6 @@ extern varray_type local_classes;
/* Things for handling inline functions. */ /* Things for handling inline functions. */
struct pending_inline
{
struct pending_inline *next; /* pointer to next in chain */
int lineno; /* line number we got the text from */
const char *filename; /* name of file we were processing */
tree fndecl; /* FUNCTION_DECL that brought us here */
int token; /* token we were scanning */
int token_value; /* value of token we were scanning (YYSTYPE) */
char *buf; /* pointer to character stream */
int len; /* length of stream */
unsigned int can_free : 1; /* free this after we're done with it? */
unsigned int deja_vu : 1; /* set iff we don't want to see it again. */
unsigned int interface : 2; /* 0=interface 1=unknown 2=implementation */
};
/* in method.c */
extern struct pending_inline *pending_inlines;
/* Negative values means we know `this' to be of static type. */ /* Negative values means we know `this' to be of static type. */
extern int flag_this_is_variable; extern int flag_this_is_variable;
@ -4148,41 +4138,33 @@ extern void set_quals_and_spec PARAMS ((tree, tree, tree));
extern void lang_init PARAMS ((void)); extern void lang_init PARAMS ((void));
extern void lang_finish PARAMS ((void)); extern void lang_finish PARAMS ((void));
extern void print_parse_statistics PARAMS ((void)); extern void print_parse_statistics PARAMS ((void));
extern void extract_interface_info PARAMS ((void));
extern void do_pending_inlines PARAMS ((void)); extern void do_pending_inlines PARAMS ((void));
extern void process_next_inline PARAMS ((struct pending_inline *)); extern void process_next_inline PARAMS ((struct unparsed_text *));
extern struct pending_input *save_pending_input PARAMS ((void));
extern void restore_pending_input PARAMS ((struct pending_input *));
extern void yyungetc PARAMS ((int, int)); extern void yyungetc PARAMS ((int, int));
extern void reinit_parse_for_method PARAMS ((int, tree)); extern void snarf_method PARAMS ((tree));
extern void reinit_parse_for_block PARAMS ((int, struct obstack *));
extern void check_for_missing_semicolon PARAMS ((tree)); extern void check_for_missing_semicolon PARAMS ((tree));
extern void note_got_semicolon PARAMS ((tree)); extern void note_got_semicolon PARAMS ((tree));
extern void note_list_got_semicolon PARAMS ((tree)); extern void note_list_got_semicolon PARAMS ((tree));
extern void do_pending_lang_change PARAMS ((void)); extern void do_pending_lang_change PARAMS ((void));
extern int identifier_type PARAMS ((tree));
extern void see_typename PARAMS ((void)); extern void see_typename PARAMS ((void));
extern tree do_identifier PARAMS ((tree, int, tree)); extern tree do_identifier PARAMS ((tree, int, tree));
extern tree do_scoped_id PARAMS ((tree, int)); extern tree do_scoped_id PARAMS ((tree, int));
extern tree identifier_typedecl_value PARAMS ((tree)); extern tree identifier_typedecl_value PARAMS ((tree));
extern int real_yylex PARAMS ((void));
extern int is_rid PARAMS ((tree));
extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree)); extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree));
extern void retrofit_lang_decl PARAMS ((tree)); extern void retrofit_lang_decl PARAMS ((tree));
extern tree copy_decl PARAMS ((tree)); extern tree copy_decl PARAMS ((tree));
extern void copy_lang_decl PARAMS ((tree)); extern void copy_lang_decl PARAMS ((tree));
extern tree cp_make_lang_type PARAMS ((enum tree_code)); extern tree cp_make_lang_type PARAMS ((enum tree_code));
extern tree make_aggr_type PARAMS ((enum tree_code)); extern tree make_aggr_type PARAMS ((enum tree_code));
extern void dump_time_statistics PARAMS ((void));
extern void compiler_error PARAMS ((const char *, ...)) extern void compiler_error PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1; ATTRIBUTE_PRINTF_1;
extern void yyerror PARAMS ((const char *)); extern void yyerror PARAMS ((const char *));
extern void clear_inline_text_obstack PARAMS ((void)); extern void clear_inline_text_obstack PARAMS ((void));
extern void maybe_snarf_defarg PARAMS ((void)); extern void maybe_snarf_defarg PARAMS ((void));
extern tree snarf_defarg PARAMS ((void));
extern void add_defarg_fn PARAMS ((tree)); extern void add_defarg_fn PARAMS ((tree));
extern void do_pending_defargs PARAMS ((void)); extern void do_pending_defargs PARAMS ((void));
extern int identifier_type PARAMS ((tree));
extern void yyhook PARAMS ((int)); extern void yyhook PARAMS ((int));
extern int cp_type_qual_from_rid PARAMS ((tree)); extern int cp_type_qual_from_rid PARAMS ((tree));

View File

@ -3464,7 +3464,7 @@ duplicate_decls (newdecl, olddecl)
DECL_VIRTUAL_CONTEXT (newdecl) = DECL_VIRTUAL_CONTEXT (olddecl); DECL_VIRTUAL_CONTEXT (newdecl) = DECL_VIRTUAL_CONTEXT (olddecl);
if (DECL_CONTEXT (olddecl)) if (DECL_CONTEXT (olddecl))
DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl); DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
if (DECL_PENDING_INLINE_INFO (newdecl) == (struct pending_inline *)0) if (DECL_PENDING_INLINE_INFO (newdecl) == 0)
DECL_PENDING_INLINE_INFO (newdecl) = DECL_PENDING_INLINE_INFO (olddecl); DECL_PENDING_INLINE_INFO (newdecl) = DECL_PENDING_INLINE_INFO (olddecl);
DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl); DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl);
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl); DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
@ -6148,7 +6148,7 @@ end_only_namespace_names ()
} }
/* Push the declarations of builtin types into the namespace. /* Push the declarations of builtin types into the namespace.
RID_INDEX, if < CP_RID_MAX is the index of the builtin type RID_INDEX is the index of the builtin type
in the array RID_POINTERS. NAME is the name used when looking in the array RID_POINTERS. NAME is the name used when looking
up the builtin type. TYPE is the _TYPE node for the builtin type. */ up the builtin type. TYPE is the _TYPE node for the builtin type. */
@ -6161,7 +6161,7 @@ record_builtin_type (rid_index, name, type)
tree rname = NULL_TREE, tname = NULL_TREE; tree rname = NULL_TREE, tname = NULL_TREE;
tree tdecl = NULL_TREE; tree tdecl = NULL_TREE;
if ((int) rid_index < (int) CP_RID_MAX) if ((int) rid_index < (int) RID_MAX)
rname = ridpointers[(int) rid_index]; rname = ridpointers[(int) rid_index];
if (name) if (name)
tname = get_identifier (name); tname = get_identifier (name);
@ -6172,7 +6172,7 @@ record_builtin_type (rid_index, name, type)
{ {
tdecl = pushdecl (build_decl (TYPE_DECL, tname, type)); tdecl = pushdecl (build_decl (TYPE_DECL, tname, type));
set_identifier_type_value (tname, NULL_TREE); set_identifier_type_value (tname, NULL_TREE);
if ((int) rid_index < (int) CP_RID_MAX) if ((int) rid_index < (int) RID_MAX)
/* Built-in types live in the global namespace. */ /* Built-in types live in the global namespace. */
SET_IDENTIFIER_GLOBAL_VALUE (tname, tdecl); SET_IDENTIFIER_GLOBAL_VALUE (tname, tdecl);
} }
@ -6215,7 +6215,7 @@ record_builtin_java_type (name, size)
TYPE_PRECISION (type) = - size; TYPE_PRECISION (type) = - size;
layout_type (type); layout_type (type);
} }
record_builtin_type (CP_RID_MAX, name, type); record_builtin_type (RID_MAX, name, type);
decl = TYPE_NAME (type); decl = TYPE_NAME (type);
/* Suppress generate debug symbol entries for these types, /* Suppress generate debug symbol entries for these types,
@ -6371,27 +6371,27 @@ init_decl_processing ()
record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node); record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node);
record_builtin_type (RID_LONG, "long int", long_integer_type_node); record_builtin_type (RID_LONG, "long int", long_integer_type_node);
record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node); record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
record_builtin_type (CP_RID_MAX, "long unsigned int", record_builtin_type (RID_MAX, "long unsigned int",
long_unsigned_type_node); long_unsigned_type_node);
record_builtin_type (CP_RID_MAX, "unsigned long", long_unsigned_type_node); record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
record_builtin_type (CP_RID_MAX, "long long int", record_builtin_type (RID_MAX, "long long int",
long_long_integer_type_node); long_long_integer_type_node);
record_builtin_type (CP_RID_MAX, "long long unsigned int", record_builtin_type (RID_MAX, "long long unsigned int",
long_long_unsigned_type_node); long_long_unsigned_type_node);
record_builtin_type (CP_RID_MAX, "long long unsigned", record_builtin_type (RID_MAX, "long long unsigned",
long_long_unsigned_type_node); long_long_unsigned_type_node);
record_builtin_type (RID_SHORT, "short int", short_integer_type_node); record_builtin_type (RID_SHORT, "short int", short_integer_type_node);
record_builtin_type (CP_RID_MAX, "short unsigned int", record_builtin_type (RID_MAX, "short unsigned int",
short_unsigned_type_node); short_unsigned_type_node);
record_builtin_type (CP_RID_MAX, "unsigned short", record_builtin_type (RID_MAX, "unsigned short",
short_unsigned_type_node); short_unsigned_type_node);
ptrdiff_type_node ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
/* Define both `signed char' and `unsigned char'. */ /* Define both `signed char' and `unsigned char'. */
record_builtin_type (CP_RID_MAX, "signed char", signed_char_type_node); record_builtin_type (RID_MAX, "signed char", signed_char_type_node);
record_builtin_type (CP_RID_MAX, "unsigned char", unsigned_char_type_node); record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
/* `unsigned long' is the standard type for sizeof. /* `unsigned long' is the standard type for sizeof.
Note that stddef.h uses `unsigned long', Note that stddef.h uses `unsigned long',
@ -6454,7 +6454,7 @@ init_decl_processing ()
signed_size_zero_node = build_int_2 (0, 0); signed_size_zero_node = build_int_2 (0, 0);
record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node); record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node);
record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node); record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node);
record_builtin_type (CP_RID_MAX, "long double", long_double_type_node); record_builtin_type (RID_MAX, "long double", long_double_type_node);
pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"),
complex_integer_type_node)); complex_integer_type_node));
@ -6481,7 +6481,7 @@ init_decl_processing ()
TYPE_QUAL_CONST)); TYPE_QUAL_CONST));
empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE); empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
#if 0 #if 0
record_builtin_type (CP_RID_MAX, NULL_PTR, string_type_node); record_builtin_type (RID_MAX, NULL_PTR, string_type_node);
#endif #endif
/* Make a type to be the domain of a few array types /* Make a type to be the domain of a few array types
@ -6596,16 +6596,16 @@ init_decl_processing ()
vtable_entry_type = build_qualified_type (vtable_entry_type, vtable_entry_type = build_qualified_type (vtable_entry_type,
TYPE_QUAL_CONST); TYPE_QUAL_CONST);
} }
record_builtin_type (CP_RID_MAX, VTBL_PTR_TYPE, vtable_entry_type); record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type);
vtbl_type_node vtbl_type_node
= build_cplus_array_type (vtable_entry_type, NULL_TREE); = build_cplus_array_type (vtable_entry_type, NULL_TREE);
layout_type (vtbl_type_node); layout_type (vtbl_type_node);
vtbl_type_node = build_qualified_type (vtbl_type_node, TYPE_QUAL_CONST); vtbl_type_node = build_qualified_type (vtbl_type_node, TYPE_QUAL_CONST);
record_builtin_type (CP_RID_MAX, NULL_PTR, vtbl_type_node); record_builtin_type (RID_MAX, NULL_PTR, vtbl_type_node);
vtbl_ptr_type_node = build_pointer_type (vtable_entry_type); vtbl_ptr_type_node = build_pointer_type (vtable_entry_type);
layout_type (vtbl_ptr_type_node); layout_type (vtbl_ptr_type_node);
record_builtin_type (CP_RID_MAX, NULL_PTR, vtbl_ptr_type_node); record_builtin_type (RID_MAX, NULL_PTR, vtbl_ptr_type_node);
std_node = build_decl (NAMESPACE_DECL, std_node = build_decl (NAMESPACE_DECL,
flag_honor_std flag_honor_std
@ -9822,7 +9822,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
next = 0; next = 0;
if (is_rid (dname)) if (C_IS_RESERVED_WORD (dname))
{ {
cp_error ("declarator-id missing; using reserved word `%D'", cp_error ("declarator-id missing; using reserved word `%D'",
dname); dname);

View File

@ -368,10 +368,6 @@ int flag_labels_ok;
int flag_ms_extensions; int flag_ms_extensions;
/* Non-zero means to collect statistics which might be expensive
and to print them when we are done. */
int flag_detailed_statistics;
/* C++ specific flags. */ /* C++ specific flags. */
/* Zero means that `this' is a *const. This gives nice behavior in the /* Zero means that `this' is a *const. This gives nice behavior in the
2.0 world. 1 gives 1.2-compatible behavior. 2 gives Spring behavior. 2.0 world. 1 gives 1.2-compatible behavior. 2 gives Spring behavior.
@ -601,6 +597,8 @@ lang_decode_option (argc, argv)
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
/* ignore */; /* ignore */;
else if (!strcmp (p, "-lang-c++"))
/* ignore - cpplib needs to see this */;
else if (p[0] == '-' && p[1] == 'f') else if (p[0] == '-' && p[1] == 'f')
{ {
/* Some kind of -f option. /* Some kind of -f option.
@ -922,7 +920,6 @@ void
grok_x_components (specs) grok_x_components (specs)
tree specs; tree specs;
{ {
struct pending_inline **p;
tree t; tree t;
specs = strip_attrs (specs); specs = strip_attrs (specs);
@ -937,13 +934,6 @@ grok_x_components (specs)
fixup_anonymous_aggr (t); fixup_anonymous_aggr (t);
finish_member_declaration (build_decl (FIELD_DECL, NULL_TREE, t)); finish_member_declaration (build_decl (FIELD_DECL, NULL_TREE, t));
/* Ignore any inline function definitions in the anonymous union
since an anonymous union may not have function members. */
p = &pending_inlines;
for (; *p; *p = (*p)->next)
if (DECL_CONTEXT ((*p)->fndecl) != t)
break;
} }
/* Returns a PARM_DECL for a parameter of the indicated TYPE, with the /* Returns a PARM_DECL for a parameter of the indicated TYPE, with the

View File

@ -1,116 +0,0 @@
%{
/* Command-line: gperf -L C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */
%}
struct resword { const char *name; short token; enum rid rid;};
#ifdef __GNUC__
__inline
#endif
static unsigned int hash PARAMS ((const char *, unsigned int));
#ifdef __GNUC__
__inline
#endif
struct resword *is_reserved_word PARAMS ((const char *, unsigned int));
%%
__alignof, ALIGNOF, RID_UNUSED
__alignof__, ALIGNOF, RID_UNUSED
__asm, ASM_KEYWORD, RID_UNUSED
__asm__, ASM_KEYWORD, RID_UNUSED
__attribute, ATTRIBUTE, RID_UNUSED
__attribute__, ATTRIBUTE, RID_UNUSED
__builtin_va_arg, VA_ARG, RID_UNUSED
__complex, TYPESPEC, RID_COMPLEX
__complex__, TYPESPEC, RID_COMPLEX
__const, CV_QUALIFIER, RID_CONST
__const__, CV_QUALIFIER, RID_CONST
__extension__, EXTENSION, RID_UNUSED
__imag, IMAGPART, RID_UNUSED
__imag__, IMAGPART, RID_UNUSED
__inline, SCSPEC, RID_INLINE
__inline__, SCSPEC, RID_INLINE
__label__, LABEL, RID_UNUSED
__null, CONSTANT, RID_NULL
__real, REALPART, RID_UNUSED
__real__, REALPART, RID_UNUSED
__restrict, CV_QUALIFIER, RID_RESTRICT
__restrict__, CV_QUALIFIER, RID_RESTRICT
__signed, TYPESPEC, RID_SIGNED
__signed__, TYPESPEC, RID_SIGNED
__typeof, TYPEOF, RID_UNUSED
__typeof__, TYPEOF, RID_UNUSED
__volatile, CV_QUALIFIER, RID_VOLATILE
__volatile__, CV_QUALIFIER, RID_VOLATILE
__wchar_t, TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,
asm, ASM_KEYWORD, RID_UNUSED,
and, ANDAND, RID_UNUSED,
and_eq, ASSIGN, RID_UNUSED,
auto, SCSPEC, RID_AUTO,
bitand, '&', RID_UNUSED,
bitor, '|', RID_UNUSED,
bool, TYPESPEC, RID_BOOL,
break, BREAK, RID_UNUSED,
case, CASE, RID_UNUSED,
catch, CATCH, RID_UNUSED,
char, TYPESPEC, RID_CHAR,
class, AGGR, RID_CLASS,
compl, '~', RID_UNUSED,
const, CV_QUALIFIER, RID_CONST,
const_cast, CONST_CAST, RID_UNUSED,
continue, CONTINUE, RID_UNUSED,
default, DEFAULT, RID_UNUSED,
delete, DELETE, RID_UNUSED,
do, DO, RID_UNUSED,
double, TYPESPEC, RID_DOUBLE,
dynamic_cast, DYNAMIC_CAST, RID_UNUSED,
else, ELSE, RID_UNUSED,
enum, ENUM, RID_UNUSED,
explicit, SCSPEC, RID_EXPLICIT,
export, SCSPEC, RID_EXPORT,
extern, SCSPEC, RID_EXTERN,
false, CXX_FALSE, RID_UNUSED,
float, TYPESPEC, RID_FLOAT,
for, FOR, RID_UNUSED,
friend, SCSPEC, RID_FRIEND,
goto, GOTO, RID_UNUSED,
if, IF, RID_UNUSED,
inline, SCSPEC, RID_INLINE,
int, TYPESPEC, RID_INT,
long, TYPESPEC, RID_LONG,
mutable, SCSPEC, RID_MUTABLE,
namespace, NAMESPACE, RID_UNUSED,
new, NEW, RID_UNUSED,
not, '!', RID_UNUSED,
not_eq, EQCOMPARE, RID_UNUSED,
operator, OPERATOR, RID_UNUSED,
or, OROR, RID_UNUSED,
or_eq, ASSIGN, RID_UNUSED,
private, VISSPEC, RID_PRIVATE,
protected, VISSPEC, RID_PROTECTED,
public, VISSPEC, RID_PUBLIC,
register, SCSPEC, RID_REGISTER,
reinterpret_cast, REINTERPRET_CAST, RID_UNUSED,
return, RETURN_KEYWORD, RID_UNUSED,
short, TYPESPEC, RID_SHORT,
signed, TYPESPEC, RID_SIGNED,
sizeof, SIZEOF, RID_UNUSED,
static, SCSPEC, RID_STATIC,
static_cast, STATIC_CAST, RID_UNUSED,
struct, AGGR, RID_RECORD,
switch, SWITCH, RID_UNUSED,
template, TEMPLATE, RID_TEMPLATE,
this, THIS, RID_UNUSED,
throw, THROW, RID_UNUSED,
true, CXX_TRUE, RID_UNUSED,
try, TRY, RID_UNUSED,
typedef, SCSPEC, RID_TYPEDEF,
typename, TYPENAME_KEYWORD, RID_UNUSED,
typeid, TYPEID, RID_UNUSED,
typeof, TYPEOF, RID_UNUSED,
union, AGGR, RID_UNION,
unsigned, TYPESPEC, RID_UNSIGNED,
using, USING, RID_UNUSED,
virtual, SCSPEC, RID_VIRTUAL,
void, TYPESPEC, RID_VOID,
volatile, CV_QUALIFIER, RID_VOLATILE,
while, WHILE, RID_UNUSED,
xor, '^', RID_UNUSED,
xor_eq, ASSIGN, RID_UNUSED,

View File

@ -1,257 +0,0 @@
/* C code produced by gperf version 2.7.1 (19981006 egcs) */
/* Command-line: gperf -L C -F , 0, 0 -p -j1 -g -o -t -N is_reserved_word -k1,4,7,$ ../../../gcc/cp/gxx.gperf */
/* Command-line: gperf -L C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */
struct resword { const char *name; short token; enum rid rid;};
#ifdef __GNUC__
__inline
#endif
static unsigned int hash PARAMS ((const char *, unsigned int));
#ifdef __GNUC__
__inline
#endif
struct resword *is_reserved_word PARAMS ((const char *, unsigned int));
#define TOTAL_KEYWORDS 103
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 16
#define MIN_HASH_VALUE 4
#define MAX_HASH_VALUE 274
/* maximum key range = 271, duplicates = 0 */
#ifdef __GNUC__
__inline
#endif
static unsigned int
hash (str, len)
register const char *str;
register unsigned int len;
{
static unsigned short asso_values[] =
{
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 0, 275, 97, 1, 19,
40, 0, 12, 68, 0, 74, 275, 0, 11, 67,
27, 0, 70, 6, 96, 43, 6, 37, 3, 10,
8, 104, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275
};
register int hval = len;
switch (hval)
{
default:
case 7:
hval += asso_values[(unsigned char)str[6]];
case 6:
case 5:
case 4:
hval += asso_values[(unsigned char)str[3]];
case 3:
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
}
#ifdef __GNUC__
__inline
#endif
struct resword *
is_reserved_word (str, len)
register const char *str;
register unsigned int len;
{
static struct resword wordlist[] =
{
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"else", ELSE, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__real__", REALPART, RID_UNUSED},
{"", 0, 0},
{"true", CXX_TRUE, RID_UNUSED,},
{"or_eq", ASSIGN, RID_UNUSED,},
{"export", SCSPEC, RID_EXPORT,},
{"", 0, 0}, {"", 0, 0},
{"__const__", CV_QUALIFIER, RID_CONST},
{"__volatile", CV_QUALIFIER, RID_VOLATILE},
{"__real", REALPART, RID_UNUSED},
{"__volatile__", CV_QUALIFIER, RID_VOLATILE},
{"__const", CV_QUALIFIER, RID_CONST},
{"xor_eq", ASSIGN, RID_UNUSED,},
{"throw", THROW, RID_UNUSED,},
{"__complex__", TYPESPEC, RID_COMPLEX},
{"case", CASE, RID_UNUSED,},
{"typeof", TYPEOF, RID_UNUSED,},
{"", 0, 0},
{"while", WHILE, RID_UNUSED,},
{"bool", TYPESPEC, RID_BOOL,},
{"__complex", TYPESPEC, RID_COMPLEX},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"extern", SCSPEC, RID_EXTERN,},
{"", 0, 0}, {"", 0, 0},
{"not", '!', RID_UNUSED,},
{"typedef", SCSPEC, RID_TYPEDEF,},
{"virtual", SCSPEC, RID_VIRTUAL,},
{"not_eq", EQCOMPARE, RID_UNUSED,},
{"new", NEW, RID_UNUSED,},
{"", 0, 0},
{"do", DO, RID_UNUSED,},
{"catch", CATCH, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0},
{"delete", DELETE, RID_UNUSED,},
{"double", TYPESPEC, RID_DOUBLE,},
{"__extension__", EXTENSION, RID_UNUSED},
{"__alignof__", ALIGNOF, RID_UNUSED},
{"__asm__", ASM_KEYWORD, RID_UNUSED},
{"", 0, 0},
{"typeid", TYPEID, RID_UNUSED,},
{"", 0, 0},
{"__null", CONSTANT, RID_NULL},
{"switch", SWITCH, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0},
{"friend", SCSPEC, RID_FRIEND,},
{"__alignof", ALIGNOF, RID_UNUSED},
{"false", CXX_FALSE, RID_UNUSED,},
{"sizeof", SIZEOF, RID_UNUSED,},
{"__inline", SCSPEC, RID_INLINE},
{"", 0, 0},
{"__inline__", SCSPEC, RID_INLINE},
{"", 0, 0},
{"static_cast", STATIC_CAST, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0},
{"union", AGGR, RID_UNION,},
{"continue", CONTINUE, RID_UNUSED,},
{"", 0, 0},
{"goto", GOTO, RID_UNUSED,},
{"const", CV_QUALIFIER, RID_CONST,},
{"static", SCSPEC, RID_STATIC,},
{"__imag__", IMAGPART, RID_UNUSED},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"private", VISSPEC, RID_PRIVATE,},
{"typename", TYPENAME_KEYWORD, RID_UNUSED,},
{"", 0, 0},
{"int", TYPESPEC, RID_INT,},
{"__signed__", TYPESPEC, RID_SIGNED},
{"", 0, 0}, {"", 0, 0},
{"void", TYPESPEC, RID_VOID,},
{"if", IF, RID_UNUSED,},
{"", 0, 0},
{"template", TEMPLATE, RID_TEMPLATE,},
{"__attribute", ATTRIBUTE, RID_UNUSED},
{"struct", AGGR, RID_RECORD,},
{"__attribute__", ATTRIBUTE, RID_UNUSED},
{"", 0, 0}, {"", 0, 0},
{"this", THIS, RID_UNUSED,},
{"const_cast", CONST_CAST, RID_UNUSED,},
{"or", OROR, RID_UNUSED,},
{"explicit", SCSPEC, RID_EXPLICIT,},
{"", 0, 0},
{"auto", SCSPEC, RID_AUTO,},
{"bitor", '|', RID_UNUSED,},
{"break", BREAK, RID_UNUSED,},
{"", 0, 0},
{"compl", '~', RID_UNUSED,},
{"public", VISSPEC, RID_PUBLIC,},
{"xor", '^', RID_UNUSED,},
{"__restrict__", CV_QUALIFIER, RID_RESTRICT},
{"and_eq", ASSIGN, RID_UNUSED,},
{"class", AGGR, RID_CLASS,},
{"for", FOR, RID_UNUSED,},
{"__restrict", CV_QUALIFIER, RID_RESTRICT},
{"try", TRY, RID_UNUSED,},
{"__typeof__", TYPEOF, RID_UNUSED},
{"__asm", ASM_KEYWORD, RID_UNUSED},
{"signed", TYPESPEC, RID_SIGNED,},
{"__label__", LABEL, RID_UNUSED},
{"", 0, 0},
{"volatile", CV_QUALIFIER, RID_VOLATILE,},
{"float", TYPESPEC, RID_FLOAT,},
{"", 0, 0},
{"__signed", TYPESPEC, RID_SIGNED},
{"", 0, 0},
{"__typeof", TYPEOF, RID_UNUSED},
{"", 0, 0}, {"", 0, 0},
{"__builtin_va_arg", VA_ARG, RID_UNUSED},
{"", 0, 0}, {"", 0, 0},
{"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,},
{"protected", VISSPEC, RID_PROTECTED,},
{"", 0, 0},
{"namespace", NAMESPACE, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"using", USING, RID_UNUSED,},
{"enum", ENUM, RID_UNUSED,},
{"", 0, 0},
{"and", ANDAND, RID_UNUSED,},
{"__imag", IMAGPART, RID_UNUSED},
{"", 0, 0}, {"", 0, 0},
{"bitand", '&', RID_UNUSED,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"short", TYPESPEC, RID_SHORT,},
{"long", TYPESPEC, RID_LONG,},
{"", 0, 0}, {"", 0, 0},
{"inline", SCSPEC, RID_INLINE,},
{"", 0, 0},
{"default", DEFAULT, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0},
{"unsigned", TYPESPEC, RID_UNSIGNED,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"return", RETURN_KEYWORD, RID_UNUSED,},
{"asm", ASM_KEYWORD, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"mutable", SCSPEC, RID_MUTABLE,},
{"", 0, 0}, {"", 0, 0},
{"dynamic_cast", DYNAMIC_CAST, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"operator", OPERATOR, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"char", TYPESPEC, RID_CHAR,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"reinterpret_cast", REINTERPRET_CAST, RID_UNUSED,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"register", SCSPEC, RID_REGISTER,}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
register const char *s = wordlist[key].name;
if (*str == *s && !strcmp (str + 1, s + 1))
return &wordlist[key];
}
}
return 0;
}

View File

@ -1,240 +0,0 @@
/* Input handling for G++.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Enhanced by Michael Tiemann (tiemann@cygnus.com) to better support USE_CPPLIB
This file is part of GNU CC.
GNU CC 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.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* G++ needs to do enough saving and re-parsing of text that it is
necessary to abandon the simple FILE* model and use a mechanism where
we can pre-empt one input stream with another derived from saved text;
we may need to do this arbitrarily often, and cannot depend on having
the GNU library available, so FILE objects just don't cut it.
This file is written as a separate module, but can be included by
lex.c for very minor efficiency gains (primarily in function
inlining). */
#include "system.h"
#if !USE_CPPLIB
struct putback_buffer {
char *buffer;
int buffer_size;
int index;
};
static struct putback_buffer putback = {NULL, 0, -1};
#endif
struct input_source {
/* saved string */
const char *str;
int length;
/* current position, when reading as input */
int offset;
/* linked list maintenance */
struct input_source *next;
/* values to restore after reading all of current string */
struct pending_input *input;
#if !USE_CPPLIB
const char *filename;
int lineno;
struct putback_buffer putback;
#endif
};
static struct input_source *input, *free_inputs;
#if USE_CPPLIB
extern unsigned char *yy_cur, *yy_lim;
extern int yy_get_token ();
#endif
extern void feed_input PARAMS ((const char *, int, const char *, int));
extern void put_input PARAMS ((int));
extern void put_back PARAMS ((int));
extern int getch PARAMS ((void));
extern int input_redirected PARAMS ((void));
static inline struct input_source * allocate_input PARAMS ((void));
static inline void free_input PARAMS ((struct input_source *));
static inline void end_input PARAMS ((void));
static inline struct input_source *
allocate_input ()
{
struct input_source *inp;
if (free_inputs)
{
inp = free_inputs;
free_inputs = inp->next;
inp->next = 0;
return inp;
}
inp = (struct input_source *) xmalloc (sizeof (struct input_source));
inp->next = 0;
return inp;
}
static inline void
free_input (inp)
struct input_source *inp;
{
inp->str = 0;
inp->length = 0;
inp->next = free_inputs;
free_inputs = inp;
}
/* Some of these external functions are declared inline in case this file
is included in lex.c. */
inline
void
feed_input (str, len, file, line)
const char *str;
int len;
const char *file;
int line;
{
struct input_source *inp = allocate_input ();
/* This shouldn't be necessary. */
while (len && !str[len-1])
len--;
#if USE_CPPLIB
if (yy_lim > yy_cur)
/* If we've started reading the next token, we're hosed. The
token_getch stuff is supposed to prevent this from happening. */
my_friendly_abort (990710);
cpp_push_buffer (&parse_in, str, len);
CPP_BUFFER (&parse_in)->manual_pop = 1;
CPP_BUFFER (&parse_in)->nominal_fname
= CPP_BUFFER (&parse_in)->fname = file;
CPP_BUFFER (&parse_in)->lineno = parse_in.lineno = line;
#else
inp->str = str;
inp->length = len;
inp->offset = 0;
inp->putback = putback;
inp->filename = input_filename;
inp->lineno = lineno;
putback.buffer = NULL;
putback.buffer_size = 0;
putback.index = -1;
#endif
inp->next = input;
inp->input = save_pending_input ();
input = inp;
lineno = line;
input_filename = file;
}
extern int end_of_file;
static inline void
end_input ()
{
struct input_source *inp = input;
#if USE_CPPLIB
cpp_pop_buffer (&parse_in);
#else
putback = inp->putback;
input_filename = inp->filename;
lineno = inp->lineno;
#endif
end_of_file = 0;
input = inp->next;
/* Get interface/implementation back in sync. */
extract_interface_info ();
restore_pending_input (inp->input);
free_input (inp);
}
inline int
getch ()
{
#if USE_CPPLIB
return (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ());
#else
if (putback.index != -1)
{
int ch = putback.buffer[putback.index];
--putback.index;
return ch;
}
if (input)
{
if (input->offset >= input->length)
{
my_friendly_assert (putback.index == -1, 223);
++(input->offset);
if (input->offset - input->length < 64)
return EOF;
/* We must be stuck in an error-handling rule; give up. */
end_input ();
return getch ();
}
return (unsigned char)input->str[input->offset++];
}
return getc (finput);
#endif
}
inline
void
put_back (ch)
int ch;
{
#if USE_CPPLIB
if (ch == EOF)
;
else if (yy_cur[-1] != ch)
my_friendly_abort (990709);
else
yy_cur--;
#else
if (ch != EOF)
{
if (putback.index == putback.buffer_size - 1)
{
putback.buffer_size += 16;
putback.buffer = xrealloc (putback.buffer, putback.buffer_size);
}
my_friendly_assert (putback.buffer != NULL, 224);
putback.buffer[++putback.index] = ch;
}
#endif
}
inline
int
input_redirected ()
{
#ifdef USE_CPPLIB
return CPP_BUFFER(&parse_in)->manual_pop;
#else
return input != 0;
#endif
}

View File

@ -44,7 +44,7 @@ Boston, MA 02111-1307, USA. */
%{fnew-abi:-D__GXX_ABI_VERSION=100}\ %{fnew-abi:-D__GXX_ABI_VERSION=100}\
%{ansi:-trigraphs -$ -D__STRICT_ANSI__} %(cpp_options)\ %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %(cpp_options)\
%{!M:%{!MM:%{!E:%{!pipe:%g.ii} |\n\ %{!M:%{!MM:%{!E:%{!pipe:%g.ii} |\n\
cc1plus %{!pipe:%g.ii} %(cc1_options) %{+e*}\ cc1plus -lang-c++ %{!pipe:%g.ii} %(cc1_options) %{+e*}\
%{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\ %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
as %(asm_options) %{!pipe:%g.s} %A }}}}}\n" as %(asm_options) %{!pipe:%g.s} %A }}}}}\n"
#endif /* ! USE_CPPLIB */ #endif /* ! USE_CPPLIB */
@ -52,6 +52,6 @@ Boston, MA 02111-1307, USA. */
{".ii", "@c++-cpp-output"}, {".ii", "@c++-cpp-output"},
{"@c++-cpp-output", {"@c++-cpp-output",
"%{!M:%{!MM:%{!E:\ "%{!M:%{!MM:%{!E:\
cc1plus -fpreprocessed %i %(cc1_options) %{+e*}\ cc1plus -lang-c++ -fpreprocessed %i %(cc1_options) %{+e*}\
%{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\ %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
as %(asm_options) %{!pipe:%g.s} %A }}}}}"}, as %(asm_options) %{!pipe:%g.s} %A }}}}}"},

File diff suppressed because it is too large Load Diff

View File

@ -21,35 +21,13 @@ can know your rights and responsibilities. It should be in a
file named COPYING. Among other things, the copyright notice file named COPYING. Among other things, the copyright notice
and this notice must be preserved on all copies. */ and this notice must be preserved on all copies. */
enum cp_rid #ifndef _CP_LEX_H
{ #define _CP_LEX_H
RID_FRIEND = RID_MAX,
RID_VIRTUAL,
RID_EXPLICIT,
RID_EXPORT,
RID_MUTABLE,
RID_LAST_MODIFIER = RID_MUTABLE,
RID_BOOL, #if 0
RID_WCHAR, /* Formerly, the RID_* values used as mask bits did not fit into a
single 32-bit word. Now they do, but let's preserve the old logic
/* C++ extension */ in case they ever stop fitting again. -zw, 8 Aug 2000 */
RID_CLASS,
RID_RECORD,
RID_UNION,
RID_ENUM,
RID_LONGLONG,
RID_PUBLIC,
RID_PRIVATE,
RID_PROTECTED,
RID_EXCEPTION,
RID_TEMPLATE,
RID_NULL,
/* Before adding enough to get up to 64, the RIDBIT_* macros
will have to be changed a little. */
CP_RID_MAX
};
/* The type that can represent all values of RIDBIT. */ /* The type that can represent all values of RIDBIT. */
/* We assume that we can stick in at least 32 bits into this. */ /* We assume that we can stick in at least 32 bits into this. */
@ -73,6 +51,18 @@ typedef struct { unsigned long idata[2]; }
(V).idata[1] = 0; \ (V).idata[1] = 0; \
} while (0) } while (0)
#define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1]) #define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1])
#else
typedef unsigned long RID_BIT_TYPE; /* assumed at least 32 bits */
#define RIDBIT_OF(R) ((unsigned long)1 << (int) (R))
#define RIDBIT_SETP(N, V) ((V) & RIDBIT_OF (N))
#define RIDBIT_NOTSETP(N, V) (! ((V) & RIDBIT_OF (N)))
#define RIDBIT_ANY_SET(V) (V)
#define RIDBIT_SET(N, V) do { (V) |= RIDBIT_OF (N); } while (0)
#define RIDBIT_RESET(N, V) do { (V) &= ~RIDBIT_OF (N); } while (0)
#define RIDBIT_RESET_ALL(V) do { (V) = 0; } while (0)
#endif
/* the declaration found for the last IDENTIFIER token read in. /* the declaration found for the last IDENTIFIER token read in.
yylex must look this up to detect typedefs, which get token type TYPENAME, yylex must look this up to detect typedefs, which get token type TYPENAME,
@ -80,7 +70,9 @@ typedef struct { unsigned long idata[2]; }
used in a context which makes it a reference to a variable. */ used in a context which makes it a reference to a variable. */
extern tree lastiddecl; extern tree lastiddecl;
#if !USE_CPPLIB
extern char *token_buffer; /* Pointer to token buffer. */ extern char *token_buffer; /* Pointer to token buffer. */
#endif
/* Back-door communication channel to the lexer. */ /* Back-door communication channel to the lexer. */
extern int looking_for_typename; extern int looking_for_typename;
@ -97,3 +89,5 @@ extern int pending_lang_change;
extern int yylex PARAMS ((void)); extern int yylex PARAMS ((void));
extern struct lang_decl *free_lang_decl_chain; extern struct lang_decl *free_lang_decl_chain;
#endif /* _CP_LEX_H */

View File

@ -51,8 +51,6 @@ const char * const language_string = "GNU C++";
extern struct obstack permanent_obstack; extern struct obstack permanent_obstack;
extern int end_of_file;
/* Like YYERROR but do call yyerror. */ /* Like YYERROR but do call yyerror. */
#define YYERROR1 { yyerror ("syntax error"); YYERROR; } #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
@ -220,8 +218,8 @@ cp_parse_init ()
tree ttype; tree ttype;
char *strtype; char *strtype;
enum tree_code code; enum tree_code code;
flagged_type_tree ftype; flagged_type_tree ftype;
struct pending_inline *pi; struct unparsed_text *pi;
} }
/* All identifiers that are not reserved words /* All identifiers that are not reserved words
@ -275,7 +273,7 @@ cp_parse_init ()
%token NAMESPACE TYPENAME_KEYWORD USING %token NAMESPACE TYPENAME_KEYWORD USING
%token LEFT_RIGHT TEMPLATE %token LEFT_RIGHT TEMPLATE
%token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
%token <itype> SCOPE %token SCOPE
/* Define the operator tokens and their precedences. /* Define the operator tokens and their precedences.
The value is an integer because, if used, it is the tree code The value is an integer because, if used, it is the tree code
@ -372,7 +370,6 @@ cp_parse_init ()
%token <pi> PRE_PARSED_FUNCTION_DECL %token <pi> PRE_PARSED_FUNCTION_DECL
%type <ttype> component_constructor_declarator %type <ttype> component_constructor_declarator
%type <ttype> fn.def2 return_id constructor_declarator %type <ttype> fn.def2 return_id constructor_declarator
%type <pi> fn.defpen
%type <itype> ctor_initializer_opt function_try_block %type <itype> ctor_initializer_opt function_try_block
%type <ttype> named_class_head_sans_basetype %type <ttype> named_class_head_sans_basetype
%type <ftype> class_head named_class_head %type <ftype> class_head named_class_head
@ -480,22 +477,20 @@ lang_extdef:
extdef: extdef:
fndef eat_saved_input fndef eat_saved_input
{ if (pending_inlines) do_pending_inlines (); } { do_pending_inlines (); }
| datadef | datadef
{ if (pending_inlines) do_pending_inlines (); } { do_pending_inlines (); }
| template_def | template_def
{ if (pending_inlines) do_pending_inlines (); } { do_pending_inlines (); }
| asm_keyword '(' string ')' ';' | asm_keyword '(' string ')' ';'
{ if (TREE_CHAIN ($3)) $3 = combine_strings ($3); { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
assemble_asm ($3); } assemble_asm ($3); }
| extern_lang_string '{' extdefs_opt '}' | extern_lang_string '{' extdefs_opt '}'
{ pop_lang_context (); } { pop_lang_context (); }
| extern_lang_string .hush_warning fndef .warning_ok eat_saved_input | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
{ if (pending_inlines) do_pending_inlines (); { do_pending_inlines (); pop_lang_context (); }
pop_lang_context (); }
| extern_lang_string .hush_warning datadef .warning_ok | extern_lang_string .hush_warning datadef .warning_ok
{ if (pending_inlines) do_pending_inlines (); { do_pending_inlines (); pop_lang_context (); }
pop_lang_context (); }
| NAMESPACE identifier '{' | NAMESPACE identifier '{'
{ push_namespace ($2); } { push_namespace ($2); }
extdefs_opt '}' extdefs_opt '}'
@ -665,16 +660,16 @@ template_def:
template_extdef: template_extdef:
fndef eat_saved_input fndef eat_saved_input
{ if (pending_inlines) do_pending_inlines (); } { do_pending_inlines (); }
| template_datadef | template_datadef
{ if (pending_inlines) do_pending_inlines (); } { do_pending_inlines (); }
| template_def | template_def
{ if (pending_inlines) do_pending_inlines (); } { do_pending_inlines (); }
| extern_lang_string .hush_warning fndef .warning_ok eat_saved_input | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
{ if (pending_inlines) do_pending_inlines (); { do_pending_inlines ();
pop_lang_context (); } pop_lang_context (); }
| extern_lang_string .hush_warning template_datadef .warning_ok | extern_lang_string .hush_warning template_datadef .warning_ok
{ if (pending_inlines) do_pending_inlines (); { do_pending_inlines ();
pop_lang_context (); } pop_lang_context (); }
| extension template_extdef | extension template_extdef
{ pedantic = $1; } { pedantic = $1; }
@ -814,7 +809,7 @@ fn.def2:
YYERROR1; YYERROR1;
if (yychar == YYEMPTY) if (yychar == YYEMPTY)
yychar = YYLEX; yychar = YYLEX;
reinit_parse_for_method (yychar, $$); } snarf_method ($$); }
| component_constructor_declarator | component_constructor_declarator
{ $$ = parse_method ($1, NULL_TREE, NULL_TREE); { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
goto rest_of_mdef; } goto rest_of_mdef; }
@ -2163,24 +2158,18 @@ initlist:
{ $$ = tree_cons ($3, $5, $$); } { $$ = tree_cons ($3, $5, $$); }
; ;
fn.defpen:
PRE_PARSED_FUNCTION_DECL
{ start_function (NULL_TREE, $1->fndecl, NULL_TREE,
(SF_DEFAULT | SF_PRE_PARSED
| SF_INCLASS_INLINE)); }
pending_inline: pending_inline:
fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error PRE_PARSED_FUNCTION_DECL maybe_return_init ctor_initializer_opt compstmt_or_error
{ {
expand_body (finish_function ((int)$3 | 2)); expand_body (finish_function ((int)$3 | 2));
process_next_inline ($1); process_next_inline ($1);
} }
| fn.defpen maybe_return_init function_try_block | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
{ {
expand_body (finish_function ((int)$3 | 2)); expand_body (finish_function ((int)$3 | 2));
process_next_inline ($1); process_next_inline ($1);
} }
| fn.defpen maybe_return_init error | PRE_PARSED_FUNCTION_DECL maybe_return_init error
{ {
finish_function (2); finish_function (2);
process_next_inline ($1); } process_next_inline ($1); }

View File

@ -2041,8 +2041,7 @@ finish_class_definition (t, attributes, semi, pop_scope_p)
void void
begin_inline_definitions () begin_inline_definitions ()
{ {
if (pending_inlines if (current_scope () == current_function_decl)
&& current_scope () == current_function_decl)
do_pending_inlines (); do_pending_inlines ();
} }

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,9 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef GCC_FLAGS_H
#define GCC_FLAGS_H
/* Name of the input .c file being compiled. */ /* Name of the input .c file being compiled. */
extern const char *main_input_filename; extern const char *main_input_filename;
@ -590,3 +593,9 @@ extern int flag_no_ident;
/* Nonzero means we should do dwarf2 duplicate elimination. */ /* Nonzero means we should do dwarf2 duplicate elimination. */
extern int flag_eliminate_dwarf2_dups; extern int flag_eliminate_dwarf2_dups;
/* Non-zero means to collect statistics which might be expensive
and to print them when we are done. */
extern int flag_detailed_statistics;
#endif /* GCC_FLAGS_H */

View File

@ -567,7 +567,7 @@ static const char *cpp_options =
%{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\ %{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\
%{fshow-column} %{fno-show-column}\ %{fshow-column} %{fno-show-column}\
%{fleading-underscore} %{fno-leading-underscore}\ %{fleading-underscore} %{fno-leading-underscore}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z %i\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{U*} %{D*} %{i*} %Z %i\
%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}"; %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}";
static const char *cc1_options = static const char *cc1_options =
@ -693,7 +693,7 @@ static struct compiler default_compilers[] =
{".c", "@c"}, {".c", "@c"},
{"@c", {"@c",
#if USE_CPPLIB #if USE_CPPLIB
"%{E|M|MM:cpp0 -lang-c %{ansi:-std=c89} %(cpp_options)}\ "%{E|M|MM:%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)}\
%{!E:%{!M:%{!MM:cc1 -lang-c %{ansi:-std=c89} %(cpp_options)\ %{!E:%{!M:%{!MM:cc1 -lang-c %{ansi:-std=c89} %(cpp_options)\
%(cc1_options) %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\ %(cc1_options) %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
as %(asm_options) %{!pipe:%g.s} %A }}}}}" as %(asm_options) %{!pipe:%g.s} %A }}}}}"

View File

@ -68,7 +68,7 @@ objc-parse.o : $(srcdir)/objc/objc-parse.c \
$(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h $(srcdir)/ggc.h \ $(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h $(srcdir)/ggc.h \
$(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/c-common.h \ $(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/c-common.h \
$(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \ $(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \
$(srcdir)/objc/objc-act.h system.h $(srcdir)/objc/objc-act.h system.h cpplib.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
-c $(srcdir)/objc/objc-parse.c -c $(srcdir)/objc/objc-parse.c
@ -88,8 +88,7 @@ objc-act.o : $(srcdir)/objc/objc-act.c \
$(CONFIG_H) $(TREE_H) $(RTL_H) system.h \ $(CONFIG_H) $(TREE_H) $(RTL_H) system.h \
$(srcdir)/c-tree.h $(srcdir)/c-common.h $(srcdir)/c-lex.h \ $(srcdir)/c-tree.h $(srcdir)/c-common.h $(srcdir)/c-lex.h \
$(srcdir)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \ $(srcdir)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \
$(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h \ $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h
$(srcdir)/c-parse.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
-c $(srcdir)/objc/objc-act.c -c $(srcdir)/objc/objc-act.c

View File

@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */
{".m", "@objective-c"}, {".m", "@objective-c"},
{"@objective-c", {"@objective-c",
#if USE_CPPLIB #if USE_CPPLIB
"%{E|M|MM:cpp0 -lang-objc %{ansi:-std=c89} %(cpp_options)}\ "%{E|M|MM:%(trad_capable_cpp) -lang-objc %{ansi:-std=c89} %(cpp_options)}\
%{!E:%{!M:%{!MM:cc1obj -lang-objc %(cpp_options) %(cc1_options) %{gen-decls}\ %{!E:%{!M:%{!MM:cc1obj -lang-objc %(cpp_options) %(cc1_options) %{gen-decls}\
%{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\ %{!fsyntax-only:%{!S:-o %{|!pipe:%g.s} |\n\
as %(asm_options) %{!pipe:%g.s} %A }}}}}" as %(asm_options) %{!pipe:%g.s} %A }}}}}"

View File

@ -56,7 +56,6 @@ Boston, MA 02111-1307, USA. */
#if USE_CPPLIB #if USE_CPPLIB
#include "cpplib.h" #include "cpplib.h"
extern cpp_reader parse_in; extern cpp_reader parse_in;
extern cpp_options parse_options;
#endif #endif
/* This is the default way of generating a method name. */ /* This is the default way of generating a method name. */
@ -137,7 +136,6 @@ char *util_firstobj;
/* for encode_method_def */ /* for encode_method_def */
#include "rtl.h" #include "rtl.h"
#include "c-parse.h"
#define OBJC_VERSION (flag_next_runtime ? 5 : 8) #define OBJC_VERSION (flag_next_runtime ? 5 : 8)
#define PROTOCOL_VERSION 2 #define PROTOCOL_VERSION 2
@ -693,17 +691,12 @@ generate_struct_by_value_array ()
exit (0); exit (0);
} }
#if USE_CPPLIB
extern char *yy_cur;
#endif
void void
lang_init_options () lang_init_options ()
{ {
#if USE_CPPLIB #if USE_CPPLIB
cpp_init ();
cpp_reader_init (&parse_in); cpp_reader_init (&parse_in);
parse_in.opts = &parse_options;
cpp_options_init (&parse_options);
#endif #endif
} }
@ -715,16 +708,11 @@ lang_init ()
With luck, we discover the real source file's name from that With luck, we discover the real source file's name from that
and put it in input_filename. */ and put it in input_filename. */
ungetc (check_newline (), finput); ungetc (check_newline (), finput);
#else #endif
check_newline (); /* Force the line number back to 0; check_newline will have
yy_cur--; raised it to 1, which will make the builtin functions appear
#endif not to be built in. */
lineno = 0;
/* The line number can be -1 if we had -g3 and the input file
had a directive specifying line 0. But we want predefined
functions to have a line number of 0, not -1. */
if (lineno == -1)
lineno = 0;
/* If gen_declaration desired, open the output file. */ /* If gen_declaration desired, open the output file. */
if (flag_gen_declaration) if (flag_gen_declaration)
@ -800,9 +788,7 @@ lang_decode_option (argc, argv)
{ {
const char *p = argv[0]; const char *p = argv[0];
if (!strcmp (p, "-lang-objc")) if (!strcmp (p, "-gen-decls"))
c_language = clk_objective_c;
else if (!strcmp (p, "-gen-decls"))
flag_gen_declaration = 1; flag_gen_declaration = 1;
else if (!strcmp (p, "-Wselector")) else if (!strcmp (p, "-Wselector"))
warn_selector = 1; warn_selector = 1;
@ -8632,3 +8618,26 @@ lookup_objc_ivar (id)
else else
return 0; return 0;
} }
/* Parser callbacks. */
void
forget_protocol_qualifiers ()
{
C_IS_RESERVED_WORD (ridpointers[(int) RID_IN]) = 0;
C_IS_RESERVED_WORD (ridpointers[(int) RID_OUT]) = 0;
C_IS_RESERVED_WORD (ridpointers[(int) RID_INOUT]) = 0;
C_IS_RESERVED_WORD (ridpointers[(int) RID_BYCOPY]) = 0;
C_IS_RESERVED_WORD (ridpointers[(int) RID_BYREF]) = 0;
C_IS_RESERVED_WORD (ridpointers[(int) RID_ONEWAY]) = 0;
}
void
remember_protocol_qualifiers ()
{
C_IS_RESERVED_WORD (ridpointers[(int) RID_IN]) = 1;
C_IS_RESERVED_WORD (ridpointers[(int) RID_OUT]) = 1;
C_IS_RESERVED_WORD (ridpointers[(int) RID_INOUT]) = 1;
C_IS_RESERVED_WORD (ridpointers[(int) RID_BYCOPY]) = 1;
C_IS_RESERVED_WORD (ridpointers[(int) RID_BYREF]) = 1;
C_IS_RESERVED_WORD (ridpointers[(int) RID_ONEWAY]) = 1;
}

View File

@ -1,3 +1,16 @@
2000-09-06 Zack Weinberg <zack@wolery.cumb.org>
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
2000-09-06 Nathan Sidwell <nathan@codesourcery.com> 2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.pt/deduct2.C: New test. * g++.old-deja/g++.pt/deduct2.C: New test.
@ -57,7 +70,7 @@
2000-09-01 Nathan Sidwell <nathan@codesourcery.com> 2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.other/nested4.C: New test. * g++.old-deja/g++.other/nested4.C: New test.
2000-09-01 Nathan Sidwell <nathan@codesourcery.com> 2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
@ -315,7 +328,7 @@ Sun Aug 6 11:41:51 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
2000-08-05 Zack Weinberg <zack@wolery.cumb.org> 2000-08-05 Zack Weinberg <zack@wolery.cumb.org>
* gcc.c-torture/execute/20000731-1.x: Delete. * gcc.c-torture/execute/20000731-1.x: Delete.
2000-08-04 Zack Weinberg <zack@wolery.cumb.org> 2000-08-04 Zack Weinberg <zack@wolery.cumb.org>

View File

@ -26,8 +26,8 @@ const hand_table Agent::table_1[] =
{ {
{0, &Agent::table_2}, {0, &Agent::table_2},
{first, &Agent::foo}, {first, &Agent::foo},
{last, &(hand)Agent::foo} // ERROR - // ERROR - {last, &(hand)Agent::foo} // ERROR - no match
}; // ERROR - // ERROR - }; // ERROR - cannot convert

View File

@ -1,8 +1,8 @@
// Build don't link: // Build don't link:
// GROUPS passed old-abort // GROUPS passed old-abort
template<int a, int b> template<int a, int b>
class Elvis class Elvis // ERROR - in template.*
{// ERROR - in template.* {
} ; } ;
template<int a> template<int a>

View File

@ -21,7 +21,7 @@ void g (struct s []); /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "array" "struct \[\] arg" { xfail *-*-* } 20 } */ /* { dg-error "array" "struct \[\] arg" { xfail *-*-* } 20 } */
extern func c[]; /* { dg-bogus "warning" "warning in place of error" } */ extern func c[]; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "array" "func \[\] var" { xfail *-*-* } 23 } */ /* { dg-error "array" "func \[\] var" { target *-*-* } 23 } */
void h (func []); /* { dg-bogus "warning" "warning in place of error" } */ void h (func []); /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "array" "func \[\] arg" { xfail *-*-* } 26 } */ /* { dg-error "array" "func \[\] arg" { target *-*-* } 26 } */

View File

@ -1,4 +1,5 @@
/* Tests for un-terminated conditionals: 1. */ /* Tests for un-terminated conditionals: 1. */
/* { dg-do preprocess } */
#if 1 /* { dg-error "unterminated" "unterminated #if" } */ #if 1 /* { dg-error "unterminated" "unterminated #if" } */

View File

@ -1,4 +1,5 @@
/* Tests for unterminated conditionals: 2. */ /* Tests for unterminated conditionals: 2. */
/* { dg-do preprocess } */
#ifdef __sparc__ /* { dg-error "unterminated" "unterminated if-elif-elif..." } */ #ifdef __sparc__ /* { dg-error "unterminated" "unterminated if-elif-elif..." } */
sparc sparc

View File

@ -1,4 +1,5 @@
/* Tests for unterminated conditionals: 3. */ /* Tests for unterminated conditionals: 3. */
/* { dg-do preprocess } */
#if 1 /* { dg-error "#else" "unterminated #else" } */ #if 1 /* { dg-error "#else" "unterminated #else" } */
#else #else

View File

@ -37,4 +37,4 @@ ignored
/* dg.exp doesn't read the included files for tags, so we have to /* dg.exp doesn't read the included files for tags, so we have to
do them explicitly here. */ do them explicitly here. */
/* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 3 } */ /* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */

View File

@ -20,5 +20,5 @@
*/ */
unsigned long long a = 1LUL; /* { dg-error "LUL" "error for LUL suffix" } */ unsigned long long a = 1LUL; /* { dg-error "lul|LUL" "error for LUL suffix" } */
long long b = 1Ll; /* { dg-error "Ll" "error for Ll suffix" } */ long long b = 1Ll; /* { dg-error "Ll" "error for Ll suffix" } */

View File

@ -18,12 +18,12 @@ testfunc1 (int foo6)
foo1: foo1:
foo2: foo2:
foo3: foo3:
foo4: /* { dg-warning "traditional C lacks.*`foo4' conflicts" "label conflicts with identifier" } */ foo4: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
foo5: /* { dg-warning "traditional C lacks.*`foo5' conflicts" "label conflicts with identifier" } */ foo5: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
foo6: /* { dg-warning "traditional C lacks.*`foo6' conflicts" "label conflicts with identifier" } */ foo6: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
foo7: /* { dg-warning "traditional C lacks.*`foo7' conflicts" "label conflicts with identifier" } */ foo7: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
testfunc1: /* { dg-warning "traditional C lacks.*`testfunc1' conflicts" "label conflicts with identifier" } */ testfunc1: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
a: /* { dg-warning "traditional C lacks.*`a' conflicts" "label conflicts with identifier" } */ a: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
i: i:
j: j:
} }

View File

@ -12,14 +12,14 @@ testfunc (void)
i = 1L; i = 1L;
i = 1l; i = 1l;
i = 1U; /* { dg-warning "traditional C rejects the `U' suffix" "numeric constant suffix" } */ i = 1U; /* { dg-warning "traditional C rejects the 'u' suffix" "numeric constant suffix" } */
i = 1u; /* { dg-warning "traditional C rejects the `u' suffix" "numeric constant suffix" } */ i = 1u; /* { dg-warning "traditional C rejects the 'u' suffix" "numeric constant suffix" } */
f = 1.0; f = 1.0;
f = 1.0F; /* { dg-warning "traditional C rejects the `F' suffix" "numeric constant suffix" } */ f = 1.0F; /* { dg-warning "traditional C rejects the 'f' suffix" "numeric constant suffix" } */
f = 1.0f; /* { dg-warning "traditional C rejects the `f' suffix" "numeric constant suffix" } */ f = 1.0f; /* { dg-warning "traditional C rejects the 'f' suffix" "numeric constant suffix" } */
f = 1.0L; /* { dg-warning "traditional C rejects the `L' suffix" "numeric constant suffix" } */ f = 1.0L; /* { dg-warning "traditional C rejects the 'l' suffix" "numeric constant suffix" } */
f = 1.0l; /* { dg-warning "traditional C rejects the `l' suffix" "numeric constant suffix" } */ f = 1.0l; /* { dg-warning "traditional C rejects the 'l' suffix" "numeric constant suffix" } */
#line 24 "sys-header.h" 3 #line 24 "sys-header.h" 3
/* We are in system headers now, no -Wtraditional warnings should issue. */ /* We are in system headers now, no -Wtraditional warnings should issue. */

View File

@ -40,6 +40,8 @@ DEFTIMEVAR (TV_GC , "garbage collection")
DEFTIMEVAR (TV_DUMP , "dump files") DEFTIMEVAR (TV_DUMP , "dump files")
/* Timing in various stages of the compiler. */ /* Timing in various stages of the compiler. */
DEFTIMEVAR (TV_CPP , "preprocessing")
DEFTIMEVAR (TV_LEX , "lexical analysis")
DEFTIMEVAR (TV_PARSE , "parser") DEFTIMEVAR (TV_PARSE , "parser")
DEFTIMEVAR (TV_EXPAND , "expand") DEFTIMEVAR (TV_EXPAND , "expand")
DEFTIMEVAR (TV_VARCONST , "varconst") DEFTIMEVAR (TV_VARCONST , "varconst")

View File

@ -19,6 +19,9 @@
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef GCC_TIMEVAR_H
#define GCC_TIMEVAR_H
/* Timing variables are used to measure elapsed time in various /* Timing variables are used to measure elapsed time in various
portions of the compiler. Each measures elapsed user, system, and portions of the compiler. Each measures elapsed user, system, and
wall-clock time, as appropriate to and supported by the host wall-clock time, as appropriate to and supported by the host
@ -84,3 +87,5 @@ extern void timevar_print PARAMS ((FILE *));
/* Provided for backward compatibility. */ /* Provided for backward compatibility. */
extern long get_run_time PARAMS ((void)); extern long get_run_time PARAMS ((void));
extern void print_time PARAMS ((const char *, long)); extern void print_time PARAMS ((const char *, long));
#endif

View File

@ -477,6 +477,10 @@ int time_report = 0;
int mem_report = 0; int mem_report = 0;
/* Non-zero means to collect statistics which might be expensive
and to print them when we are done. */
int flag_detailed_statistics = 0;
/* -f flags. */ /* -f flags. */