gcc/gcc/c-lang.c

235 lines
8.1 KiB
C
Raw Normal View History

1991-12-25 04:55:54 +01:00
/* Language-specific hook definitions for C front end.
2000-02-26 06:45:17 +01:00
Copyright (C) 1991, 1995, 1997, 1998,
1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
1991-12-25 04:55:54 +01:00
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
This file is part of GCC.
1991-12-25 04:55:54 +01:00
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
GCC 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.
1991-12-25 04:55:54 +01:00
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
GCC 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.
1991-12-25 04:55:54 +01:00
You should have received a copy of the GNU General Public License
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
1991-12-25 04:55:54 +01:00
#include "config.h"
Major cutover to using system.h: * Makefile.in (alias.o, bitmap.o, c-aux-info.o, c-common.o, c-decl.o, c-iterate.o, c-lang.o, c-lex.o, c-pragma.o, c-typeck.o, caller-save.o, calls.o, collect2.o, combine.o, cse.o, dbxout.o, dwarf2out.o, dwarfout.o, emit-rtl.o, except.o, explow.o, expmed.o, expr.o, final.o, flow.o, function.o, getpwd.o, global.o, integrate.o, jump.o, local-alloc.o, loop.o, optabs.o, pexecute.o, prefix.o, print-rtl.o, print-tree.o, profile.o, real.o, recog.o, reg-stack.o, regclass.o, regmove.o, reload.o, reload1.o, reorg.o, rtl.o, rtlanal.o, sdbout.o, stmt.o, stor-layout.o, stupid.o, tlink.o, toplev.o, tree.o, unroll.o, varasm.o, xcoffout.o): Depend on system.h. * alias.c, bitmap.c, c-aux-info.c, c-common.c, c-decl.c, c-iterate.c, c-lang.c, c-lex.c, c-pragma.c, c-typeck.c, caller-save.c, calls.c, collect2.c, combine.c, cse.c, dbxout.c, dwarf2out.c, dwarfout.c, emit-rtl.c, except.c, explow.c, expmed.c, expr.c, final.c, flow.c, function.c, gcc.c, getpwd.c, global.c, integrate.c, jump.c, local-alloc.c, loop.c, optabs.c, pexecute.c, prefix.c, print-rtl.c, print-tree.c, profile.c, real.c, recog.c, reg-stack.c, regclass.c, regmove.c, reload.c, reload1.c, reorg.c, rtl.c, rtlanal.c, sched.c, sdbout.c, stmt.c, stor-layout.c, stupid.c, tlink.c, toplev.c, tree.c, unroll.c, varasm.c, xcoffout.c: Include system.h. Organize include ordering so that stdarg/varargs comes before other system headers. Remove spurious casts of functions assured of a prototype in system.h. From-SVN: r18726
1998-03-20 15:58:42 +01:00
#include "system.h"
#include "coretypes.h"
#include "tm.h"
1991-12-25 04:55:54 +01:00
#include "tree.h"
splay-tree.c (splay_tree_predecessor): Fix typo in comment. * splay-tree.c (splay_tree_predecessor): Fix typo in comment. Convert the C front-end to use function-at-a-time mode. * c-common.h: Include splay-tree.h. (C_DECLARED_LABEL_FLAG): New macro. (struct language_function): Add x_scope_stmt_stack and x_function_name_declared_p. (RECHAIN_STMTS): Move definition. (lang_statment_code_p): Likewise. (lang_expand_stmt): Likewise. (lang_expand_decl_stmt): New variable. (lang_expand_function_end): Likewise. (current_scope_stmt_stack): New function. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. (mark_stmt_tree): Likewise. (struct c_lang_decl): New structure. (DECL_SAVED_TREE): Define. (c_mark_lang_decl): New function. (c_expand_start_cond): Change prototype. (c_finish_then): New function. (c_finish_else): Likewise. (current_function_name_declared): Remove. (set_current_function_name_declared): Likewise. (mark_c_language_function): Declare. (case_compare): Likewise. (c_add_case_label): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-common.c (lang_expand_function_end): New variable. (struct if_elt): Add if_stmt. (c_expand_start_cond): Add the if-statement to the statement-tree, rather than generating RTL. (c_finish_then): New function. (c_expand_start_else): Don't generate RTL. (c_finish_else): New function. (c_expand_expr_stmt): Don't generate RTL. (statement_code_p): Add SCOPE_STMT. (case_compare): New function. (c_add_case_label): Likewise. (mark_stmt_tree): Likewise. (c_mark_lang_decl): Likewise. (mark_c_language_function): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-decl.c (c_stmt_tree): New variable (c_scope_stmt_stack): Likewise. (c_function_name_declared_p): Likewise. (lang_expand_expr_stmt): Remove. (poplevel): Don't call output_inline_function for nested functions. (pushdecl): Don't set DECL_CONTEXT for a local declaration of an `extern' function. (redeclaration_error_message): Change means of computing whether or not a function is nested. (lookup_label): Don't call label_rtx. (init_decl_processing): Add more GC roots. (start_decl): Add DECL_STMTs to the statement-tree, rather than calling rest_of_decl_compilation. (finish_decl): Don't call expand_decl. (store_parm_decls): Begin the statement-tree, but don't generate RTL. (finish_function): Tie off the statement-tree. Call c_expand_body if appropriate. (c_expand_body): New function. (push_c_function_context): Save more information. (pop_c_function_contxt): Likewise. (copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it. (lang_mark_tree): Mark it. (current_stmt_tree): Adjust. (current_scope_stmt_stack): New function. (do_case): Remove. (set_current_name_declared): Likewise. (c_begin_compound_stmt): Define. (c_expand_decl_stmt): Likewise. * c-lang.c: Include rtl.h and expr.h. (lang_init): Set more language-specific hooks. * c-lex.c: Include expr.h. * c-parse.in: Changes throughout to add statements to the statement-tree, rather than generating RTL after every statement. * c-semantics.c (lang_expand_decl_stmt): Define. (add_decl_stmt): New function. (add_scope_stmt): Likewise. (finish_stmt_tree): Tweak. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Handle local labels, and call lang_expand_decl_stmt if required. (genrtl_for_stmt): Fix line-number handling. (genrtl_case_label): Handle cleanups. (genrtl_asm_stmt): Don't call combine_strings. (genrtl_compound_stmt): Simplify. (expand_stmt): Handle SCOPE_STMTs. * c-tree.h (struct lang_decl): New structure. (C_DECLARED_LABEL_FLAG): Remove. (c_begin_compound_stmt): Declare. (c_expand_decl_stmt): Likewise. (c_expand_start_case): Rename to c_start_case. (c_finish_case): New function. * c-typeck.c (start_init): Tweak setting of constructor_incremental. (c_expand_asm_operands): Tweak error-handling. Add to the statement-tree. (c_expand_return): Add to the statement-tree. (c_expand_start_case): Rename to ... (c_start_case): ... this. (struct c_switch): New type. (switch_stack): New variable. (do_case): Simplify. (c_finish_case): New function. * dependence.c: Include expr.h. (enum dependence_type): Change spelling of enumerals. (check_node_dependence): Adjust. * expr.h (lang_safe_from_p): Declare. (safe_from_p): Likewise. * expr.c (lang_safe_from_p): New variable. (safe_from_p): Give it external linkage. Use lang_safe_from_p. * stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type. * toplev.c (rest_of_decl_compilation): Robustify. * tree.c (contains_placeholder_p): Likewise. * Makefile.in: Update dependencies. * objc/objc-act.h: Adjust calculation of value for dummy_tree_code. * objc/objc-act.c: Include rtl.h, expr.h, and c-common.h. (objc_expand_function_end): New function. (finish_method_def): Use it. (init_objc): Initialize more language-specific hooks. * objc/Make-lang.in: Update dependencies. * cp-tree.h (struct cp_language_function): Remove x_scope_stmt_stack and name_declared. (current_scope_stmt_stack): Remove. (function_name_declared_p): New macro. (struct lang_decl_flags): Use c_lang_decl as a base class. (context): Remove. (struct lang_decl): Replace saved_tree with context. (DECL_FRIEND_CONTEXT): Adjust accordingly. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Likewise. (DECL_SAVED_TREE): Remove. (C_DECLARED_LABEL_FLAG): Likewise. (cplus_expand_expr_stmt): Don't declare. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. * decl.c (mark_stmt_tree): Remove. (case_compare): Likewise. (finish_case_label): Use c_add_case_label. (init_decl_processing): Set more language-specific hooks. (build_enumerator): Fix typo in comment. (cplus_expand_expr_stmt): Remove. (mark_lang_function): Use mark_c_language_function. (lang_mark_tree): Use c_mark_lang_decl. * decl2.c: Change order of inclusion. * except.c: Likewise. * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall back on c_expand_expr. * friend.c: Include expr.h. * init.c: Change order of inclusion. * Makefile.in: Update dependencies. * lex.h (free_lang_decl_chain): Remove. * optimize.c (maybe_clone_body): Use function_name_declared_p. * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if it doesn't exist. (instantiate_decl): Use function_name_declared_p. * semantics.c (lang_expand_expr_stmt): Remove. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (begin_compound_stmt): Use function_name_declared_p. (add_decl_stmt): Remove. (setup_vtbl_ptr): Use function_name_declared_p. (add_scope_stmt): Remove. (current_scope_stmt_stack): New function. (cp_expand_stmt): Don't handle SCOPE_STMTs. (expand_body): Use function_name_declared_p. * tree.c (cp_statement_code_p): Don't include SCOPE_STMT. * typeck.c: Change order of includes. (convert_sequence): Remove. From-SVN: r36464
2000-09-17 09:38:23 +02:00
#include "c-tree.h"
#include "c-common.h"
#include "ggc.h"
#include "langhooks.h"
#include "langhooks-def.h"
#include "tree-inline.h"
pretty-print.c (pp_base_indent): Rename from pp_indent. * pretty-print.c (pp_base_indent): Rename from pp_indent. * c-pretty-print.h (pp_c_pretty_print_flag)s: New datatype. (struct c_pretty_print_info): Add more fields. (pp_c_left_paren): Move to c-pretty-print.c. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_declarator): Declare. (pp_c_direct_declarator): Likewise. (pp_c_specifier_qualifier_list): Likewise. (pp_c_type_id): Likewise. * c-pretty-print.c (pp_c_cv_qualifier): Change prootype. Rework.. (pp_c_type_qualifier_list): New. (pp_c_pointer): Likewise. (pp_c_parameter_type_list): Likewise. (pp_c_function_definition): Likewise. (pp_c_id_expression): Likewise. (pp_c_simple_type_specifier): Tidy. (pp_c_unary_expression): Likewise. (pp_c_expression): Likewise. (pp_c_pretty_printer_init): Likewise. (pp_c_specifier_qualifier_list): Rework.. (pp_c_abstract_declarator): Likewise. (pp_c_postfix_expression): Likewise. (pp_c_primary_expression): Likewise. (pp_c_cast_expression): Likewise. (pp_c_direct_abstract_declarator): Likewise. (pp_c_storage_class_specifier): Likewise. (pp_c_function_specifier): Likewise. (pp_c_declaration_specifiers): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_declarator): Likewise. (pp_c_declaration): Likewise. (pp_c_statement): Likewise. (pp_c_integer_constant): Rename from pp_c_integer_literal. (pp_c_character_constant): Rename from pp_c_character_literal. (pp_c_bool_constant): Rename from pp_c_bool_literal. (pp_c_enumeration_constant): Rename from pp_c_enumerator. (pp_c_floating_constant): Rename from pp_c_real_literal. (pp_c_constant): Rename from pp_c_literal. * c-lang.c: Include diagnostic.h and c-pretty-print.h (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define. (c_initialize_diagnostics): New. * Makefile.in (c-lang.o): Update dependency. cp/ * error.c (dump_expr): Tidy. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): New. (pp_cxx_begin_template_argument_list): Likewise. (pp_cxx_end_template_argument_list): Likewise. (is_destructor_name): Likewise. (pp_cxx_unqualified_id): Likewise. (pp_cxx_qualified_id): Likewise. (pp_cxx_id_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_delete_expression): Likewise. (pp_cxx_pm_expression): Likewise. (pp_cxx_type_specifier): Rework. (pp_cxx_type_id): Likewise. (pp_cxx_primary_expression): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_multiplicative_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_pretty_printer_init): Tidy. From-SVN: r70299
2003-08-10 20:17:06 +02:00
#include "diagnostic.h"
#include "c-pretty-print.h"
static void c_initialize_diagnostics (diagnostic_context *);
2003-06-30 21:36:25 +02:00
enum c_language_kind c_language = clk_c;
/* ### When changing hooks, consider if ObjC needs changing too!! ### */
c-lang.c (LANG_HOOKS_NAME): New. * c-lang.c (LANG_HOOKS_NAME): New. (lang_hooks): Constify. (c_init_options): Update. (lang_identify): Remove. * c-parse.in (language_string): Remove. * dbxout.c: Include langhooks.h. (dbxout_symbol_location): Update. * dwarf2out.c: Include langhooks.h. (gen_compile_unit_die): Update. * dwarfout.c: Include langhooks.h. (prototyped_attribute, output_compile_unit_die): Update. * langhooks-def.h (LANG_HOOKS_NAME, LANG_HOOKS_IDENTIFIER_SIZE): New. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (struct lang_hooks): New members. Constify. * stringpool.c: Don't include toplev.h. (set_identifier_size): Remove. * toplev.c (toplev_main): Initialize identifier size. (print_version): Update. * tree.h (language_string, init_lex, lang_identify, set_identifier_size): Remove. * Makefile.in: Update dependencies. * config/darwin.c: Include langhooks.h. (func_name_maybe_scoped): Update. * config/darwin.h (ASM_END_FILE): Update. * config/nextstep.h (ASM_END_FILE): Update. * config/nextstep21.h (ASM_END_FILE): Update. * config/i386/sun386.h (ASM_END_FILE): Update. * config/rs6000/rs6000.c (ASM_END_FILE): Include langhooks.h. (rs6000_output_function_epilogue): Update. ada: * misc.c (LANG_HOOKS_NAME, LANG_HOOKS_IDENTIFIER_SIZE): Override. (struct lang_hooks): Constify. (language_string, lang_identify): Remove. * utils.c (init_decl_processing): Update. cp: * cp-lang.c (LANG_HOOKS_NAME): Override. (struct lang_hooks): Constify. * lex.c (cxx_init_options): Update. (lang_identify): Remove. * parse.y (language_string): Remove. f: * com.c (language_string, lang_identify): Remove. (struct lang_hooks): Constify. (LANG_HOOKS_NAME): Override. (init_parse): Update. java: * jcf-parse.c (init_lex): Remove. * lang.c (language_string, lang_identify): Remove. (struct lang_hooks): Constify. (LANG_HOOKS_NAME): Override. (init_parse): Update. objc: * objc-act.c (LANG_HOOKS_NAME): Override. (struct lang_hooks): Constify. (objc_init_options): Update. (lang_identify): Remove. From-SVN: r46874
2001-11-09 08:14:20 +01:00
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU C"
#undef LANG_HOOKS_IDENTIFIER_SIZE
#define LANG_HOOKS_IDENTIFIER_SIZE C_SIZEOF_STRUCT_LANG_IDENTIFIER
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT c_objc_common_init
#undef LANG_HOOKS_FINISH
#define LANG_HOOKS_FINISH c_common_finish
#undef LANG_HOOKS_INIT_OPTIONS
2003-06-30 21:36:25 +02:00
#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
#undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS c_initialize_diagnostics
Makefile.in (OJBS, c-opts.o): Update. * Makefile.in (OJBS, c-opts.o): Update. (c-options.c, c-options.h): Rename options.h and options.c. (options.h): Rename options_.h. (opts.o): New. * c-common.h (c_common_handle_option): Replace c_common_decode_option. (c_common_init_options): Update prototype. * c-lang.c (c_init_options): Update prototype. (LANG_HOOKS_HANDLE_OPTION): Override. (LANG_HOOKS_DECODE_OPTION): Drop. * c-opts.c: Include opts.h and options.h instead of c-options.h and c-options.c. (lang_flags): Move to file scope. (find_opt, c_common_decode_option): Remove. (CL_C, CL_OBJC, CL_CXX, CL_OBJCXX, CL_JOINED, CL_SEPARATE, CL_REJECT_NEGATIVE): Move to opts.h. (missing_arg): Update prototype. (c_common_init_options): Update for new prototype. (c_common_handle_options): Filenames are passed as N_OPTS. * hooks.c (hook_int_void_0): New. * hooks.h (hook_int_void_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): New default. (LANG_HOOKS_HANDLE_OPTION): Default to NULL for now. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (init_options): Update. (handle_option): New. * opts.c, opts.h: New files. * opts.sh: Update c file to include opts.h and options.h. * toplev.c: Include opts.h; change options.h to options_.h. (parse_options_and_default_flags): Get lang_mask, use handle_option for language-specific handling. * objc/objc-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. (objc_init_options): Update. ada: * misc.c (gnat_init_options): Update. cp: * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. * cp-tree.h (cxx_init_options): Update. * lex.c (cxx_init_options): Update. f: * com.c (ffe_init_options): Update. java: * lang.c (java_init_options): Update. From-SVN: r67584
2003-06-07 13:10:46 +02:00
#undef LANG_HOOKS_HANDLE_OPTION
#define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
#undef LANG_HOOKS_MISSING_ARGUMENT
#define LANG_HOOKS_MISSING_ARGUMENT c_common_missing_argument
#undef LANG_HOOKS_POST_OPTIONS
#define LANG_HOOKS_POST_OPTIONS c_common_post_options
alias.c (can_address_p): Compnonents are not addressable if the containing type has alias set 0. * alias.c (can_address_p): Compnonents are not addressable if the containing type has alias set 0. (get_alias_set): Rework to use STRIP_NOPS. Only call front-end routine on object, type, or object with NOPs stripped, not inner values. Use language hook to call front-end routine. * builtins.c (get_memory_rtx): Always call set_mem_attributes. (expand_builtin_apply): Call set_mem_align on MEMs we make. Don't pass alignment to emit_block_move. (expand_builtin_memcpy, expand_builtin_va_copy): Likewise. (expand_builtin_memset): Likewise, but for clear_storage. * c-common.c (lang_get_alias_set): Renamed to c_common_alias_set and remove C++ specific parts. * c-common.h (c_common_get_alias_set): Add declaration. * c-lang.c (LANG_HOOKS_GET_ALIAS_SET): New macro. * calls.c (emit_call_1): Fix typo in sibcall_pop case. (save_fixed_argument_area): Call set_mem_align. Remove alignment in call to emit_block_move. (emit_library_call_value_1, store_one_arg): Likewise. (target_for_arg): Remove; disabled long ago. * emit-rtl.c (set_mem_attributes): Rework to only call get_mem_attrs once and similar cleanups. (offset_address): Use proper introductory comment. * expr.c (emit_block_move): Use alignment from that of MEM args, not from explicit operand; all callers changed. (clear_storage): Likewise. (expand_assignment): Don't call set_mem_alias_set on to_rtx. (store_field): Remove kludge on alias set used for to_rtx. (highest_pow2_factor, case *_DIV_EXPR): Never return 0. (expand_expr_unaligned): Call set_mem_attributes instead of set_mem_alias_set. * expr.h (emit_block_move, clear_storage): Remove ALIGN argument. * function.c (assign_stack_temp_for_type): Set MEM alignment. (expand_function_end): Track MEM attributes of trampolines. * ifcvt.c (noce_try_cmove_arith): Set alignment of new MEM. * integrate.c (copy_rtx_and_substitute, case CALL): Copy memory attributes from original. * langhooks.c (lang_hook_default_get_alias_set): New function. (hook_get_alias_set_0): New function. * langhooks.h (hook_get_alias_set_0): New declaration. (lang_hook_default_get_alias_set): Likewise. (LANG_HOOKS_GET_ALIAS_SET): New macro; add to initializer. * reload1.c (alter_reg): Use adjust_address_nv. * rtl.c (get_mode_alignment): Moved to here. * rtl.h (MEM_ALIGN): Take default from mode, if not BLKmode, and change default if unknown from 1 to BITS_PER_UNIT. * stor-layout.c (get_mode_alignment): Remove from here. * toplev.h (struct lang_hoks): Add get_alias_set field. * tree.h (lang_get_alias_set): Delete declaration. * config/arc/arc.c (arc_setup_incoming_varags): Set MEM alignment. * config/i386/i386.c (ix86_setup_incoming_varargs): Likewise. (ix86_va_arg): Likewise. * config/i960/i960.c (i960_setup_incoming_varargs): Likewise. * config/pa/pa.c (hppa_builtin_saveregs): Likewise. * config/sparc/sparc.c (sparc_va_arg): Likewise. * config/rs6000/rs6000.c (setup_incoming_varargs): Likewise. (expand_block_move_mem): Remove dead code. * cp/cp-lang.c (cxx_get_alias_set): New function. Point LANG_HOOKS_GET_ALIAS_SET to it. * f/com.c (LANG_HOOKS_GET_ALIAS_SET): New macro. (lang_get_alias_set): Delete. * java/lang.c (lang_get_alias_set): Deleted. From-SVN: r46440
2001-10-23 20:51:18 +02:00
#undef LANG_HOOKS_GET_ALIAS_SET
#define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
Makefile.in (c-lang.o): Depends on langhooks-def.h. * Makefile.in (c-lang.o): Depends on langhooks-def.h. (expr.o, varasm.o): Depends on langhooks.h. * c-common.c (c_safe_from_p): Always declare. (c_expand_expr): Refine when declared. * c-lang.c (c-common.h): Now include. (LANG_HOOKS_SAFE_FROM_P): Define new hook. (c_init): Don't set lang_safe_from_expr. * expr.c (langhooks.h): Now include. (lang_safe_from_p): No longer define. (safe_from_p): Use lang hook. (expand_expr): Set IGNORE if VOID_TYPE result of VIEW_CONVERT_EXPR too. (expand_expr, case VIEW_CONVERT_EXPR): Pass ro_modifier down. * expr.h (lang_expand_constant, lang_safe_from_p): Delete. * langhooks-def.h (lhd_return_tree, lhd_safe_from_p): New decls. (LANG_HOOKS_EXPAND_CONSTANT, LANG_HOOKS_SAFE_FROM_P): New hooks. * langhooks.c (lhd_return_tree, lhd_safe_from_p): New functions. * langhooks.h (struct lang_hooks): New fields expand_constant and safe_from_p. * output.h (output_constant): Size arg is HOST_WIDE_INT. * stmt.c (expand_decl_init): No longer need to expand constant for CONST_DECL. * stor-layout.c (put_pending_size): Don't check for SAVE_EXPR. * toplev.c (lang_expand_constant): Delete var. * tree.c (save_expr): Don't put another SAVE_EXPR around simple operations on SAVE_EXPR. * varasm.c (langhooks.h): Now include. (compare_constant_1): Use lang_hooks, not lang_expand_constant. (record_constant_1, output_addressed_constants): Likewise. (initializer_constant_valid_p, output_constant): Likewise. (output_constant_def): Process no-defer of string constant. (output_addressed_constants, case ADDR_EXPR): Use handled_component_p. (output_constant): Strip more conversions. Track our size and pad for the rest. (array_size_for_constructor): Remove code for non-byte STRING_CST. (output_constructor): SIZE now HOST_WIDE_INT. * cp/Make-lang.in (cp-lang.o): Depends on c-common.h. * cp/cp-lang.c (c-common.h): Include. (LANG_HOOKS_EXPAND_CONSTANT, LANG_HOOKS_SAFE_FROM_P): New hooks. * cp/decl.c (cxx_init_decl_processing): Don't set lang_safe_from_p. * cp/expr.c (init_cplus_expand): Don't set lang_expand_constant. From-SVN: r47376
2001-11-27 15:31:29 +01:00
#undef LANG_HOOKS_SAFE_FROM_P
#define LANG_HOOKS_SAFE_FROM_P c_safe_from_p
#undef LANG_HOOKS_EXPAND_EXPR
#define LANG_HOOKS_EXPAND_EXPR c_expand_expr
#undef LANG_HOOKS_EXPAND_DECL
#define LANG_HOOKS_EXPAND_DECL c_expand_decl
c-decl.c (grokdeclarator): Update. * c-decl.c (grokdeclarator): Update. * c-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * c-tree.h (c_mark_addressable): New. * c-typeck.c (default_function_array_conversion, build_unary_op, build_array_ref, convert_for_assignment): Update. (mark_addressable): Rename. * calls.c (try_to_integrate, expand_call): Use langhook. * expr.c (expand_expr): Use langhook. * langhooks-def.h (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (struct lang_hooks): New hook. * stmt.c (expand_asm_operands): Use langhook. * tree.h (mark_addressable): Remove. ada: * decl.c (gnat_to_gnu_entity): Update. * gigi.h (mark_addressable): Rename. * misc.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * trans.c (tree_transform): Update. * utils.c (create_var_decl): Update. * util2.c (build_binary_op, build_unary_op, fill_vms_descriptor): Update. (mark_addressable): Rename, update. cp: * call.c (build_addr_func): Update. * class.c (resolve_address_of_overloaded_function): Update. * cp-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * cp-tree.h (cxx_mark_addressable): New. * decl.c (register_dtor_fn, cxx_maybe_build_cleanup): Update. * decl2.c (build_cleanup): Update. * except.c (build_throw): Update. * init.c (resolve_offset_ref): Update. * pt.c (convert_nontype_argument): Update. * semantics.c (finish_asm_stmt, simplify_affr_init_exprs_r): Update. * typeck.c (decay_conversion, build_array_ref, build_unary_op, unary_complex_lvalue): Update. (mark_addressable): Rename. f: * com.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. (mark_addressable): Rename. (ffecom_arrayref_, ffecom_1): Update. java: * java-tree.h (java_mark_addressable): New. * lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. * typeck.c (mark_addressable): Rename, update. objc: * objc-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine. From-SVN: r51705
2002-04-01 22:26:18 +02:00
#undef LANG_HOOKS_MARK_ADDRESSABLE
#define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
#undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE c_common_parse_file
PR 12267, 12391, 12560, 13129, 14114, 14113 * c-tree.h: Forward declare struct c_binding. Declare c_override_bindings_to_false. Update prototypes. (struct lang_identifier): Update comments. Change fields to be struct c_binding *. (IDENTIFIER_SYMBOL_VALUE, IDENTIFIER_TAG_VALUE) (IDENTIFIER_LABEL_VALUE, C_DECL_INVISIBLE) (KEEP_NO, KEEP_YES, KEEP_MAYBE): Delete. (C_DECL_IN_EXTERNAL_SCOPE, C_DECL_DECLARED_BUILTIN): New. * c-common.h: Update prototypes. * c-decl.c (struct c_scope): Update commentary. Remove names, names_last, parms, parms_last, tags, and shadowed fields. Add bindings and depth fields. (scope_freelist): Move to more appropriate location. (c_print_identifier): Update for changes to struct lang_identifier. (objc_mark_locals_volatile): Update for new bindings structures. (global_bindings_p): Honor c_override_global_bindings_to_false. (pushlevel): Rename to push_scope; take no arguments; use the scope_freelist; initialize scope->depth and check for overflow. (poplevel): Rename to pop_scope; totally rewritten for new bindings structures. (diagnose_mismatched_decls): Use C_DECL_DECLARED_BUILTIN, not C_DECL_INVISIBLE, for certain decisions. Adjust some diagnostics. Improve some commentary. Adjust handling of forward parm decls. (merge_decls): Set C_DECL_DECLARED_BUILTIN when appropriate. Preserve C_DECL_IN_EXTERNAL_SCOPE. (warn_if_shadowing): Correct indentation. Improve diagnostics. (pushdecl): Remove unnecessary assertion. Short-circuit anonymous decls. Rewrite for new bindings structures. Improve commentary. Eliminate the copy_node call. (implicit_decl_warning): Use the "diag" idiom (as seen in locate_old_decl) to reduce code duplication; call locate_old_decl if appropriate. Relocate to remove need for forward declaration. (implicitly_declare): Adjust for new bindings structures. Kludge around Objective-C not-really-builtin functions. (undeclared_variable): Improve diagnostics. If current_function_decl is nonnull but current_function_scope is null, use current_scope. Use bind. (lookup_tag): Adjust for new bindings structures. Kludge around Objective-C's tag declarations that wind up in the external scope. (lookup_name): Adjust for new bindings structures. Kludge around c-common.c's pseudo-typedefs that wind up in the external scope. (lookup_name_current_level): Rename lookup_name_in_scope; take a second argument indicating the scope to examine; rewrite for new bindings structures. (c_init_decl_processing): Adjust for renamed functions. Do not initialize current_file_decl, first_builtin_decl, last_builtin_decl. First scope pushed is the external scope, not the global scope. (builtin_function): Use bind, not pushdecl. Adjust other bits for new data structures. Keep track of builtins that should be made visible automatically. (start_decl): Adjust diagnostics. Remove unnecessary call to expand_decl. (grokparms): Return 0 if arg_types is error_mark_node. (get_parm_info): Rename "void_at_end" argument to "ellipsis", with reversed sense. Rewrite for new bindings structures. Do not leave any decls in the scope, to prevent pop_scope from doing contradictory things with them. (finish_struct, finish_enum): Remove redundant diagnostics. (build_enumerator): Don't cascade diagnostics for error_mark_node. Mark location where -pedantic changes the meaning of the program. (store_parm_decls_newstyle, store_parm_decls_oldstyle): Load the parameter decls into the function's scope structure using bind. Warn here about function definitions in the wrong style. Adjust diagnostics. (store_parm_decls): Correct the determination of whether a function was defined with a prototype. (c_write_global_declarations): Operate on all file decls and on the external scope. Split body of the loop to... (c_write_global_declarations_1): ... this new function, to avoid code duplication. (truly_local_externals, first_builtin_decl, last_builtin_decl) (make_scope, pop_scope, in_parm_level_p, set_block) (any_external_decl, record_external_decl, bind_label, getdecls) (link_hash_hash, link_hash_eq, merge_translation_unit_decls) (c_reset_state): Delete. (visible_builtins, c_override_global_bindings_to_false) (c_binding, I_SYMBOL_BINDING, I_SYMBOL_DECL, I_TAG_BINDING) (I_TAG_DECL, I_LABEL_BINDING, I_LABEL_DECL, file_scope) (external_scope, binding_freelist, bind, free_binding_and_advance) (push_file_scope, pop_file_scope): New. (pushtag, pushdecl_top_level, lookup_label, declare_label) (define_label, c_make_fname_decl, finish_decl) (mark_forward_parm_decls, build_compound_literal) (grokdeclarator, start_function, check_for_loop_decls) (identifier_global_value, record_builtin_type): Minor adjustments for new bindings structures. Improve diagnostics and commentary. * c-objc-common.c (start_cdtor, finish_cdtor): Adjust calls to pushlevel/poplevel respectively. (c_objc_common_finish_file): Don't call merge_translation_unit_decls. * c-opts.c (c_common_parse_file): Remove spurious ATTRIBUTE_UNUSED. Warn about YYDEBUG not being defined only if -dy. Remove no-longer- correct loop over multiple translation units; call fatal_error if requested to compile more than one file at once. (This disables IMA temporarily - an up-front error being preferable to a crash.) * c-parse.in (pushlevel, poplevel rules): Rename push_scope, pop_scope. (all actions): Adjust calls to pushlevel/poplevel. (parsing_iso_function_signature): Delete. (extdef_1): Fold into extdef. (old_style_parm_decls_1): Fold into old_style_parm_decls. Don't warn here about function definitions in the wrong style. (after_tyle_declarator, parm_declarator_starttypename) (parm_declarator_nostarttypename, notype_declarator): Remove commented-out productions. (parmlist_1, parmlist_2): Use make_node, not tree_cons, to create an empty TREE_LIST node. Adjust calls to get_parm_info. (parmlist_2 : ELLIPSIS): Tag the arg-info block with error_mark_node to suppress -Wold-style-definition after this error. (c_parse_file): Don't clear the binding stack or call finish_fname_decls here. Correct comment. * c-typeck.c (same_translation_unit_p): Export. (common_type): Use c_override_global_bindings_to_false, not pushlevel/poplevel/declare_parm_level. * c-lang.c: Override LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK, and LANG_HOOKS_GETDECLS with do-nothing stubs. * objc/objc-lang.c: Likewise. * objc/objc-act.c: Adjust all calls to pushlevel, poplevel, get_parm_info. (OBJC_VOID_AT_END): Delete; replace all uses with void_list_node. (generate_forward_declaration_to_string_table): Delete. * objc/objc-act.h (OCTI_STRG_DECL, UOBJC_STRINGS_decl): Delete. * coverage.c (create_coverage): Don't pushdecl anything. * langhooks.c (lhd_clear_binding_stack): Call lang_hooks.decls.poplevel, not poplevel. * tree.c (list_length): If ENABLE_TREE_CHECKING, abort on a circular list rather than going into an infinite loop. cp: * cp-lang.c (c_reset_state): Delete. (push_file_scope, pop_file_scope): New stubs. * parser.c (c_parse_file): Call sorry() here if called more than once. testsuite: * gcc.dg/Wold-style-definition-1.c, gcc.dg/builtins-30.c * gcc.dg/unused-4.c, gcc.dg/noncompile/label-1.c * gcc.dg/noncompile/label-lineno-1.c, objc.dg/naming-1.m: Adjust error regexps. * gcc.dg/Wshadow-2.c, gcc.dg/noncompile/incomplete-3.c * gcc.dg/noncompile/undeclared-1.c: New test cases. * gcc.dg/decl-5.c, gcc.dg/redecl-1.c: Remove XFAIL. * gcc.dg/local1.c: Add explanatory comment. From-SVN: r79883
2004-03-24 00:47:53 +01:00
#undef LANG_HOOKS_CLEAR_BINDING_STACK
#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing
c-common.c (truthvalue_conversion): Rename, update. * c-common.c (truthvalue_conversion): Rename, update. * c-common.h (c_common_truthvalue_conversion): New. * c-convert.c (convert): Update. * c-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. * c-parse.in (expr_no_commas, if_prefix, select_or_iter_stmt): Update. * c-typeck.c (build_binary_op, build_unary_op, build_conditional_expr): Update. * fold-const.c (constant_boolean_node, fold): Use langhook. * langhooks-def.h (LANGHOOK_INITIALIZER): Update. * langhooks.h (struct lang_hooks): New hook. * stmt.c (expand_decl_cleanup): Use langhook. * tree.h (truthvalue_conversion): Remove. ada: * gigi.h (truthvalue_conversion): Rename. * misc.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. * trans.c (tree_transform): Update. * utils2.c (truthvalue_conversion): Rename, update. (build_binary_op, build_unary_op): Update. cp: * cp-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. * cvt.c: Update comment. * init.c (expand_cleanup_for_base): Update. * semantics.c (finish_parenthesized_expr): Update. * typeck.c (cp_truthvalue_conversion): Update. f: * com.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. (truthvalue_conversion): Rename. Update. Make static. (ffecom_truth_value): Update. java: * expr.c (truthvalue_conversion): Rename. Update. (expand_compare): Update. * java-tree.h (java_truthvalue_conversion): New. * lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. objc: * objc-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine. From-SVN: r51880
2002-04-05 00:19:58 +02:00
#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
#undef LANG_HOOKS_STATICP
#define LANG_HOOKS_STATICP c_staticp
#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME c_static_assembler_name
#undef LANG_HOOKS_NO_BODY_BLOCKS
#define LANG_HOOKS_NO_BODY_BLOCKS true
#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
Makefile.in: Update. * Makefile.in: Update. * c-decl.c (print_lang_decl, print_lang_type): Remove. (print_lang_identifier): Rename c_print_identifier. * c-lang.c (LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): New. (print_lang_statistics, lang_print_xnode): Remove. * c-parse.in (set_yydebug): Rename c_set_yydebug. * c-tree.h (c_set_yydebug, c_print_identifier): New. * langhooks-def.h (lhd_print_tree_nothing, lhd_set_yydebug): New. LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE, LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE, LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): New. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (struct lang_hooks): New members. (lang_print_tree_hook): New. * langhooks.c (lhd_print_tree_nothing, lhd_set_yydebug): New. * print-tree.c: Include langhooks.h. (print_node): Update. * toplev.c (decode_d_option): Update. * tree.c: Include langhooks.h. (dump_tree_statistics): Update. * tree.h (print_lang_statistics, print_lang_decl, print_lang_type, print_lang_identifier, set_yydebug, lang_print_xnode): Remove. ada: * misc.c (gnat_print_decl, gnat_print_type): Renamed. (LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE): Override. (print_lang_statistics, lang_print_xnode, print_lang_identifier, set_yydebug): Remove. cp: * cp-lang.c (LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE, LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE, LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): Override. * cp-tree.h (print_class_statistics): Remove. (cxx_print_statistics, cxx_print_xnode, cxx_print_decl, cxx_print_type, cxx_print_identifier, cxx_set_yydebug): New. * lex.c (set_yydebug): Rename c_set_yydebug. * ptree.c (print_lang_decl, print_lang_type, print_lang_identifier, lang_print_xnode): Rename. * tree.c (print_lang_statistics): Rename. f: * com.c (ffe_print_identifier): Rename. (LANG_HOOKS_PRINT_IDENTIFIER): Override. (lang_print_xnode, print_lang_decl, print_lang_statistics, print_lang_type, set_yydebug): Remove. java: * java-tree.h (java_set_yydebug): New. * jcf-parse.c (set_yydebug): Rename java_set_yydebug. * lang.c (LANG_HOOKS_SET_YYDEBUG): Override. (print_lang_decl, print_lang_type, print_lang_identifier, print_lang_statistics, lang_print_xnode): Remove. objc: * objc-act.c (LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): Override. (lang_print_xnode, print_lang_statistics): Remove. From-SVN: r46907
2001-11-10 00:30:44 +01:00
#undef LANG_HOOKS_PRINT_IDENTIFIER
#define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
Makefile.in: Update. * Makefile.in: Update. * decl.c (push_c_function_context, pop_c_function_context, mark_c_function_context): Rename for consistency. * c-objc-common.c (c_objc_common_init): Langhooks set elsewhere. * c-tree.h (push_c_function_context, pop_c_function_context, mark_c_function_context): Rename for consistency. * c-lang.c (LANG_HOOKS_FUNCTION_ENTER_NESTED, LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK): Redefine. * function.c (init_lang_status, save_lang_status, restore_lang_status, mark_lang_status, free_lang_status): Move to langhooks.h. (push_function_context_to, pop_function_context_from, free_after_parsing, prepare_function_start, ggc_mark_struct_function): Update. * function.h (init_lang_status, save_lang_status, restore_lang_status, mark_lang_status, free_lang_status): Move to langhooks.h. * langhooks-def.h (LANG_HOOKS_FUNCTION_INIT, LANG_HOOKS_FUNCTION_FREE, LANG_HOOKS_FUNCTION_ENTER_NESTED, LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK, LANG_HOOKS_FUNCTION_INITIALIZER): New. (LANG_HOOKS_INITIALIZER): Update. (lhd_do_nothing_f): New. * langhooks.h (struct lang_hooks_for_functions): New. (struct lang_hooks): New hooks. * langhooks.c (lhd_do_nothing_f): New. cp: * cp-lang.c (LANG_HOOKS_FUNCTION_INIT, LANG_HOOKS_FUNCTION_FREE, LANG_HOOKS_FUNCTION_MARK): Redefine. * cp-tree.h (cxx_push_function_context, cxx_pop_function_context, cxx_mark_function_context): New. * decl.c (push_cp_function_context, pop_cp_function_context, mark_cp_function_context): Rename for consistency. (cxx_init_decl_processing): Don't set old hooks. objc: * objc-lang.c (LANG_HOOKS_FUNCTION_ENTER_NESTED, LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK): Redefine. From-SVN: r52551
2002-04-20 11:14:37 +02:00
#undef LANG_HOOKS_FUNCTION_ENTER_NESTED
#define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
#undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
#define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
#undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
tree-optimize.c: New file. gcc/ * tree-optimize.c: New file. * Makefile.in (OBJS-archive): Add tree-optimize.o. (tree-optimize.o): New. * c-decl.c (store_parm_decls): Use allocate_struct_function. (finish_function): Don't free_after_parsing or free_after_compilation. (set_save_expr_context): Move to tree-optimize.c. (c_expand_body_1): Use tree_rest_of_compilation. * c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * c-objc-common.c (expand_deferred_fns): Don't emit unused inlines; iterate until closure. * langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New. (LANG_HOOKS_RTL_EXPAND_INITIALIZER): New. * langhooks.h (struct lang_hooks_for_rtl_expansion): New. * toplev.h (tree_rest_of_compilation): Declare it. gcc/cp/ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New. (LANG_HOOKS_RTL_EXPAND_STMT): New. * cp-tree.h (cxx_expand_function_start): Declare. * decl.c (start_function): Use allocate_struct_function. Move stmts_are_full_exprs_p assertion from expand_body. Do not free_after_parsing or free_after_compilation. (cxx_push_function_context): Move code to set struct function data from genrtl_start_function. * optimize.c (optimize_function): Don't inc/dec function_depth. * semantics.c (expand_body): Use tree_rest_of_compilation. (cxx_expand_function_start): Rename from genrtl_start_function, omit bits done by tree_rest_of_compilation. (genrtl_finish_function): Remove. (clear_decl_rtl): Move to ../tree-optimize.c. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r70933
2003-08-30 01:21:13 +02:00
attribs.c (c_common_attribute_table): Move table and handlers to c-common.c. * attribs.c (c_common_attribute_table): Move table and handlers to c-common.c. (format_attribute_table, lang_attribute_table, lang_attribute_common): Remove. (init_attributes): Replace NULL pointers with pointers to the empty table. (handle_packed_attribute, handle_nocommon_attribute, handle_common_attribute, handle_noreturn_attribute, handle_noinline_attribute, handle_always_inline_attribute, handle_used_attribute, handle_unused_attribute, handle_const_attribute, handle_transparent_union_attribute, handle_constructor_attribute, handle_destructor_attribute, handle_mode_attribute, handle_section_attribute, handle_aligned_attribute, handle_weak_attribute, handle_alias_attribute, handle_visibility_attribute, handle_no_instrument_function_attribute, handle_malloc_attribute, handle_no_limit_stack_attribute, handle_pure_attribute, handle_deprecated_attribute, handle_vector_size_attribute, vector_size_helper): Move to c-common.c. * c-common.c (c_common_attribute_table, handle_packed_attribute, handle_nocommon_attribute, handle_common_attribute, handle_noreturn_attribute, handle_noinline_attribute, handle_always_inline_attribute, handle_used_attribute, handle_unused_attribute, handle_const_attribute, handle_transparent_union_attribute, handle_constructor_attribute, handle_destructor_attribute, handle_mode_attribute, handle_section_attribute, handle_aligned_attribute, handle_weak_attribute, handle_alias_attribute, handle_visibility_attribute, handle_no_instrument_function_attribute, handle_malloc_attribute, handle_no_limit_stack_attribute, handle_pure_attribute, handle_deprecated_attribute, handle_vector_size_attribute, vector_size_helper): Move from attribs.c. * c-common.h (c_common_attribute_table, c_common_format_attribute_table): New. * c-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine. * langhooks-def.h (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE): New. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (struct lang_hooks): 3 new attribute hooks. * target-def.h (TARGET_ATTRIBUTE_TABLE): Default to NULL. * target.h: Update comment. * tree.c (default_target_attribute_table): Remove. * tree.h (default_target_attribute_table, format_attribute_table, lang_attribute_table, lang_attribute_common): Remove. ada: * misc.c (gnat_init): Don't set lang_attribute_common. cp: * cp-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE): Redefine. * cp-tree.h (cp_attribute_table): Rename. * decl.c (lang_attribute_table): Remove declaration. (cxx_init_decl_processing): Don't set it. * tree.c (cp_attribute_table): Rename. objc: * objc-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine. From-SVN: r52730
2002-04-24 22:41:04 +02:00
/* Attribute hooks. */
#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE c_common_attribute_table
#undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE c_common_format_attribute_table
#undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES \
c_walk_subtrees
#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
c_cannot_inline_tree_fn
#undef LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS
#define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
c_disregard_inline_limits
#undef LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P
#define LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P \
c_tree_chain_matters_p
#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
anon_aggr_type_p
#undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
c_convert_parm_for_inlining
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN c_dump_tree
#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION c_expand_body
Makefile.in (convert.o, [...]): Update. * Makefile.in (convert.o, calls.o, expmed.o): Update. * attribs.c (handle_mode_attribute, handle_vector_size_attribute): Use new hooks. * builtin-types.def (BT_PTRMODE): Update. * c-common.c (type_for_size): Rename c_common_type_for_size. (type_for_mode): Similarly. (shorten_compare, pointer_int_sum, c_common_nodes_and_builtins): Use new hook. * c-bommon.h (c_common_type_for_size, c_common_type_for_mode): New. * c-decl.c (finish_enum, build_enumerator): Use new hooks. * c-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): Redefine. * c-typeck.c (common_type, comptypes, default_conversion): Use new hooks. * calls.c: Include langhooks.h. (emit_library_call_value_1): Use new hooks. Avoid redundant calls. * convert.c: Include langhooks.h (convert_to_pointer, convert_to_integer): Use new hooks. * except.c (init_eh): Similarly. * expmed.c: Include langhooks.h. (expand_mult_add): Use new hooks. * expr.c (store_expr, store_constructor, expand_expr, do_jump, try_casesi): Similarly. * fold-const.c (optimize_bit_field_compare, make_range, decode_field_reference, fold_truthop, fold): Similarly. * function.c (assign_stack_local_1, assign_stack_temp_for_type, put_var_into_stack): Similarly. * langhooks-def.h (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): New. (LANG_HOOKS_TYPES_INITIALIZER): Update. * langhooks.h (lang_hooks_for_types): New hooks. * stmt.c (expand_decl_cleanup, emit_case_nodes): Use new hooks. * tree.c (get_unwidened, get_narrower): Similarly. * tree.h (type_for_mode, type_for_size): Remove. * varasm.c (force_const_mem): Use new hooks. ada: * gigi.h (type_for_size, type_for_mode): Rename. * misc.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): Redefine. * trans.c (tree_transform): Update. * utils.c (gnat_init_decl_processing, init_gigi_decls, builtin_function, float_type_for_size, signed_or_unsigned_type, build_vms_descriptor, unchecked_convert): Update. (type_for_mode, type_for_size): Rename. * utils2.c (nonbinary_modular_operation): Update. cp: * cp-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): Redefine. * cvt.c (cp_convert_to_pointer, type_promotes_to): Use new hooks. * decl.c (finish_enum): Similarly. * error.c (dump_type): Similarly. * lex.c (cxx_init): Similarly. * mangle.c (write_builtin_type): Similarly. * typeck.c (comptypes): Similarly. f: * com.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): Redefine. (type_for_mode, type_for_size): Rename. (signed_or_unsigned_type, signed_type, truthvalue_conversion, unsigned_type): Use new hooks. java: * Make-lang.in (builtins.o): Update. * boehm.c (get_boehm_type_descriptor): Update. * builtins.c: Include langhooks.h. * decl.c (java_init_decl_processing): Update. * java-tree.h (java_type_for_mode, java_type_for_size): New. * lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE): Redefine. * typeck.c (type_for_mode, type_for_size): Update. objc: * objc-act.c (handle_impent): Update. * objc-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE): Redefine. From-SVN: r51571
2002-03-29 22:46:27 +01:00
#undef LANG_HOOKS_TYPE_FOR_MODE
#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
#undef LANG_HOOKS_TYPE_FOR_SIZE
#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
c-common.c (unsigned_conversion_warning, [...]): Use new hooks. * c-common.c (unsigned_conversion_warning, convert_and_check, unsigned_type, signed_type, shorten_compare, c_common_get_alias_set, c_common_nodes_and_builtins): Use new hooks. (unsigned_type, signed_type, signed_or_unsigned_type): Rename. * c-common.h (unsigned_type, signed_type, signed_or_unsigned_type): New. * c-decl.c (grokdeclarator): Update. * c-format.c (check_format_types): Update. * c-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. * c-typeck.c (build_binary_op, convert_for_assignment): Update. * convert.c (convert_to_integer): Use new hooks. * expmed.c (make_tree): Use new hooks. * expr.c (store_expr): Use new hooks. * fold-const.c (operand_equal_for_comparison_p, build_range_check, all_ones_mask_p, unextend, fold): Use new hooks. * langhooks.h (struct lang_hooks_for_types): New hooks. * tree.h (signed_or_unsigned_type, signed_type, unsigned_type): Remove. ada: * gigi.h (unsigned_type, signed_type, signed_or_unsigned_type): Rename. * misc.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. * trans.c (tree_transform, convert_with_check): Update. * utils.c (unsigned_type, signed_type, signed_or_unsigned_type): Rename. cp: * cp-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. * decl.c (grokdeclarator): Update. * mangle.c (write_integer_cst): Update. * typeck.c (build_binary_op): Update. f: * com.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. (unsigned_type, signed_type, signed_or_unsigned_type): Rename. java: * expr.c (build_java_binop): Update. * java-tree.h (java_signed_type, java_unsigned_type, java_signed_or_unsigned_type): Update. * lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. * parse.y (patch_binop): Update. * typeck.c (signed_or_unsigned_type, unsigned_type, signed_type): Update. objc: * objc-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New. From-SVN: r51684
2002-04-01 10:46:10 +02:00
#undef LANG_HOOKS_SIGNED_TYPE
#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
#undef LANG_HOOKS_UNSIGNED_TYPE
#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
#undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR
#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error
#undef LANG_HOOKS_TYPE_PROMOTES_TO
#define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
#undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
#define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type
Makefile.in (convert.o, [...]): Update. * Makefile.in (convert.o, calls.o, expmed.o): Update. * attribs.c (handle_mode_attribute, handle_vector_size_attribute): Use new hooks. * builtin-types.def (BT_PTRMODE): Update. * c-common.c (type_for_size): Rename c_common_type_for_size. (type_for_mode): Similarly. (shorten_compare, pointer_int_sum, c_common_nodes_and_builtins): Use new hook. * c-bommon.h (c_common_type_for_size, c_common_type_for_mode): New. * c-decl.c (finish_enum, build_enumerator): Use new hooks. * c-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): Redefine. * c-typeck.c (common_type, comptypes, default_conversion): Use new hooks. * calls.c: Include langhooks.h. (emit_library_call_value_1): Use new hooks. Avoid redundant calls. * convert.c: Include langhooks.h (convert_to_pointer, convert_to_integer): Use new hooks. * except.c (init_eh): Similarly. * expmed.c: Include langhooks.h. (expand_mult_add): Use new hooks. * expr.c (store_expr, store_constructor, expand_expr, do_jump, try_casesi): Similarly. * fold-const.c (optimize_bit_field_compare, make_range, decode_field_reference, fold_truthop, fold): Similarly. * function.c (assign_stack_local_1, assign_stack_temp_for_type, put_var_into_stack): Similarly. * langhooks-def.h (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): New. (LANG_HOOKS_TYPES_INITIALIZER): Update. * langhooks.h (lang_hooks_for_types): New hooks. * stmt.c (expand_decl_cleanup, emit_case_nodes): Use new hooks. * tree.c (get_unwidened, get_narrower): Similarly. * tree.h (type_for_mode, type_for_size): Remove. * varasm.c (force_const_mem): Use new hooks. ada: * gigi.h (type_for_size, type_for_mode): Rename. * misc.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): Redefine. * trans.c (tree_transform): Update. * utils.c (gnat_init_decl_processing, init_gigi_decls, builtin_function, float_type_for_size, signed_or_unsigned_type, build_vms_descriptor, unchecked_convert): Update. (type_for_mode, type_for_size): Rename. * utils2.c (nonbinary_modular_operation): Update. cp: * cp-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): Redefine. * cvt.c (cp_convert_to_pointer, type_promotes_to): Use new hooks. * decl.c (finish_enum): Similarly. * error.c (dump_type): Similarly. * lex.c (cxx_init): Similarly. * mangle.c (write_builtin_type): Similarly. * typeck.c (comptypes): Similarly. f: * com.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE): Redefine. (type_for_mode, type_for_size): Rename. (signed_or_unsigned_type, signed_type, truthvalue_conversion, unsigned_type): Use new hooks. java: * Make-lang.in (builtins.o): Update. * boehm.c (get_boehm_type_descriptor): Update. * builtins.c: Include langhooks.h. * decl.c (java_init_decl_processing): Update. * java-tree.h (java_type_for_mode, java_type_for_size): New. * lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE): Redefine. * typeck.c (type_for_mode, type_for_size): Update. objc: * objc-act.c (handle_impent): Update. * objc-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE): Redefine. From-SVN: r51571
2002-03-29 22:46:27 +01:00
PR 12267, 12391, 12560, 13129, 14114, 14113 * c-tree.h: Forward declare struct c_binding. Declare c_override_bindings_to_false. Update prototypes. (struct lang_identifier): Update comments. Change fields to be struct c_binding *. (IDENTIFIER_SYMBOL_VALUE, IDENTIFIER_TAG_VALUE) (IDENTIFIER_LABEL_VALUE, C_DECL_INVISIBLE) (KEEP_NO, KEEP_YES, KEEP_MAYBE): Delete. (C_DECL_IN_EXTERNAL_SCOPE, C_DECL_DECLARED_BUILTIN): New. * c-common.h: Update prototypes. * c-decl.c (struct c_scope): Update commentary. Remove names, names_last, parms, parms_last, tags, and shadowed fields. Add bindings and depth fields. (scope_freelist): Move to more appropriate location. (c_print_identifier): Update for changes to struct lang_identifier. (objc_mark_locals_volatile): Update for new bindings structures. (global_bindings_p): Honor c_override_global_bindings_to_false. (pushlevel): Rename to push_scope; take no arguments; use the scope_freelist; initialize scope->depth and check for overflow. (poplevel): Rename to pop_scope; totally rewritten for new bindings structures. (diagnose_mismatched_decls): Use C_DECL_DECLARED_BUILTIN, not C_DECL_INVISIBLE, for certain decisions. Adjust some diagnostics. Improve some commentary. Adjust handling of forward parm decls. (merge_decls): Set C_DECL_DECLARED_BUILTIN when appropriate. Preserve C_DECL_IN_EXTERNAL_SCOPE. (warn_if_shadowing): Correct indentation. Improve diagnostics. (pushdecl): Remove unnecessary assertion. Short-circuit anonymous decls. Rewrite for new bindings structures. Improve commentary. Eliminate the copy_node call. (implicit_decl_warning): Use the "diag" idiom (as seen in locate_old_decl) to reduce code duplication; call locate_old_decl if appropriate. Relocate to remove need for forward declaration. (implicitly_declare): Adjust for new bindings structures. Kludge around Objective-C not-really-builtin functions. (undeclared_variable): Improve diagnostics. If current_function_decl is nonnull but current_function_scope is null, use current_scope. Use bind. (lookup_tag): Adjust for new bindings structures. Kludge around Objective-C's tag declarations that wind up in the external scope. (lookup_name): Adjust for new bindings structures. Kludge around c-common.c's pseudo-typedefs that wind up in the external scope. (lookup_name_current_level): Rename lookup_name_in_scope; take a second argument indicating the scope to examine; rewrite for new bindings structures. (c_init_decl_processing): Adjust for renamed functions. Do not initialize current_file_decl, first_builtin_decl, last_builtin_decl. First scope pushed is the external scope, not the global scope. (builtin_function): Use bind, not pushdecl. Adjust other bits for new data structures. Keep track of builtins that should be made visible automatically. (start_decl): Adjust diagnostics. Remove unnecessary call to expand_decl. (grokparms): Return 0 if arg_types is error_mark_node. (get_parm_info): Rename "void_at_end" argument to "ellipsis", with reversed sense. Rewrite for new bindings structures. Do not leave any decls in the scope, to prevent pop_scope from doing contradictory things with them. (finish_struct, finish_enum): Remove redundant diagnostics. (build_enumerator): Don't cascade diagnostics for error_mark_node. Mark location where -pedantic changes the meaning of the program. (store_parm_decls_newstyle, store_parm_decls_oldstyle): Load the parameter decls into the function's scope structure using bind. Warn here about function definitions in the wrong style. Adjust diagnostics. (store_parm_decls): Correct the determination of whether a function was defined with a prototype. (c_write_global_declarations): Operate on all file decls and on the external scope. Split body of the loop to... (c_write_global_declarations_1): ... this new function, to avoid code duplication. (truly_local_externals, first_builtin_decl, last_builtin_decl) (make_scope, pop_scope, in_parm_level_p, set_block) (any_external_decl, record_external_decl, bind_label, getdecls) (link_hash_hash, link_hash_eq, merge_translation_unit_decls) (c_reset_state): Delete. (visible_builtins, c_override_global_bindings_to_false) (c_binding, I_SYMBOL_BINDING, I_SYMBOL_DECL, I_TAG_BINDING) (I_TAG_DECL, I_LABEL_BINDING, I_LABEL_DECL, file_scope) (external_scope, binding_freelist, bind, free_binding_and_advance) (push_file_scope, pop_file_scope): New. (pushtag, pushdecl_top_level, lookup_label, declare_label) (define_label, c_make_fname_decl, finish_decl) (mark_forward_parm_decls, build_compound_literal) (grokdeclarator, start_function, check_for_loop_decls) (identifier_global_value, record_builtin_type): Minor adjustments for new bindings structures. Improve diagnostics and commentary. * c-objc-common.c (start_cdtor, finish_cdtor): Adjust calls to pushlevel/poplevel respectively. (c_objc_common_finish_file): Don't call merge_translation_unit_decls. * c-opts.c (c_common_parse_file): Remove spurious ATTRIBUTE_UNUSED. Warn about YYDEBUG not being defined only if -dy. Remove no-longer- correct loop over multiple translation units; call fatal_error if requested to compile more than one file at once. (This disables IMA temporarily - an up-front error being preferable to a crash.) * c-parse.in (pushlevel, poplevel rules): Rename push_scope, pop_scope. (all actions): Adjust calls to pushlevel/poplevel. (parsing_iso_function_signature): Delete. (extdef_1): Fold into extdef. (old_style_parm_decls_1): Fold into old_style_parm_decls. Don't warn here about function definitions in the wrong style. (after_tyle_declarator, parm_declarator_starttypename) (parm_declarator_nostarttypename, notype_declarator): Remove commented-out productions. (parmlist_1, parmlist_2): Use make_node, not tree_cons, to create an empty TREE_LIST node. Adjust calls to get_parm_info. (parmlist_2 : ELLIPSIS): Tag the arg-info block with error_mark_node to suppress -Wold-style-definition after this error. (c_parse_file): Don't clear the binding stack or call finish_fname_decls here. Correct comment. * c-typeck.c (same_translation_unit_p): Export. (common_type): Use c_override_global_bindings_to_false, not pushlevel/poplevel/declare_parm_level. * c-lang.c: Override LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK, and LANG_HOOKS_GETDECLS with do-nothing stubs. * objc/objc-lang.c: Likewise. * objc/objc-act.c: Adjust all calls to pushlevel, poplevel, get_parm_info. (OBJC_VOID_AT_END): Delete; replace all uses with void_list_node. (generate_forward_declaration_to_string_table): Delete. * objc/objc-act.h (OCTI_STRG_DECL, UOBJC_STRINGS_decl): Delete. * coverage.c (create_coverage): Don't pushdecl anything. * langhooks.c (lhd_clear_binding_stack): Call lang_hooks.decls.poplevel, not poplevel. * tree.c (list_length): If ENABLE_TREE_CHECKING, abort on a circular list rather than going into an infinite loop. cp: * cp-lang.c (c_reset_state): Delete. (push_file_scope, pop_file_scope): New stubs. * parser.c (c_parse_file): Call sorry() here if called more than once. testsuite: * gcc.dg/Wold-style-definition-1.c, gcc.dg/builtins-30.c * gcc.dg/unused-4.c, gcc.dg/noncompile/label-1.c * gcc.dg/noncompile/label-lineno-1.c, objc.dg/naming-1.m: Adjust error regexps. * gcc.dg/Wshadow-2.c, gcc.dg/noncompile/incomplete-3.c * gcc.dg/noncompile/undeclared-1.c: New test cases. * gcc.dg/decl-5.c, gcc.dg/redecl-1.c: Remove XFAIL. * gcc.dg/local1.c: Add explanatory comment. From-SVN: r79883
2004-03-24 00:47:53 +01:00
/* The C front end's scoping structure is very different from
that expected by the language-independent code; it is best
to disable all of pushlevel, poplevel, set_block, and getdecls.
This means it must also provide its own write_globals. */
#undef LANG_HOOKS_PUSHLEVEL
#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i
#undef LANG_HOOKS_POPLEVEL
#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree
#undef LANG_HOOKS_SET_BLOCK
#define LANG_HOOKS_SET_BLOCK lhd_do_nothing_t
#undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
Index: ChangeLog 2003-07-10 Geoffrey Keating <geoffk@apple.com> * c-decl.c (finish_decl): Handle 'used' here... * cgraphunit.c (cgraph_finalize_function): ... and here ... * c-common.c: (handle_used_attribute): ... not here. * configure.in (onstep): Support --enable-intermodule. * Makefile.in (OBJS-common): New. (OBJS-md): New. (OBJS-archive): New. (OBJS): Build from OBJS-common, OBJS-md, OBJS-archive. (OBJS-onestep): New. (libbackend.a): Support @onestep@. (libbackend.o): New. * configure: Regenerate. * c-common.h (c_reset_state): New prototype. (c_parse_file): New prototype. (finish_file): Move prototype from c-tree.h. * c-decl.c: Include <hashtab.h>. (builtin_decls): New. (current_file_decl): New. (duplicate_decls): Add extra parameter. Change all callers. Don't output duplicate common symbols. (link_hash_hash): New. (link_hash_eq): New. (poplevel): Handle popping of the top level. (warn_if_shadowing): Handle TRANSLATION_UNIT_DECL. (pushdecl): Set DECL_CONTEXT to TRANSLATION_UNIT_DECL if appropriate. (pushdecl_top_level): Likewise. (redeclaration_error_message): Handle TRANSLATION_UNIT_DECL. (c_init_decl_processing): Create TRANSLATION_UNIT_DECL. (finish_decl): Handle TRANSLATION_UNIT_DECL. (merge_translation_unit_decls): New. (c_write_global_declarations): New. (c_reset_state): New. (implicitly_declare): Handle TRANSLATION_UNIT_DECL. * c-lang.c (LANG_HOOKS_WRITE_GLOBALS): New. * c-objc-common.c (c_cannot_inline_tree_fn): Handle TRANSLATION_UNIT_DECL. (c_objc_common_finish_file): Call merge_translation_unit_decls. * c-opts.c (in_fnames): Rename from in_fname. (c_common_decode_option): Handle multiple input filenames. (c_common_post_options): Likewise. (c_common_parse_file): Likewise; also, call c_parse_file rather than yyparse. * c-parse.in: Move cleanup code to c_parse_file. (free_parser_stacks): Move contents to c_parse_file. (c_parse_file): New. * c-tree.h (union lang_tree_node): Chain along TYPE_NEXT_VARIANT for integer types. (C_DECL_FILE_SCOPE): New. (finish_file): Move prototype to c-common.h. (merge_translation_unit_decls): New prototype. (comptypes): Add extra parameter to prototype. (c_write_global_declarations): New prototype. * c-typeck.c (tagged_types_tu_compatible_p): New. (function_types_compatible_p): Add extra parameter, change all callers. (type_lists_compatible_p): Likewise. (comptypes): Likewise. (struct tagged_tu_seen): New. (tagged_tu_seen_base): New. (build_unary_op): Handle TRANSLATION_UNIT_DECL. (c_mark_addressable): Remove #if 0 code. * calls.c (special_function_p): Handle TRANSLATION_UNIT_DECL, add comment explaining why it shouldn't have to. * cgraph.h (struct cgraph_node): Add chain_next and chain_prev GTY options. * cppinit.c (cpp_read_next_file): New. (cpp_read_main_file): Use it. * cpplib.c (undefine_macros): New. (cpp_undef_all): New. * cpplib.h (cpp_read_next_file): Prototype. (cpp_undef_all): Prototype. * langhooks-def.h (write_global_declarations): Remove prototype. * toplev.h (write_global_declarations): Add prototype. * tree.c (decl_type_context): Use switch statement, handle TRANSLATION_UNIT_DECL. * tree.def: Update documentation for TRANSLATION_UNIT_DECL. (TRANSLATION_UNIT_DECL): New kind of tree. * tree.h: Update documentation for TRANSLATION_UNIT_DECL. * Makefile.in (c-decl.o): Add $(HASHTAB_H) to dependencies. * doc/invoke.texi: Make attempt to document new functionality. 2003-05-19 Per Bothner <bothner@apple.com> * gcc.c (combine_inputs): New. (process_command): Set combine_inputs. (do_spec_1): Handle combine_inputs. (main): Likewise. Index: cp/ChangeLog 2003-07-10 Geoffrey Keating <geoffk@apple.com> * decl.c (cp_finish_decl): Handle 'used' attribute. * cp-lang.c (c_reset_state): New dummy routine. * cp-tree.h (finish_file): Move prototype to c-common.h. * parser.c (c_parse_file): Rename from yyparse; don't call finish_file. From-SVN: r69224
2003-07-11 10:33:21 +02:00
#undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
/* Hooks for tree gimplification. */
#undef LANG_HOOKS_GIMPLIFY_EXPR
#define LANG_HOOKS_GIMPLIFY_EXPR c_gimplify_expr
#undef LANG_HOOKS_TYPES_COMPATIBLE_P
#define LANG_HOOKS_TYPES_COMPATIBLE_P c_types_compatible_p
/* ### When changing hooks, consider if ObjC needs changing too!! ### */
/* Each front end provides its own. */
c-lang.c (LANG_HOOKS_NAME): New. * c-lang.c (LANG_HOOKS_NAME): New. (lang_hooks): Constify. (c_init_options): Update. (lang_identify): Remove. * c-parse.in (language_string): Remove. * dbxout.c: Include langhooks.h. (dbxout_symbol_location): Update. * dwarf2out.c: Include langhooks.h. (gen_compile_unit_die): Update. * dwarfout.c: Include langhooks.h. (prototyped_attribute, output_compile_unit_die): Update. * langhooks-def.h (LANG_HOOKS_NAME, LANG_HOOKS_IDENTIFIER_SIZE): New. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (struct lang_hooks): New members. Constify. * stringpool.c: Don't include toplev.h. (set_identifier_size): Remove. * toplev.c (toplev_main): Initialize identifier size. (print_version): Update. * tree.h (language_string, init_lex, lang_identify, set_identifier_size): Remove. * Makefile.in: Update dependencies. * config/darwin.c: Include langhooks.h. (func_name_maybe_scoped): Update. * config/darwin.h (ASM_END_FILE): Update. * config/nextstep.h (ASM_END_FILE): Update. * config/nextstep21.h (ASM_END_FILE): Update. * config/i386/sun386.h (ASM_END_FILE): Update. * config/rs6000/rs6000.c (ASM_END_FILE): Include langhooks.h. (rs6000_output_function_epilogue): Update. ada: * misc.c (LANG_HOOKS_NAME, LANG_HOOKS_IDENTIFIER_SIZE): Override. (struct lang_hooks): Constify. (language_string, lang_identify): Remove. * utils.c (init_decl_processing): Update. cp: * cp-lang.c (LANG_HOOKS_NAME): Override. (struct lang_hooks): Constify. * lex.c (cxx_init_options): Update. (lang_identify): Remove. * parse.y (language_string): Remove. f: * com.c (language_string, lang_identify): Remove. (struct lang_hooks): Constify. (LANG_HOOKS_NAME): Override. (init_parse): Update. java: * jcf-parse.c (init_lex): Remove. * lang.c (language_string, lang_identify): Remove. (struct lang_hooks): Constify. (LANG_HOOKS_NAME): Override. (init_parse): Update. objc: * objc-act.c (LANG_HOOKS_NAME): Override. (struct lang_hooks): Constify. (objc_init_options): Update. (lang_identify): Remove. From-SVN: r46874
2001-11-09 08:14:20 +01:00
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
c-common.c (c_tree_code_type, [...]): Delete. * c-common.c (c_tree_code_type, c_tree_code_length, c_tree_code_name, add_c_tree_codes): Delete. * c-common.h (add_c_tree_codes): Delete. * c-lang.c (tree_code_type, tree_code_length, tree_code_name): Define. * c-objc-common.c (c_objc_common_init): Don't call add_c_tree_codes, instead set lang_unsafe_for_reeval. * objc/objc-act.c (objc_tree_code_type, objc_tree_code_length, objc_tree_code_name, add_objc_tree_codes): Delete. (objc_init): Don't call add_objc_tree_codes. * objc/objc-lang.c (tree_code_type, tree_code_length, tree_code_name): Define. * toplev.c (lang_independent_init): Don't set tree_code_length[IDENTIFIER_NODE]. * tree.c (tree_code_type, tree_code_length, tree_code_name): Delete definitions, moved to language front-ends. * tree.def (IDENTIFIER_NODE): Hardwire the length. * tree.h (tree_code_type, tree_code_length, tree_code_name): Const-ify. (tree_code_length): Change type to unsigned char. ada: * misc.c (gnat_tree_code_type, gnat_tree_code_length, gnat_tree_code_name): Delete. (tree_code_type, tree_code_length, tree_code_name): Define. (gnat_init): Don't try to copy into the various tree_code arrays. ch: * decl.c (chill_tree_code_type, chill_tree_code_length, chill_tree_code_name): Delete. (tree_code_type, tree_code_length, tree_code_name): Define. (init_decl_processing): Don't try to copy into the various tree_code arrays. cp: * cp-lang.c (tree_code_type, tree_code_length, tree_code_name): Define. * decl.c (duplicate_decls): Use TREE_CODE_LENGTH, not tree_code_length. * lex.c (cplus_tree_code_type, cplus_tree_code_length, cplus_tree_code_name): Delete. (cxx_init): Don't call add_c_tree_codes, instead set lang_unsafe_for_reeval. Don't try to copy into the various tree_code arrays. f: * com.c (tree_code_type, tree_code_length, tree_code_name): Define. java: * lang.c (java_tree_code_type, java_tree_code_length, tree_code_name): Delete. (tree_code_type, tree_code_length, tree_code_name): Define. (java_init): Don't try to copy into the various tree_code arrays. From-SVN: r50705
2002-03-13 02:42:43 +01:00
/* Tree code classes. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
const char tree_code_type[] = {
#include "tree.def"
'x',
#include "c-common.def"
};
#undef DEFTREECODE
/* Table indexed by tree code giving number of expression
operands beyond the fixed part of the node structure.
Not used for types or decls. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
const unsigned char tree_code_length[] = {
#include "tree.def"
0,
#include "c-common.def"
};
#undef DEFTREECODE
/* Names of tree components.
Used for printing out the tree and error messages. */
#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
const char *const tree_code_name[] = {
#include "tree.def"
"@@dummy",
#include "c-common.def"
};
#undef DEFTREECODE
void
finish_file (void)
{
c_objc_common_finish_file ();
}
int
c_types_compatible_p (tree x, tree y)
{
return comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y), 0);
}
pretty-print.c (pp_base_indent): Rename from pp_indent. * pretty-print.c (pp_base_indent): Rename from pp_indent. * c-pretty-print.h (pp_c_pretty_print_flag)s: New datatype. (struct c_pretty_print_info): Add more fields. (pp_c_left_paren): Move to c-pretty-print.c. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_declarator): Declare. (pp_c_direct_declarator): Likewise. (pp_c_specifier_qualifier_list): Likewise. (pp_c_type_id): Likewise. * c-pretty-print.c (pp_c_cv_qualifier): Change prootype. Rework.. (pp_c_type_qualifier_list): New. (pp_c_pointer): Likewise. (pp_c_parameter_type_list): Likewise. (pp_c_function_definition): Likewise. (pp_c_id_expression): Likewise. (pp_c_simple_type_specifier): Tidy. (pp_c_unary_expression): Likewise. (pp_c_expression): Likewise. (pp_c_pretty_printer_init): Likewise. (pp_c_specifier_qualifier_list): Rework.. (pp_c_abstract_declarator): Likewise. (pp_c_postfix_expression): Likewise. (pp_c_primary_expression): Likewise. (pp_c_cast_expression): Likewise. (pp_c_direct_abstract_declarator): Likewise. (pp_c_storage_class_specifier): Likewise. (pp_c_function_specifier): Likewise. (pp_c_declaration_specifiers): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_declarator): Likewise. (pp_c_declaration): Likewise. (pp_c_statement): Likewise. (pp_c_integer_constant): Rename from pp_c_integer_literal. (pp_c_character_constant): Rename from pp_c_character_literal. (pp_c_bool_constant): Rename from pp_c_bool_literal. (pp_c_enumeration_constant): Rename from pp_c_enumerator. (pp_c_floating_constant): Rename from pp_c_real_literal. (pp_c_constant): Rename from pp_c_literal. * c-lang.c: Include diagnostic.h and c-pretty-print.h (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define. (c_initialize_diagnostics): New. * Makefile.in (c-lang.o): Update dependency. cp/ * error.c (dump_expr): Tidy. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): New. (pp_cxx_begin_template_argument_list): Likewise. (pp_cxx_end_template_argument_list): Likewise. (is_destructor_name): Likewise. (pp_cxx_unqualified_id): Likewise. (pp_cxx_qualified_id): Likewise. (pp_cxx_id_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_delete_expression): Likewise. (pp_cxx_pm_expression): Likewise. (pp_cxx_type_specifier): Rework. (pp_cxx_type_id): Likewise. (pp_cxx_primary_expression): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_multiplicative_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_pretty_printer_init): Tidy. From-SVN: r70299
2003-08-10 20:17:06 +02:00
static void
c_initialize_diagnostics (diagnostic_context *context)
{
pretty_printer *base = context->printer;
pretty-print.h (pp_maybe_newline_and_indent): New macro. * pretty-print.h (pp_maybe_newline_and_indent): New macro. * c-pretty-print.h (c_pretty_printer): Now typedef to the structure. Be consistent with pretty-print.h abd cxx-pretty-print.h (struct c_pretty_print_info): Document. Add new fields. (pp_type_specifier_seq): Rename from pp_c_type_specifier. (pp_direct_abstract_declarator): New macro. (pp_ptr_operator): Likewise. (pp_simple_type_specifier): Likewise. (pp_expression): Likewise. (pp_parameter_list): Rename from pp_parameter_declaration. * c-pretty-print.c (pp_c_whitespace): Now a function. (pp_c_left_paren): Likewise. (pp_c_right_paren): Likewise. (pp_c_dot): Likewise. (pp_c_ampersand): Likewise. (pp_c_arrow): Likewise. (pp_c_semicolon): Likewise. (pp_c_type_cast): New function. (pp_c_space_for_pointer_operator): Likewise. (pp_c_call_argument_list): Likewise. (pp_c_cv_qualifier): Adjust prototype. (pp_c_type_qualifier_list): Likewise. (pp_c_pointer): Likewise. Handle REFERENCE_TYPE here. (pp_c_type_specifier): Rename from pp_c_simple_type_specifier. Adjust to follow standard grammar. (pp_c_specifier_qualifier_list): Adjusr prototype. Handle REFERENCE_TYPE. Tidy. (pp_c_parameter_type_list): Adjust prototype. Tidy. (pp_c_parameter_declaration): Remove. (pp_c_abstract_declarator): Adjust prototype. (pp_c_direct_abstract_declarator): Likewise. (pp_c_type_id): Likewise. (pp_c_storage_class_specifier): Likewise. (pp_c_function_specifier): Likewise. (pp_c_declaration_specifiers): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_declarator): Likewise. (pp_c_declarator): Likewise. (pp_c_declaration): Likewise. (pp_c_attributes): Likewise. Tidy. (pp_c_function_definition): Adjust prototype. (pp_c_char): Likewise. (pp_c_string_literal): Likewise. (pp_c_integer_constant): Likewise. (pp_c_character_constant): Likewise. (pp_c_bool_constant): Likewise. (pp_c_enumeration_constant): Likewise. (pp_c_floating_constant): Likewise. (pp_c_constant): Likewise. (pp_c_identifier): Likewise. (pp_c_primary_expression): Likewise. Remove TARGET_EXPR case. Tidy. (pp_c_initializer): Adjust prototype. (pp_c_init_declarator): Likewise. (pp_c_initializer_list): Likewise. (pp_c_id_expression): Likewise. (pp_c_postfix_expression): Likewise. (pp_c_expression_list): Likewise. (pp_c_unary_expression): Likewise. (pp_c_cast_expression): Likewise. (pp_c_multiplicative_expression): Likewise. (pp_c_additive_expression): Likewise. (pp_c_shift_expression): Likewise. (pp_c_relational_expression): Likewise. (pp_c_equality_expression): Likewise. (pp_c_and_expression): Likewise. (pp_c_exclusive_or_expression): Likewise. (pp_c_inclusive_or_expression): Likewise. (pp_c_logical_and_expression): Likewise. (pp_c_logical_or_expression): Likewise. (pp_c_conditional_expression): Likewise. (pp_c_assignment_expression): Likewise. (pp_c_expression): Likewise. Tidy. (pp_c_statement): Likewise. Document. (pp_c_pretty_printer_init): Adjust prototype. Tidy. * c-lang.c (c_initialize_diagnostics): Update. * c-common.h (strip_pointer_operator): Declare. * c-common.c (strip_pointer_operator): Define. cp/ * cxx-pretty-print.h (pp_cxx_flag_default_argument): New flag. (cxx_pretty_printer): Adjust base type. (pp_cxx_function_specifier): Declare. * cxx-pretty-print.c (pp_cxx_whitespace): New macro. (pp_cxx_left_paren): Likewise. (pp_cxx_right_paren): Likewise. (pp_cxx_dot): Likewise. (pp_cxx_arrow): Likewise. (pp_cxx_semicolon): Likewise. (pp_cxx_identifier): Likewise. (pp_cxx_cv_qualifier_seq): Likewise. (pp_cxx_storage_class_specifier): Likewise. (pp_cxx_expression_list): Likewise. (pp_cxx_space_for_pointer_operator): Likewise. (pp_cxx_init_declarator): Likewise. (pp_cxx_call_argument_list): Likewise. (pp_cxx_nonconsecutive_character): Tidy. (pp_cxx_conversion_function_id): New function. (pp_cxx_template_id): Likewise. (pp_cxx_class_name): Likewise. (pp_cxx_template_keyword_if_needed): Likewise. (pp_cxx_nested_name_specifier): Likewise. (pp_cxx_unqualified_id): Tidy (pp_cxx_qualified_id): Handle more nodes. (pp_cxx_primary_expression): Tidy. (pp_cxx_postfix_expression): Likewise. (pp_cxx_new_expression): Tidy. (pp_cxx_delete_expression): Likewise. (pp_cxx_cast_expression): New function. (pp_cxx_pm_expression): Tidy. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_operator): New function. (pp_cxx_assignment_expression): Tidy. (pp_cxx_expression): New function. (pp_cxx_function_specifier): Likewise. (pp_cxx_decl_specifier_seq): Likewise. (pp_cxx_simple_type_specifier): Tidy. (pp_cxx_type_specifier_seq): Likewise. (pp_cxx_ptr_operator): New function. (pp_cxx_implicit_parameter_type): Likewise. (pp_cxx_parameter_declaration): Tidy. (pp_cxx_parameter_declaration_clause): New function. (pp_cxx_exception_specification): Likewise. (pp_cxx_direct_declarator): Tidy. (pp_cxx_declarator): Likewise. (pp_cxx_ctor_initializer): New function. (pp_cxx_function_definition): Likewise. (pp_cxx_abstract_declarator): Tidy. (pp_cxx_direct_abstract_declarator): Likewise. (pp_cxx_type_id): Likewise. (pp_cxx_exception_declaration): New function. (pp_cxx_statement): Likewise. (pp_cxx_simple_declaration): Likewise. (pp_cxx_template_parameter_list): Likewise. (pp_cxx_template_parameter): Likewise. (pp_cxx_template_declaration): Likewise. (pp_cxx_explicit_specialization): Likewise. (pp_cxx_explicit_instantiation): Likewise. (pp_cxx_declaration): Tidy. (pp_cxx_pretty_printer_init): Initialize more fields. From-SVN: r70777
2003-08-25 21:10:50 +02:00
c_pretty_printer *pp = xmalloc (sizeof (c_pretty_printer));
pretty-print.c (pp_base_indent): Rename from pp_indent. * pretty-print.c (pp_base_indent): Rename from pp_indent. * c-pretty-print.h (pp_c_pretty_print_flag)s: New datatype. (struct c_pretty_print_info): Add more fields. (pp_c_left_paren): Move to c-pretty-print.c. (pp_c_right_paren): Likewise. (pp_c_left_brace): Likewise. (pp_c_right_brace): Likewise. (pp_c_left_bracket): Likewise. (pp_c_right_bracket): Likewise. (pp_c_declarator): Declare. (pp_c_direct_declarator): Likewise. (pp_c_specifier_qualifier_list): Likewise. (pp_c_type_id): Likewise. * c-pretty-print.c (pp_c_cv_qualifier): Change prootype. Rework.. (pp_c_type_qualifier_list): New. (pp_c_pointer): Likewise. (pp_c_parameter_type_list): Likewise. (pp_c_function_definition): Likewise. (pp_c_id_expression): Likewise. (pp_c_simple_type_specifier): Tidy. (pp_c_unary_expression): Likewise. (pp_c_expression): Likewise. (pp_c_pretty_printer_init): Likewise. (pp_c_specifier_qualifier_list): Rework.. (pp_c_abstract_declarator): Likewise. (pp_c_postfix_expression): Likewise. (pp_c_primary_expression): Likewise. (pp_c_cast_expression): Likewise. (pp_c_direct_abstract_declarator): Likewise. (pp_c_storage_class_specifier): Likewise. (pp_c_function_specifier): Likewise. (pp_c_declaration_specifiers): Likewise. (pp_c_direct_declarator): Likewise. (pp_c_declarator): Likewise. (pp_c_declaration): Likewise. (pp_c_statement): Likewise. (pp_c_integer_constant): Rename from pp_c_integer_literal. (pp_c_character_constant): Rename from pp_c_character_literal. (pp_c_bool_constant): Rename from pp_c_bool_literal. (pp_c_enumeration_constant): Rename from pp_c_enumerator. (pp_c_floating_constant): Rename from pp_c_real_literal. (pp_c_constant): Rename from pp_c_literal. * c-lang.c: Include diagnostic.h and c-pretty-print.h (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define. (c_initialize_diagnostics): New. * Makefile.in (c-lang.o): Update dependency. cp/ * error.c (dump_expr): Tidy. * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): New. (pp_cxx_begin_template_argument_list): Likewise. (pp_cxx_end_template_argument_list): Likewise. (is_destructor_name): Likewise. (pp_cxx_unqualified_id): Likewise. (pp_cxx_qualified_id): Likewise. (pp_cxx_id_expression): Likewise. (pp_cxx_new_expression): Likewise. (pp_cxx_delete_expression): Likewise. (pp_cxx_pm_expression): Likewise. (pp_cxx_type_specifier): Rework. (pp_cxx_type_id): Likewise. (pp_cxx_primary_expression): Likewise. (pp_cxx_postfix_expression): Likewise. (pp_cxx_unary_expression): Likewise. (pp_cxx_multiplicative_expression): Likewise. (pp_cxx_conditional_expression): Likewise. (pp_cxx_assignment_expression): Likewise. (pp_cxx_pretty_printer_init): Tidy. From-SVN: r70299
2003-08-10 20:17:06 +02:00
memcpy (pp_base (pp), base, sizeof (pretty_printer));
pp_c_pretty_printer_init (pp);
context->printer = (pretty_printer *) pp;
/* It is safe to free this object because it was previously malloc()'d. */
free (base);
}
#include "gtype-c.h"