1992-02-13 23:21:26 +01:00
|
|
|
|
/* Process declarations and variables for C compiler.
|
2001-01-02 08:00:49 +01:00
|
|
|
|
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
|
|
|
|
2001 Free Software Foundation, Inc.
|
1992-02-13 23:21:26 +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.
|
1992-02-13 23:21:26 +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.
|
1992-02-13 23:21:26 +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.
|
1992-02-13 23:21:26 +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. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Process declarations and symbol lookup for C front end.
|
|
|
|
|
Also constructs types; the standard scalar types at initialization,
|
|
|
|
|
and structure, union, array and enum types when they are declared. */
|
|
|
|
|
|
|
|
|
|
/* ??? not all decl nodes are given the most useful possible
|
|
|
|
|
line numbers. For example, the CONST_DECLs for enum values. */
|
|
|
|
|
|
|
|
|
|
#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"
|
2000-06-29 19:31:03 +02:00
|
|
|
|
#include "intl.h"
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#include "tree.h"
|
2001-10-05 06:20:27 +02:00
|
|
|
|
#include "tree-inline.h"
|
Makefile.in (c-decl.o): Depend on rtl.h and expr.h.
* Makefile.in (c-decl.o): Depend on rtl.h and expr.h.
* alias.c (struct alias_entry): alias_set is HOST_WIDE_INT.
(REG_BASE_VALUE): Remove unneeded cast to unsigned.
(get_alias_set_entry): ALIAS_SET arg is HOST_WIDE_INT.
(find_base_decl): New function, from c_find_base_decl in c-common.c.
(new_alias_set): Moved from tree.c; return is HOST_WIDE_INT.
(get_alias_set): Likewise.
Major rework to do more things and allow language-specific code
to just handle special-cases.
(record_alias_subset): Args are HOST_WIDE_INT.
(record_component_alias): Local vars are HOST_WIDE_INT.
Don't handle COMPLEX_EXPR.
(get_varargs_alias_set): Moved from builtins.c.
(get_frame_alias_set): New function.
* builtins.c (expand_builtin_return_address): Use frame alias set.
(expand_builtin_setjmp, expand_builtin_longjmp): Use alias set
for setjmp buffer.
(get_memory_rtx): Rework to use set_mem_attributes.
(get_varargs_alias_set): Deleted from here.
* c-common.c (c_apply_type_quals_to_decl): Alias sets now HOST_WIDE_INT.
(c_find_base_decl): Deleted from here.
(c_get_alias_set): Remove many cases and rework to just handle
C-specific cases.
* c-common.h (c_get_alias_set): Returns HOST_WIDE_INT.
* c-decl.c (rtl.h, expr.h): Now included.
(init_decl_processing): Call record_component_aliases on array types.
(grokdeclarator): Likewise.
Set TREE_ADDRESSABLE for all fields that are not bitfields.
* c-typeck.c (common_type): Call record_component_aliases for array.
* caller-save.c (setup_save_areas): Rework register loop for unsigned.
Set all save areas to the frame alias set.
* calls.c (initialie_argument_information): Call set_mem_attributes.
(compute_argument_addresses, expand_call): Likewise.
* explow.c (set_mem_attributes): New function.
(stabilize): Use MEM_COPY_ATTRIBUTES and force_reg.
* expr.c (struct move_by_pieces): Remove {to,from}_{struct,readonly}.
LEN and OFFSET now HOST_WIDE_INT.
(clear_by_pieces): Similar changes.
(move_by_pieces): LEN now HOST_WIDE_INT; don't set deleted fields.
(move_by_pieces_ninsns): Now returns unsigned HOST_WIDE_INT.
(move_by_pieces_1): Don't use deleted fields, use MEM_COPY_ATTRIBUTES.
(clear_by_pieces_1): Likewise.
(emit_push_insn): Call set_mem_attributes.
(expand_expr, case INDIRECT_REF): Likewise.
(expand_expr, case VAR_DECL): Call change_address.
* expr.h (ADD_PARM_SIZE, SUB_PARM_SIZE): Use host_integerp and
tree_low_cst.
(get_varargs_alias_set, get_frame_alias_set): New decls.
(record_base_value, record_alias_subset, lang_get_alias_set): Likewise.
(new_alias_set, set_mem_attributes): Likewse.
* function.c (struct temp_slot): ALIAS_SET is HOST_WIDE_INT.
(assign_stack_temp_for_type): Likewise.
Can split slot even if alias set since can copy.
Set MEM_ALIAS_SET and MEM_SET_IN_STRUCT_P.
(assign_temp): Use host_integerp and tree_low_cst.
(put_var_into_stack): Properly handle SAVE_EXPR.
(put_addressof_into_stack): Likewise.
(assign_parms): Call set_mem_attributes.
Delete #if 0 code.
(fix_lexical_address): Put reference to chain into frame alias set.
(expand_function_start): Call set_mem_attributes.
* integrate.c (expand_inline_function): Likewise.
* recog.c (adj_offsettable_operand): Use MEM_COPY_ATTRIBUTES.
* regmove.c (try_apply_stack_adjustment): Likewise.
* reload.c (push_reload, make_memloc): Likewise.
* reload1.c (alter_reg): Make alias sets for spilled pseudos.
* rtl.def (MEM): Update comment.
* rtl.h (MEM_ALIAS_SET): Now uses XCWINT.
(move_by_pieces): Change length to HOST_WIDE_INT.
(record_base_value, record_alias_subset): Delete from here.
* stmt.c (expand_decl): Call set_mem_attributes.
* stor-layout.c (finish_record_layout): Call record_component_aliases.i
* toplev.c (compile_file): Call init_alias_once earlier.
* tree.c (lang_get_alias_set, get_alias_set, new_alias_set): Deleted
from here: now in alias.c.
* tree.h (struct tree_type): alias_set is HOST_WIDE_INT.
(struct tree_decl): Likewise.
(get_alias_set, new_alias_set, lang_get_alias_set): Deleted from here.
* varasm.c (make_function_rtl, make_decl_rtl): Call set_mem_attributes.
(output_constant_def, force_const_mem): Likewise.
* cp/Makefile.in (decl.o): Include ../expr.h.
* cp/decl.c (expr.h): Include.
(init_decl_processing): Call record_component_aliases for arrays.
(grokdeclarator): Likewise.
Set TREE_ADDRESSABLE for fields that aren't bitfields.
* cp/tree.c (build_cplus_array_type_1): Call record_component_aliases.
From-SVN: r34308
2000-05-31 22:01:57 +02:00
|
|
|
|
#include "rtl.h"
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#include "flags.h"
|
1999-08-09 16:00:21 +02:00
|
|
|
|
#include "function.h"
|
1994-12-30 13:59:51 +01:00
|
|
|
|
#include "output.h"
|
Makefile.in (c-decl.o): Depend on rtl.h and expr.h.
* Makefile.in (c-decl.o): Depend on rtl.h and expr.h.
* alias.c (struct alias_entry): alias_set is HOST_WIDE_INT.
(REG_BASE_VALUE): Remove unneeded cast to unsigned.
(get_alias_set_entry): ALIAS_SET arg is HOST_WIDE_INT.
(find_base_decl): New function, from c_find_base_decl in c-common.c.
(new_alias_set): Moved from tree.c; return is HOST_WIDE_INT.
(get_alias_set): Likewise.
Major rework to do more things and allow language-specific code
to just handle special-cases.
(record_alias_subset): Args are HOST_WIDE_INT.
(record_component_alias): Local vars are HOST_WIDE_INT.
Don't handle COMPLEX_EXPR.
(get_varargs_alias_set): Moved from builtins.c.
(get_frame_alias_set): New function.
* builtins.c (expand_builtin_return_address): Use frame alias set.
(expand_builtin_setjmp, expand_builtin_longjmp): Use alias set
for setjmp buffer.
(get_memory_rtx): Rework to use set_mem_attributes.
(get_varargs_alias_set): Deleted from here.
* c-common.c (c_apply_type_quals_to_decl): Alias sets now HOST_WIDE_INT.
(c_find_base_decl): Deleted from here.
(c_get_alias_set): Remove many cases and rework to just handle
C-specific cases.
* c-common.h (c_get_alias_set): Returns HOST_WIDE_INT.
* c-decl.c (rtl.h, expr.h): Now included.
(init_decl_processing): Call record_component_aliases on array types.
(grokdeclarator): Likewise.
Set TREE_ADDRESSABLE for all fields that are not bitfields.
* c-typeck.c (common_type): Call record_component_aliases for array.
* caller-save.c (setup_save_areas): Rework register loop for unsigned.
Set all save areas to the frame alias set.
* calls.c (initialie_argument_information): Call set_mem_attributes.
(compute_argument_addresses, expand_call): Likewise.
* explow.c (set_mem_attributes): New function.
(stabilize): Use MEM_COPY_ATTRIBUTES and force_reg.
* expr.c (struct move_by_pieces): Remove {to,from}_{struct,readonly}.
LEN and OFFSET now HOST_WIDE_INT.
(clear_by_pieces): Similar changes.
(move_by_pieces): LEN now HOST_WIDE_INT; don't set deleted fields.
(move_by_pieces_ninsns): Now returns unsigned HOST_WIDE_INT.
(move_by_pieces_1): Don't use deleted fields, use MEM_COPY_ATTRIBUTES.
(clear_by_pieces_1): Likewise.
(emit_push_insn): Call set_mem_attributes.
(expand_expr, case INDIRECT_REF): Likewise.
(expand_expr, case VAR_DECL): Call change_address.
* expr.h (ADD_PARM_SIZE, SUB_PARM_SIZE): Use host_integerp and
tree_low_cst.
(get_varargs_alias_set, get_frame_alias_set): New decls.
(record_base_value, record_alias_subset, lang_get_alias_set): Likewise.
(new_alias_set, set_mem_attributes): Likewse.
* function.c (struct temp_slot): ALIAS_SET is HOST_WIDE_INT.
(assign_stack_temp_for_type): Likewise.
Can split slot even if alias set since can copy.
Set MEM_ALIAS_SET and MEM_SET_IN_STRUCT_P.
(assign_temp): Use host_integerp and tree_low_cst.
(put_var_into_stack): Properly handle SAVE_EXPR.
(put_addressof_into_stack): Likewise.
(assign_parms): Call set_mem_attributes.
Delete #if 0 code.
(fix_lexical_address): Put reference to chain into frame alias set.
(expand_function_start): Call set_mem_attributes.
* integrate.c (expand_inline_function): Likewise.
* recog.c (adj_offsettable_operand): Use MEM_COPY_ATTRIBUTES.
* regmove.c (try_apply_stack_adjustment): Likewise.
* reload.c (push_reload, make_memloc): Likewise.
* reload1.c (alter_reg): Make alias sets for spilled pseudos.
* rtl.def (MEM): Update comment.
* rtl.h (MEM_ALIAS_SET): Now uses XCWINT.
(move_by_pieces): Change length to HOST_WIDE_INT.
(record_base_value, record_alias_subset): Delete from here.
* stmt.c (expand_decl): Call set_mem_attributes.
* stor-layout.c (finish_record_layout): Call record_component_aliases.i
* toplev.c (compile_file): Call init_alias_once earlier.
* tree.c (lang_get_alias_set, get_alias_set, new_alias_set): Deleted
from here: now in alias.c.
* tree.h (struct tree_type): alias_set is HOST_WIDE_INT.
(struct tree_decl): Likewise.
(get_alias_set, new_alias_set, lang_get_alias_set): Deleted from here.
* varasm.c (make_function_rtl, make_decl_rtl): Call set_mem_attributes.
(output_constant_def, force_const_mem): Likewise.
* cp/Makefile.in (decl.o): Include ../expr.h.
* cp/decl.c (expr.h): Include.
(init_decl_processing): Call record_component_aliases for arrays.
(grokdeclarator): Likewise.
Set TREE_ADDRESSABLE for fields that aren't bitfields.
* cp/tree.c (build_cplus_array_type_1): Call record_component_aliases.
From-SVN: r34308
2000-05-31 22:01:57 +02:00
|
|
|
|
#include "expr.h"
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#include "c-tree.h"
|
|
|
|
|
#include "c-lex.h"
|
toplev.h: New file.
Wed May 6 06:35:38 1998 Robert Lipe <robertl@dgii.com>
* toplev.h: New file. Protypes for functions in toplev.c.
* tree.h, rtl.h: Deleted protos for functions in toplev.c.
* c-common.c, c-convert.c, c-decl.c, c-iterate.c, c-lex.c,
c-parse.in, c-parse.y, c-pragma.c, c-typeck.c, calls.c,
convert.c, dwarf2out.c, except.c, expr.c, final.c, fold-const.c,
function.c, hash.c, profile.c, real.c, reg-stack.c, regclass.c,
reload.c, reload1.c, stmt.c, stor-layout.c, tlink.c, tree.c,
varasm.c: include it.
From-SVN: r19563
1998-05-06 06:45:47 +02:00
|
|
|
|
#include "toplev.h"
|
1999-09-06 23:28:22 +02:00
|
|
|
|
#include "ggc.h"
|
2000-05-07 03:37:07 +02:00
|
|
|
|
#include "tm_p.h"
|
1998-06-10 12:12:36 +02:00
|
|
|
|
#include "cpplib.h"
|
Makefile.in (TARGET_H, [...]): New.
* Makefile.in (TARGET_H, TARGET_DEF_H): New.
(c-decl.o, tree.o, c-typeck.o, $(out_object_file)): Update.
* c-decl.c (duplicate_decls): Use function pointer.
* c-typeck.c (common_type): Similarly.
* tree.c (valid_machine_attribute): Similarly.
(merge_machine_type_attributes): Rename merge_type_attributes.
(merge_machine_decl_attributes): Rename merge_decl_attributes.
(merge_dllimport_decl_attributes): New function.
* tree.h (merge_machine_type_attributes): Rename merge_type_attributes.
(merge_machine_decl_attributes): Rename merge_decl_attributes.
(merge_dllimport_decl_attributes): New prototype.
* target.h: New.
* target-def.h: New.
doc: (Joseph Myers)
* doc/gcc.texi, doc/tm.texi: Update documentation.
cp: Make-lang.in: Update dependencies.
* spew.c: Include target.h.
(duplicate_decls): Call target function.
* decl2.c: include target.h
(import_export_class): Use existence of target function pointer.
* typeck.c: Include target.h.
(qualify_type_recursive): Rename variable. Call target function.
(type_after_usual_arithmetic_conversions): Similarly.
(common_type): Similarly.
config: * 1750a/1750a.c, a29k/29k.c, alpha/alpha.c, arc/arc.c, arm/arm.c,
avr/avr.c, c4x/c4x.c, clipper/clipper.c, convex/convex.c,
d30v/d30v.c, dsp16xx/dsp16xx.c, elxsi/elxsi.c, fr30/fr30.c,
i370/i370.c, i386/i386.c, i860/i860.c, i960/i960.c, ia64/ia64.c,
m32r/m32r.c, m68hc11/m68hc11.c, m68k/m68k.c, m88k/m88k.c,
mips/mips.c, mn10200/mn10200.c, mn10300/mn10300.c, ns32k/ns32k.c,
pa/pa.c, pdp11/pdp11.c, pj/pj.c, romp/romp.c, rs6000/rs6000.c,
sh/sh.c, sparc/sparc.c, v850/v850.c, vax/vax.c, we32k/we32k.c)
: Include target.h and target-def.h. Define target.
* arc/arc-protos.h (arc_valid_machine_decl_attribute): Remove.
* arc/arc.c (arc_valid_machine_decl_attribute): Rename
arc_valid_decl_attribute, make static.
* arc/arc.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* arm/arm-protos.h (arm_valid_machine_decl_attribute,
arm_valid_type_attribute_p, arm_pe_valid_machine_decl_attribute,
arm_pe_merge_machine_decl_attributes): Remove.
* arm/arm.c (arm_valid_machine_decl_attribute_p): Rename
arm_valid_decl_attribute_p, make static.
(arm_pe_valid_decl_attribute_p): Move from pe.c.
* arm/pe.c (arm_pe_valid_machine_decl_attribute_p): Move to arm.c.
(arm_pe_merge_machine_decl_attributes): Move to tree.c.
* arm/arm.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* arm/coff.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* arm/elf.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* arm/pe.h (TARGET_DLLIMPORT_DECL_ATTRIBUTES): New.
(VALID_MACHINE_TYPE_ATTRIBUTE, VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* avr/avr-protos.h (valid_machine_type_attribute,
valid_machine_decl_attribute): Remove.
* avr/avr.c (valid_machine_type_attribute,
valid_machine_decl_attribute): Rename and make static.
* avr/avr.h (VALID_MACHINE_TYPE_ATTRIBUTE,
VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* c4x/c4x-protos.h (c4x_valid_type_attribute_p): Remove.
* c4x/c4x.c (c4x_valid_type_attribute_p): Make static.
* c4x/c4x.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* d30v/d30v.h: Remove obsolete comments.
* h8300/h8300-protos.h (h8300_valid_machine_decl_attribute): Remove.
* h8300/h8300.c (h8300_valid_machine_decl_attribute): Rename, make
static.
* h8300/h8300.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* i386/cygwin.h (TARGET_DLLIMPORT_DECL_ATTRIBUTES): Define.
(i386_pe_merge_decl_attributes, MERGE_MACHINE_DECL_ATTRIBUTES,
i386_pe_valid_type_attributes_p): Remove.
* i386/i386-protos.h (ix86_valid_decl_attribute_p,
ix86_valid_type_attribute_p): Remove.
* i386/i386.c (ix86_valid_decl_attribute_p): Remove.
(ix86_valid_type_attribute_p): Make static.
* i386/i386.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* i386/winnt.c (i386_pe_merge_decl_attributes): Move to tree.c.
* ia64/ia64-protos.h (ia64_valid_type_attribute): Remove.
* ia64/ia64.c (ia64_valid_type_attribute): Make static.
* ia64/ia64.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* m32r/m32r-protos.h (m32r_valid_machine_decl_attribute): Remove.
* m32r/m32r.c (m32r_valid_decl_attribute): Make static.
* m32r/m32r.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* m68hc11/m68hc11-protos.h (m68hc11_valid_decl_attribute_p,
m68hc11_valid_type_attribute_p): Remove.
* m68hc11/m68hc11.c (m68hc11_valid_decl_attribute_p): Remove.
(m68hc11_valid_type_attribute_p): Make static.
* m68hc11/m68hc11.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* mcore/mcore-protos.h (mcore_valid_machine_decl_attribute,
mcore_merge_machine_decl_attribute): Remove.
* mcore/mcore.c (mcore_valid_machine_decl_attribute): Rename,
make static.
(mcore_merge_machine_decl_attributes): Move to tree.c.
* mcore/mcore.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
(TARGET_DLLIMPORT_DECL_ATTRIBUTES): Define.
* ns32k/ns32k-protos.h (ns32k_valid_decl_attribute_p,
ns32k_valid_type_attribute_p): Remove.
* ns32k/ns32k.c (ns32k_valid_decl_attribute_p): Remove.
(ns32k_valid_type_attribute_p): Make static.
* ns32k/ns32k.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* rs6000/rs6000-protos.h (rs6000_valid_decl_attribute_p,
rs6000_valid_type_attribute_p): Remove.
* rs6000/rs6000.c (rs6000_valid_decl_attribute_p): Remove.
(rs6000_valid_type_attribute_p): Make static.
* rs6000/rs6000.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* sh/sh-protos.h (sh_valid_machine_decl_attribute): Remove.
* sh/sh.c (sh_valid_machine_decl_attribute): Rename, make static.
* sh/sh.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* v850/v850-protos.h (v850_valid_machine_decl_attribute): Remove.
* v850/v850.c (v850_valid_machine_decl_attribute): Rename, make static.
* v850/v850.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
From-SVN: r43585
2001-06-26 20:09:27 +02:00
|
|
|
|
#include "target.h"
|
Makefile.in (emit-rtl.o, c-decl.o): Depend on debug.h.
* Makefile.in (emit-rtl.o, c-decl.o): Depend on debug.h.
(final.o): Don't depend on xcoffout.h, dbxout.h or sdbout.h.
(toplev.o): Don't depend on xcoffout.h.
* c-decl.c: Include debug.h
(duplicate_decls): Use debug hook.
* dbxout.c (dbxout_source_file, dbxout_args): Make static.
(dbx_debug_hooks, xcoff_debug_hooks): Update.
(dbxout_types): Remove.
* dbxout.h (dbxout_source_file, dbxout_types, dbxout_args): Remove.
* debug.c (do_nothing_debug_hooks): Update.
(debug_true_tree, debug_nothing_rtx): New.
* debug.h (struct rtx_def): New.
(struct gcc_debug_hooks): New hooks ignore_block,
outlining_inline_function and label.
(debug_true_tree, debug_nothing_rtx, dwarf2out_frame_init,
dwarf2out_frame_finish): New.
* dwarf2out.c (dwarf2out_ignore_block, dwarf2out_abstract_function):
Make static, update prototype.
(dwarf2_debug_hooks): Update.
* dwarf2out.h (dwarf2out_ignore_block, dwarf2out_abstract_function,
dwarf2out_frame_init, dwarf2out_frame_finish): Remove.
* dwarfout.c (dwarf_debug_hooks): Update.
* emit-rtl.c: Include debug.h.
(remove_unnecessary_notes): Use debug hook.
* final.c: Don't include dbxout.h, xcoffout.h or sdbout.h.
(final_scan_insn): Use debug hook.
* integrate.c (output_inline_function): Use debug hook.
* sdbout.c (sdbout_toplevel_data, sdbout_label): Make static.
(sdb_debug_hooks): Update.
* sdbout.h (sdbout_label, sdbout_toplevel_data): Remove.
* toplev.c: Don't include xcoffout.h.
(note_outlining_of_inline_function, debug_ignore_block): Remove.
* toplev.h (note_outlining_of_inline_function, debug_ignore_block):
Remove.
* tree.h (dwarf2out_do_frame): Remove.
From-SVN: r44163
2001-07-19 23:17:09 +02:00
|
|
|
|
#include "debug.h"
|
2001-10-20 12:04:00 +02:00
|
|
|
|
#include "timevar.h"
|
1998-06-10 12:12:36 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
|
|
|
|
|
enum decl_context
|
|
|
|
|
{ NORMAL, /* Ordinary declaration */
|
|
|
|
|
FUNCDEF, /* Function definition */
|
|
|
|
|
PARM, /* Declaration of parm before function body */
|
|
|
|
|
FIELD, /* Declaration inside struct or union */
|
|
|
|
|
BITFIELD, /* Likewise but with specified width */
|
|
|
|
|
TYPENAME}; /* Typename (inside cast or sizeof) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Nonzero if we have seen an invalid cross reference
|
|
|
|
|
to a struct, union, or enum, but not yet printed the message. */
|
|
|
|
|
|
|
|
|
|
tree pending_invalid_xref;
|
|
|
|
|
/* File and line to appear in the eventual error message. */
|
top level:
* Makefile.in (WARN_CFLAGS): Add -Wwrite-strings.
(tree.o): Depend on output.h.
* c-decl.c (pending_invalid_xref_file,
current_function_prototype_file): Constify.
(pushdecl): Constify a local char *.
(define_label): Constify filename parameter.
* c-lex.c (init_parse): Constify parameter and return value.
* c-typeck.c (c_expand_asm_operands): Constify filename parameter.
* c-tree.h: Update prototypes.
* c-parse.in: Constify filename member of %union, and if_stmt_file.
* c-parse.y, c-parse.c, c-parse.h, objc/objc-parse.y,
objc/objc-parse.c: Regenerate.
* dwarfout.c (dwarfout_init): Constify main_input_filename parameter.
* dwarfout.h: Update prototypes.
* expr.c (expand_expr): Constify a local char *.
* flags.h: Constify main_input_filename.
* function.c (expand_function_end): Constify filename parameter.
* genrecog.c (make_insn_sequence): Use a character array for
c_test_pos.
(main): Remove unused variables.
* input.h: Constify input_filename, main_input_filename, and
file_stack.name. Update prototypes.
* output.h: Declare first_global_object_name and
weak_global_object_name here, as const char *.
* stmt.c (expand_asm_operands): Constify filename parameter.
* toplev.c (compile_file, push_srcloc, debug_start_source_file):
Constify filename parameter.
(input_filename, main_input_filename): Constify.
* toplev.h: Update prototypes.
* tree.c: Include output.h. Don't declare
first_global_object_name or weak_global_object_name. Clean up string
bashing in get_file_function_name_long.
* tree.h (struct tree_decl): Constify filename member.
(input_filename): Constify.
Update prototypes.
* varasm.c (first_global_object_name, weak_global_object_name):
Constify.
(assemble_start_function, assemble_variable): Clean up string bashing.
* gcc.c: Constify all spec-related strings initialized,
transitively, from string constants. Constify all strings
and string variables related to multilibs.
(set_spec, read_specs): Cast argument to free to PTR.
(used_arg): Do not modify multilib_matches. Use strncmp plus
length comparison to compare multilib switches.
* genmultilib: Constify everything declared in multilib.h.
ch:
* ch-tree.h: Update prototypes. Remove prototypes for
functions declared elsewhere.
* decl.c (define_label): Constify filename parameter.
* grant.c (globalize_decl, set_default_grant_file): Constify
local char * variables. Don't declare
first_global_object_name or asm_out_file.
* lang.c (chill_real_input_filename): Constify.
* lex.c (init_parse): Constify parameter and return value.
* parse.c: Don't declare input_filename.
(ch_expand_asm_operands): Constify filename parameter.
(parse_multi_dimension_case_action): Constify local char *.
* satisfy.c (safe_satisfy_decl): Constify local char *.
cp:
* cp-tree.h: Constify tree_srcloc.filename, tinst_level.file,
and pending_inline.filename. Update prototypes.
* decl.c (define_label): Constify filename parameter.
* decl2.c (warn_if_unknown_interface): Constify local char *.
* input.c Constify input_source.filename. Don't declare
input_filename or lineno. Constify filename parameter to feed_input.
* lex.c (init_parse): Constify parameter and return value.
(cp_pragma_interface, cp_pragma_implementation): Constify
filename argument.
(reinit_parse_for_method, reinit_parse_for_block,
reinit_parse_for_expr, feed_defarg, handle_cp_pragma):
Constify local char *.
* pt.c: Don't declare lineno or input_filename.
(print_template_context, tsubst_friend_function, tsubst_decl,
tsubst, instantiate_decl): Constify local char *.
* semantics.c (expand_body): Constify local char *.
* tree.c (build_srcloc): Constify filename parameter.
* typeck.c (c_expand_asm_operands): Constify filename
parameter.
f:
* com.c (ffecom_subscript_check_): Constify array_name
parameter. Clean up string bashing.
(ffecom_arrayref_, ffecom_char_args_x_): Constify array_name
parameter.
(ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_,
ffecom_sym_transform_, ffecom_sym_transform_assign_): Constify
local char *.
(init_parse): Constify parameter and return value.
* lex.c: Include dwarfout.h instead of prototyping dwarfout_*
functions here.
(ffelex_file_pop_, ffelex_file_push_): Constify filename parameter.
(ffelex_hash_, ffelex_include_): Constify local char *.
* std.c (ffestd_exec_end): Constify local char *.
* where.c (ffewhere_file_new): Constify filename parameter.
* where.h: Update prototypes.
java:
* check_init.c (check_init): Constify local char *.
* class.c (push_class): Constify local char *.
* java_tree.h: Update prototypes.
* jcf-io.c (open_class): Constify filename parameter and
return value.
(find_class): Remove redundant string copy. Cast return from
open_class.
* jcf-parse.c (read_class, parse_class_file, yyparse):
Constify local char *.
* jcf-write.c (generate_bytecode_insns, generate_classfile):
Constify local char *.
* jcf.h (JCF): Constify filename and classname.
(JCF_FINISH): Cast args to FREE to char * when appropriate.
* lang.c (init_parse): Constify parameter and return value.
* lex.c (java_get_line_col): Constify filename parameter.
* parse.h: Constify parser_ctxt.filename. Update prototypes.
* parse.y (java_parser_context_suspend,
issue_warning_error_from_context, safe_layout_class): Constify
local char *.
* parse.c: Regenerate.
From-SVN: r33804
2000-05-09 21:56:01 +02:00
|
|
|
|
const char *pending_invalid_xref_file;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int pending_invalid_xref_line;
|
|
|
|
|
|
|
|
|
|
/* While defining an enum type, this is 1 plus the last enumerator
|
1993-08-31 12:25:38 +02:00
|
|
|
|
constant value. Note that will do not have to save this or `enum_overflow'
|
|
|
|
|
around nested function definition since such a definition could only
|
|
|
|
|
occur in an enum value expression and we don't use these variables in
|
|
|
|
|
that case. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
static tree enum_next_value;
|
|
|
|
|
|
1992-05-18 07:09:24 +02:00
|
|
|
|
/* Nonzero means that there was overflow computing enum_next_value. */
|
|
|
|
|
|
|
|
|
|
static int enum_overflow;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Parsing a function declarator leaves a list of parameter names
|
|
|
|
|
or a chain or parameter decls here. */
|
|
|
|
|
|
|
|
|
|
static tree last_function_parms;
|
|
|
|
|
|
|
|
|
|
/* Parsing a function declarator leaves here a chain of structure
|
|
|
|
|
and enum types declared in the parmlist. */
|
|
|
|
|
|
|
|
|
|
static tree last_function_parm_tags;
|
|
|
|
|
|
|
|
|
|
/* After parsing the declarator that starts a function definition,
|
|
|
|
|
`start_function' puts here the list of parameter names or chain of decls.
|
|
|
|
|
`store_parm_decls' finds it here. */
|
|
|
|
|
|
|
|
|
|
static tree current_function_parms;
|
|
|
|
|
|
|
|
|
|
/* Similar, for last_function_parm_tags. */
|
|
|
|
|
static tree current_function_parm_tags;
|
|
|
|
|
|
1993-03-18 23:01:56 +01:00
|
|
|
|
/* Similar, for the file and line that the prototype came from if this is
|
|
|
|
|
an old-style definition. */
|
top level:
* Makefile.in (WARN_CFLAGS): Add -Wwrite-strings.
(tree.o): Depend on output.h.
* c-decl.c (pending_invalid_xref_file,
current_function_prototype_file): Constify.
(pushdecl): Constify a local char *.
(define_label): Constify filename parameter.
* c-lex.c (init_parse): Constify parameter and return value.
* c-typeck.c (c_expand_asm_operands): Constify filename parameter.
* c-tree.h: Update prototypes.
* c-parse.in: Constify filename member of %union, and if_stmt_file.
* c-parse.y, c-parse.c, c-parse.h, objc/objc-parse.y,
objc/objc-parse.c: Regenerate.
* dwarfout.c (dwarfout_init): Constify main_input_filename parameter.
* dwarfout.h: Update prototypes.
* expr.c (expand_expr): Constify a local char *.
* flags.h: Constify main_input_filename.
* function.c (expand_function_end): Constify filename parameter.
* genrecog.c (make_insn_sequence): Use a character array for
c_test_pos.
(main): Remove unused variables.
* input.h: Constify input_filename, main_input_filename, and
file_stack.name. Update prototypes.
* output.h: Declare first_global_object_name and
weak_global_object_name here, as const char *.
* stmt.c (expand_asm_operands): Constify filename parameter.
* toplev.c (compile_file, push_srcloc, debug_start_source_file):
Constify filename parameter.
(input_filename, main_input_filename): Constify.
* toplev.h: Update prototypes.
* tree.c: Include output.h. Don't declare
first_global_object_name or weak_global_object_name. Clean up string
bashing in get_file_function_name_long.
* tree.h (struct tree_decl): Constify filename member.
(input_filename): Constify.
Update prototypes.
* varasm.c (first_global_object_name, weak_global_object_name):
Constify.
(assemble_start_function, assemble_variable): Clean up string bashing.
* gcc.c: Constify all spec-related strings initialized,
transitively, from string constants. Constify all strings
and string variables related to multilibs.
(set_spec, read_specs): Cast argument to free to PTR.
(used_arg): Do not modify multilib_matches. Use strncmp plus
length comparison to compare multilib switches.
* genmultilib: Constify everything declared in multilib.h.
ch:
* ch-tree.h: Update prototypes. Remove prototypes for
functions declared elsewhere.
* decl.c (define_label): Constify filename parameter.
* grant.c (globalize_decl, set_default_grant_file): Constify
local char * variables. Don't declare
first_global_object_name or asm_out_file.
* lang.c (chill_real_input_filename): Constify.
* lex.c (init_parse): Constify parameter and return value.
* parse.c: Don't declare input_filename.
(ch_expand_asm_operands): Constify filename parameter.
(parse_multi_dimension_case_action): Constify local char *.
* satisfy.c (safe_satisfy_decl): Constify local char *.
cp:
* cp-tree.h: Constify tree_srcloc.filename, tinst_level.file,
and pending_inline.filename. Update prototypes.
* decl.c (define_label): Constify filename parameter.
* decl2.c (warn_if_unknown_interface): Constify local char *.
* input.c Constify input_source.filename. Don't declare
input_filename or lineno. Constify filename parameter to feed_input.
* lex.c (init_parse): Constify parameter and return value.
(cp_pragma_interface, cp_pragma_implementation): Constify
filename argument.
(reinit_parse_for_method, reinit_parse_for_block,
reinit_parse_for_expr, feed_defarg, handle_cp_pragma):
Constify local char *.
* pt.c: Don't declare lineno or input_filename.
(print_template_context, tsubst_friend_function, tsubst_decl,
tsubst, instantiate_decl): Constify local char *.
* semantics.c (expand_body): Constify local char *.
* tree.c (build_srcloc): Constify filename parameter.
* typeck.c (c_expand_asm_operands): Constify filename
parameter.
f:
* com.c (ffecom_subscript_check_): Constify array_name
parameter. Clean up string bashing.
(ffecom_arrayref_, ffecom_char_args_x_): Constify array_name
parameter.
(ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_,
ffecom_sym_transform_, ffecom_sym_transform_assign_): Constify
local char *.
(init_parse): Constify parameter and return value.
* lex.c: Include dwarfout.h instead of prototyping dwarfout_*
functions here.
(ffelex_file_pop_, ffelex_file_push_): Constify filename parameter.
(ffelex_hash_, ffelex_include_): Constify local char *.
* std.c (ffestd_exec_end): Constify local char *.
* where.c (ffewhere_file_new): Constify filename parameter.
* where.h: Update prototypes.
java:
* check_init.c (check_init): Constify local char *.
* class.c (push_class): Constify local char *.
* java_tree.h: Update prototypes.
* jcf-io.c (open_class): Constify filename parameter and
return value.
(find_class): Remove redundant string copy. Cast return from
open_class.
* jcf-parse.c (read_class, parse_class_file, yyparse):
Constify local char *.
* jcf-write.c (generate_bytecode_insns, generate_classfile):
Constify local char *.
* jcf.h (JCF): Constify filename and classname.
(JCF_FINISH): Cast args to FREE to char * when appropriate.
* lang.c (init_parse): Constify parameter and return value.
* lex.c (java_get_line_col): Constify filename parameter.
* parse.h: Constify parser_ctxt.filename. Update prototypes.
* parse.y (java_parser_context_suspend,
issue_warning_error_from_context, safe_layout_class): Constify
local char *.
* parse.c: Regenerate.
From-SVN: r33804
2000-05-09 21:56:01 +02:00
|
|
|
|
static const char *current_function_prototype_file;
|
1993-03-18 23:01:56 +01:00
|
|
|
|
static int current_function_prototype_line;
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* The current statement tree. */
|
|
|
|
|
|
|
|
|
|
static struct stmt_tree_s c_stmt_tree;
|
|
|
|
|
|
|
|
|
|
/* The current scope statement stack. */
|
|
|
|
|
|
|
|
|
|
static tree c_scope_stmt_stack;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function
|
|
|
|
|
that have names. Here so we can clear out their names' definitions
|
|
|
|
|
at the end of the function. */
|
|
|
|
|
|
1992-07-03 22:23:56 +02:00
|
|
|
|
static tree named_labels;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* A list of LABEL_DECLs from outer contexts that are currently shadowed. */
|
|
|
|
|
|
|
|
|
|
static tree shadowed_labels;
|
|
|
|
|
|
|
|
|
|
/* Nonzero when store_parm_decls is called indicates a varargs function.
|
|
|
|
|
Value not meaningful after store_parm_decls. */
|
|
|
|
|
|
|
|
|
|
static int c_function_varargs;
|
|
|
|
|
|
|
|
|
|
/* Set to 0 at beginning of a function definition, set to 1 if
|
|
|
|
|
a return statement that specifies a return value is seen. */
|
|
|
|
|
|
|
|
|
|
int current_function_returns_value;
|
|
|
|
|
|
|
|
|
|
/* Set to 0 at beginning of a function definition, set to 1 if
|
|
|
|
|
a return statement with no argument is seen. */
|
|
|
|
|
|
|
|
|
|
int current_function_returns_null;
|
|
|
|
|
|
|
|
|
|
/* Set to nonzero by `grokdeclarator' for a function
|
|
|
|
|
whose return type is defaulted, if warnings for this are desired. */
|
|
|
|
|
|
|
|
|
|
static int warn_about_return_type;
|
|
|
|
|
|
1992-03-23 03:07:53 +01:00
|
|
|
|
/* Nonzero when starting a function declared `extern inline'. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
static int current_extern_inline;
|
|
|
|
|
|
|
|
|
|
/* For each binding contour we allocate a binding_level structure
|
|
|
|
|
* which records the names defined in that contour.
|
|
|
|
|
* Contours include:
|
|
|
|
|
* 0) the global one
|
|
|
|
|
* 1) one for each function definition,
|
|
|
|
|
* where internal declarations of the parameters appear.
|
|
|
|
|
* 2) one for each compound statement,
|
|
|
|
|
* to record its declarations.
|
|
|
|
|
*
|
|
|
|
|
* The current meaning of a name can be found by searching the levels from
|
|
|
|
|
* the current one out to the global one.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Note that the information in the `names' component of the global contour
|
|
|
|
|
is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */
|
|
|
|
|
|
|
|
|
|
struct binding_level
|
|
|
|
|
{
|
|
|
|
|
/* A chain of _DECL nodes for all variables, constants, functions,
|
|
|
|
|
and typedef types. These are in the reverse of the order supplied.
|
|
|
|
|
*/
|
|
|
|
|
tree names;
|
|
|
|
|
|
|
|
|
|
/* A list of structure, union and enum definitions,
|
|
|
|
|
* for looking up tag names.
|
|
|
|
|
* It is a chain of TREE_LIST nodes, each of whose TREE_PURPOSE is a name,
|
|
|
|
|
* or NULL_TREE; and whose TREE_VALUE is a RECORD_TYPE, UNION_TYPE,
|
|
|
|
|
* or ENUMERAL_TYPE node.
|
|
|
|
|
*/
|
|
|
|
|
tree tags;
|
|
|
|
|
|
|
|
|
|
/* For each level, a list of shadowed outer-level local definitions
|
|
|
|
|
to be restored when this level is popped.
|
|
|
|
|
Each link is a TREE_LIST whose TREE_PURPOSE is an identifier and
|
|
|
|
|
whose TREE_VALUE is its old definition (a kind of ..._DECL node). */
|
|
|
|
|
tree shadowed;
|
|
|
|
|
|
|
|
|
|
/* For each level (except not the global one),
|
|
|
|
|
a chain of BLOCK nodes for all the levels
|
|
|
|
|
that were entered and exited one level down. */
|
|
|
|
|
tree blocks;
|
|
|
|
|
|
1992-08-26 08:03:24 +02:00
|
|
|
|
/* The BLOCK node for this level, if one has been preallocated.
|
|
|
|
|
If 0, the BLOCK is allocated (if needed) when the level is popped. */
|
|
|
|
|
tree this_block;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* The binding level which this one is contained in (inherits from). */
|
|
|
|
|
struct binding_level *level_chain;
|
|
|
|
|
|
|
|
|
|
/* Nonzero for the level that holds the parameters of a function. */
|
|
|
|
|
char parm_flag;
|
|
|
|
|
|
|
|
|
|
/* Nonzero if this level "doesn't exist" for tags. */
|
|
|
|
|
char tag_transparent;
|
|
|
|
|
|
|
|
|
|
/* Nonzero if sublevels of this level "don't exist" for tags.
|
|
|
|
|
This is set in the parm level of a function definition
|
|
|
|
|
while reading the function body, so that the outermost block
|
|
|
|
|
of the function body will be tag-transparent. */
|
|
|
|
|
char subblocks_tag_transparent;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means make a BLOCK for this level regardless of all else. */
|
|
|
|
|
char keep;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means make a BLOCK if this level has any subblocks. */
|
|
|
|
|
char keep_if_subblocks;
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Number of decls in `names' that have incomplete
|
1992-02-13 23:21:26 +01:00
|
|
|
|
structure or union types. */
|
|
|
|
|
int n_incomplete;
|
|
|
|
|
|
|
|
|
|
/* A list of decls giving the (reversed) specified order of parms,
|
|
|
|
|
not including any forward-decls in the parmlist.
|
|
|
|
|
This is so we can put the parms in proper order for assign_parms. */
|
|
|
|
|
tree parm_order;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define NULL_BINDING_LEVEL (struct binding_level *) NULL
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* The binding level currently in effect. */
|
|
|
|
|
|
|
|
|
|
static struct binding_level *current_binding_level;
|
|
|
|
|
|
|
|
|
|
/* A chain of binding_level structures awaiting reuse. */
|
|
|
|
|
|
|
|
|
|
static struct binding_level *free_binding_level;
|
|
|
|
|
|
|
|
|
|
/* The outermost binding level, for names of file scope.
|
|
|
|
|
This is created when the compiler is started and exists
|
|
|
|
|
through the entire run. */
|
|
|
|
|
|
|
|
|
|
static struct binding_level *global_binding_level;
|
|
|
|
|
|
|
|
|
|
/* Binding level structures are initialized by copying this one. */
|
|
|
|
|
|
|
|
|
|
static struct binding_level clear_binding_level
|
1994-06-23 23:39:11 +02:00
|
|
|
|
= {NULL, NULL, NULL, NULL, NULL, NULL_BINDING_LEVEL, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
NULL};
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Nonzero means unconditionally make a BLOCK for the next level pushed. */
|
|
|
|
|
|
|
|
|
|
static int keep_next_level_flag;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means make a BLOCK for the next level pushed
|
|
|
|
|
if it has subblocks. */
|
|
|
|
|
|
|
|
|
|
static int keep_next_if_subblocks;
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* The chain of outer levels of label scopes.
|
|
|
|
|
This uses the same data structure used for binding levels,
|
|
|
|
|
but it works differently: each link in the chain records
|
|
|
|
|
saved values of named_labels and shadowed_labels for
|
|
|
|
|
a label binding level outside the current one. */
|
|
|
|
|
|
|
|
|
|
static struct binding_level *label_level_chain;
|
|
|
|
|
|
1995-01-14 02:09:01 +01:00
|
|
|
|
/* Functions called automatically at the beginning and end of execution. */
|
|
|
|
|
|
|
|
|
|
tree static_ctors, static_dtors;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Forward declarations. */
|
|
|
|
|
|
2000-01-12 23:47:13 +01:00
|
|
|
|
static struct binding_level * make_binding_level PARAMS ((void));
|
|
|
|
|
static void mark_binding_level PARAMS ((void *));
|
|
|
|
|
static void clear_limbo_values PARAMS ((tree));
|
|
|
|
|
static int duplicate_decls PARAMS ((tree, tree, int));
|
|
|
|
|
static int redeclaration_error_message PARAMS ((tree, tree));
|
|
|
|
|
static void storedecls PARAMS ((tree));
|
|
|
|
|
static void storetags PARAMS ((tree));
|
|
|
|
|
static tree lookup_tag PARAMS ((enum tree_code, tree,
|
|
|
|
|
struct binding_level *, int));
|
|
|
|
|
static tree lookup_tag_reverse PARAMS ((tree));
|
|
|
|
|
static tree grokdeclarator PARAMS ((tree, tree, enum decl_context,
|
|
|
|
|
int));
|
|
|
|
|
static tree grokparms PARAMS ((tree, int));
|
|
|
|
|
static void layout_array_type PARAMS ((tree));
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
static tree c_make_fname_decl PARAMS ((tree, int));
|
2001-11-12 01:02:36 +01:00
|
|
|
|
static void c_expand_body PARAMS ((tree, int, int));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* C-specific option variables. */
|
|
|
|
|
|
|
|
|
|
/* Nonzero means allow type mismatches in conditional expressions;
|
2001-10-10 13:33:39 +02:00
|
|
|
|
just make their values `void'. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
int flag_cond_mismatch;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means don't recognize the keyword `asm'. */
|
|
|
|
|
|
|
|
|
|
int flag_no_asm;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means do some things the same way PCC does. */
|
|
|
|
|
|
|
|
|
|
int flag_traditional;
|
|
|
|
|
|
2000-11-29 00:07:29 +01:00
|
|
|
|
/* Nonzero means enable C89 Amendment 1 features. */
|
2000-08-04 18:10:14 +02:00
|
|
|
|
|
|
|
|
|
int flag_isoc94 = 0;
|
|
|
|
|
|
2000-01-29 20:00:43 +01:00
|
|
|
|
/* Nonzero means use the ISO C99 dialect of C. */
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
|
2000-01-29 20:00:43 +01:00
|
|
|
|
int flag_isoc99 = 0;
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
|
1997-01-19 21:04:35 +01:00
|
|
|
|
/* Nonzero means that we have builtin functions, and main is an int */
|
|
|
|
|
|
|
|
|
|
int flag_hosted = 1;
|
|
|
|
|
|
2000-08-21 16:30:38 +02:00
|
|
|
|
/* Nonzero means add default format_arg attributes for functions not
|
|
|
|
|
in ISO C. */
|
|
|
|
|
|
|
|
|
|
int flag_noniso_default_format_attributes = 1;
|
|
|
|
|
|
1993-09-23 04:04:32 +02:00
|
|
|
|
/* Nonzero means to allow single precision math even if we're generally
|
1996-07-04 00:07:53 +02:00
|
|
|
|
being traditional. */
|
1993-09-23 04:04:32 +02:00
|
|
|
|
int flag_allow_single_precision = 0;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
|
|
|
|
|
|
|
|
|
|
int flag_signed_bitfields = 1;
|
1992-10-06 01:23:17 +01:00
|
|
|
|
int explicit_flag_signed_bitfields = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Nonzero means warn about use of implicit int. */
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
|
|
|
|
int warn_implicit_int;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1998-07-08 14:16:05 +02:00
|
|
|
|
/* Nonzero means warn about usage of long long when `-pedantic'. */
|
|
|
|
|
|
|
|
|
|
int warn_long_long = 1;
|
|
|
|
|
|
1997-11-02 22:19:36 +01:00
|
|
|
|
/* Nonzero means message about use of implicit function declarations;
|
2000-08-11 00:01:22 +02:00
|
|
|
|
1 means warning; 2 means error. */
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
2000-07-31 20:10:31 +02:00
|
|
|
|
int mesg_implicit_function_declaration = -1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Nonzero means give string constants the type `const char *'
|
|
|
|
|
to get extra warnings from them. These warnings will be too numerous
|
|
|
|
|
to be useful, except in thoroughly ANSIfied programs. */
|
|
|
|
|
|
1998-08-24 04:08:45 +02:00
|
|
|
|
int flag_const_strings;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Nonzero means warn about pointer casts that can drop a type qualifier
|
|
|
|
|
from the pointer target type. */
|
|
|
|
|
|
|
|
|
|
int warn_cast_qual;
|
|
|
|
|
|
1994-06-24 22:17:01 +02:00
|
|
|
|
/* Nonzero means warn when casting a function call to a type that does
|
|
|
|
|
not match the return type (e.g. (float)sqrt() or (anything*)malloc()
|
|
|
|
|
when there is no previous declaration of sqrt or malloc. */
|
|
|
|
|
|
|
|
|
|
int warn_bad_function_cast;
|
|
|
|
|
|
2000-10-17 08:52:06 +02:00
|
|
|
|
/* Warn about functions which might be candidates for format attributes. */
|
|
|
|
|
|
|
|
|
|
int warn_missing_format_attribute;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Warn about traditional constructs whose meanings changed in ANSI C. */
|
|
|
|
|
|
|
|
|
|
int warn_traditional;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means warn about sizeof(function) or addition/subtraction
|
|
|
|
|
of function pointers. */
|
|
|
|
|
|
|
|
|
|
int warn_pointer_arith;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means warn for non-prototype function decls
|
|
|
|
|
or non-prototyped defs without previous prototype. */
|
|
|
|
|
|
|
|
|
|
int warn_strict_prototypes;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means warn for any global function def
|
|
|
|
|
without separate previous prototype decl. */
|
|
|
|
|
|
|
|
|
|
int warn_missing_prototypes;
|
|
|
|
|
|
1994-04-06 13:31:44 +02:00
|
|
|
|
/* Nonzero means warn for any global function def
|
|
|
|
|
without separate previous decl. */
|
|
|
|
|
|
|
|
|
|
int warn_missing_declarations;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Nonzero means warn about multiple (redundant) decls for the same single
|
|
|
|
|
variable or function. */
|
|
|
|
|
|
|
|
|
|
int warn_redundant_decls = 0;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means warn about extern declarations of objects not at
|
|
|
|
|
file-scope level and about *all* declarations of functions (whether
|
|
|
|
|
extern or static) not at file-scope level. Note that we exclude
|
|
|
|
|
implicit function declarations. To get warnings about those, use
|
|
|
|
|
-Wimplicit. */
|
|
|
|
|
|
|
|
|
|
int warn_nested_externs = 0;
|
|
|
|
|
|
|
|
|
|
/* Warn about a subscript that has type char. */
|
|
|
|
|
|
|
|
|
|
int warn_char_subscripts = 0;
|
|
|
|
|
|
|
|
|
|
/* Warn if a type conversion is done that might have confusing results. */
|
|
|
|
|
|
|
|
|
|
int warn_conversion;
|
|
|
|
|
|
|
|
|
|
/* Warn if adding () is suggested. */
|
|
|
|
|
|
1992-03-23 03:07:53 +01:00
|
|
|
|
int warn_parentheses;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1993-02-13 10:19:04 +01:00
|
|
|
|
/* Warn if initializer is not completely bracketed. */
|
|
|
|
|
|
|
|
|
|
int warn_missing_braces;
|
|
|
|
|
|
1997-01-19 21:04:35 +01:00
|
|
|
|
/* Warn if main is suspicious. */
|
|
|
|
|
|
|
|
|
|
int warn_main;
|
|
|
|
|
|
1997-12-21 16:24:48 +01:00
|
|
|
|
/* Warn about #pragma directives that are not recognised. */
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
int warn_unknown_pragmas = 0; /* Tri state variable. */
|
1997-12-21 16:24:48 +01:00
|
|
|
|
|
1997-09-27 05:46:35 +02:00
|
|
|
|
/* Warn about comparison of signed and unsigned values.
|
|
|
|
|
If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */
|
1996-02-19 11:22:57 +01:00
|
|
|
|
|
1997-09-27 05:46:35 +02:00
|
|
|
|
int warn_sign_compare = -1;
|
1996-02-19 11:22:57 +01:00
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Warn about testing equality of floating point numbers. */
|
1999-09-30 08:19:54 +02:00
|
|
|
|
|
|
|
|
|
int warn_float_equal = 0;
|
|
|
|
|
|
1998-07-06 23:53:23 +02:00
|
|
|
|
/* Nonzero means warn about use of multicharacter literals. */
|
|
|
|
|
|
|
|
|
|
int warn_multichar = 1;
|
|
|
|
|
|
2000-06-06 23:54:54 +02:00
|
|
|
|
/* The variant of the C language being processed. */
|
|
|
|
|
|
|
|
|
|
c_language_kind c_language = clk_c;
|
|
|
|
|
|
1996-10-09 22:19:45 +02:00
|
|
|
|
/* Nonzero means `$' can be in an identifier. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
#ifndef DOLLARS_IN_IDENTIFIERS
|
|
|
|
|
#define DOLLARS_IN_IDENTIFIERS 1
|
|
|
|
|
#endif
|
1996-10-09 22:19:45 +02:00
|
|
|
|
int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Decode the string P as a language-specific option for C.
|
1999-09-20 16:26:59 +02:00
|
|
|
|
Return the number of strings consumed. Should not complain
|
|
|
|
|
if it does not recognise the option. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int
|
1998-06-10 12:12:36 +02:00
|
|
|
|
c_decode_option (argc, argv)
|
1998-10-13 17:25:25 +02:00
|
|
|
|
int argc ATTRIBUTE_UNUSED;
|
1998-06-10 12:12:36 +02:00
|
|
|
|
char **argv;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1998-06-10 12:12:36 +02:00
|
|
|
|
int strings_processed;
|
|
|
|
|
char *p = argv[0];
|
2000-11-25 20:28:44 +01:00
|
|
|
|
|
2000-11-28 22:13:35 +01:00
|
|
|
|
strings_processed = cpp_handle_option (parse_in, argc, argv);
|
1998-06-10 12:12:36 +02:00
|
|
|
|
|
2000-11-29 23:19:28 +01:00
|
|
|
|
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-11-18 18:16:24 +01:00
|
|
|
|
warning ("-traditional is deprecated and may be removed");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
flag_traditional = 1;
|
|
|
|
|
flag_writable_strings = 1;
|
|
|
|
|
}
|
1993-09-23 04:04:32 +02:00
|
|
|
|
else if (!strcmp (p, "-fallow-single-precision"))
|
|
|
|
|
flag_allow_single_precision = 1;
|
1997-01-19 21:04:35 +01:00
|
|
|
|
else if (!strcmp (p, "-fhosted") || !strcmp (p, "-fno-freestanding"))
|
|
|
|
|
{
|
|
|
|
|
flag_hosted = 1;
|
|
|
|
|
flag_no_builtin = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (!strcmp (p, "-ffreestanding") || !strcmp (p, "-fno-hosted"))
|
|
|
|
|
{
|
|
|
|
|
flag_hosted = 0;
|
|
|
|
|
flag_no_builtin = 1;
|
|
|
|
|
/* warn_main will be 2 if set by -Wall, 1 if set by -Wmain */
|
|
|
|
|
if (warn_main == 2)
|
|
|
|
|
warn_main = 0;
|
|
|
|
|
}
|
1992-08-31 23:29:49 +02:00
|
|
|
|
else if (!strcmp (p, "-fnotraditional") || !strcmp (p, "-fno-traditional"))
|
|
|
|
|
{
|
|
|
|
|
flag_traditional = 0;
|
|
|
|
|
flag_writable_strings = 0;
|
|
|
|
|
}
|
1998-12-01 22:05:17 +01:00
|
|
|
|
else if (!strncmp (p, "-std=", 5))
|
|
|
|
|
{
|
|
|
|
|
/* Select the appropriate language standard. We currently
|
|
|
|
|
recognize:
|
|
|
|
|
-std=iso9899:1990 same as -ansi
|
|
|
|
|
-std=iso9899:199409 ISO C as modified in amend. 1
|
2000-01-29 20:00:43 +01:00
|
|
|
|
-std=iso9899:1999 ISO C 99
|
1998-12-01 22:05:17 +01:00
|
|
|
|
-std=c89 same as -std=iso9899:1990
|
2000-01-29 20:00:43 +01:00
|
|
|
|
-std=c99 same as -std=iso9899:1999
|
1998-12-08 11:26:36 +01:00
|
|
|
|
-std=gnu89 default, iso9899:1990 + gnu extensions
|
2000-01-29 20:00:43 +01:00
|
|
|
|
-std=gnu99 iso9899:1999 + gnu extensions
|
1998-12-01 22:05:17 +01:00
|
|
|
|
*/
|
c-common.c (c_tree_code_name): Const-ification.
* c-common.c (c_tree_code_name): Const-ification.
* c-decl.c (c_decode_option): Likewise.
* c-typeck.c (warn_for_assignment): Likewise.
* collect2.c (libexts, is_ctor_dtor, main, ignore_library):
Likewise.
* cppinit.c (output_deps): Likewise.
* dependence.c (dependence_string, direction_string): Likewise.
* dwarf2out.c (output_ranges): Likewise.
* fixinc/fixfixes.c (emit_gnu_type): Likewise.
* fixinc/gnu-regex.c (re_error_msgid): Likewise.
* gcc.c (standard_exec_prefix, standard_exec_prefix_1,
standard_startfile_prefix, standard_startfile_prefix_1,
standard_startfile_prefix_2, tooldir_base_prefix,
standard_bindir_prefix, find_a_file): Likewise.
* genattrtab.c (make_length_attrs): Likewise.
* gencheck.c (tree_codes): Likewise.
* genemit.c (gen_split): Likewise.
* genrecog.c (special_mode_pred_table): Likewise.
* graph.c (graph_ext): Likewise.
* protoize (default_include): Likewise.
* reload.c (reload_when_needed_name): Likewise.
* sched-vis.c (visualize_stall_cycles): Likewise.
* tlink.c (recompile_files): Likewise.
* toplev.c (decode_g_option): Likewise.
* tradcpp.c (output_deps): Likewise.
* varasm.c (decode_reg_name): Likewise.
* arm.c (arm_condition_codes, strings_fpa, thumb_condition_code):
Const-ification.
* arm.md: Likewise.
* avr.c (avr_regnames, encode_section_info): Likewise.
* c4x.c (float_reg_names): Likewise.
* darwin.h (ASM_GLOBALIZE_LABEL): Likewise.
* elfos.h (const_section): Likewise.
* i386.c (ix86_comp_type_attributes): Likewise.
* i386/win32.h (STRIP_NAME_ENCODING): Likewise.
* ia64/aix.h (UNIQUE_SECTION): Likewise.
* ia64.c (type_names): Likewise.
* m68hc11.c (reg_class_names): Likewise.
* m88k.c (m_options): Likewise.
* mips.c (mips_output_conditional_branch, mips_unique_section):
Likewise.
* rs6000/sysv4.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
* sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue,
ultra_code_names): Likewise.
* sparc.h (OVERRIDE_OPTIONS): Likewise.
From-SVN: r45567
2001-09-12 19:18:03 +02:00
|
|
|
|
const char *const argstart = &p[5];
|
1998-12-01 22:05:17 +01:00
|
|
|
|
|
|
|
|
|
if (!strcmp (argstart, "iso9899:1990")
|
|
|
|
|
|| !strcmp (argstart, "c89"))
|
|
|
|
|
{
|
|
|
|
|
iso_1990:
|
2000-08-04 18:10:14 +02:00
|
|
|
|
flag_isoc94 = 0;
|
2000-11-29 00:07:29 +01:00
|
|
|
|
iso_1994:
|
1998-12-01 22:05:17 +01:00
|
|
|
|
flag_traditional = 0;
|
|
|
|
|
flag_writable_strings = 0;
|
|
|
|
|
flag_no_asm = 1;
|
|
|
|
|
flag_no_nonansi_builtin = 1;
|
2000-08-21 16:30:38 +02:00
|
|
|
|
flag_noniso_default_format_attributes = 0;
|
2000-01-29 20:00:43 +01:00
|
|
|
|
flag_isoc99 = 0;
|
1998-12-01 22:05:17 +01:00
|
|
|
|
}
|
|
|
|
|
else if (!strcmp (argstart, "iso9899:199409"))
|
|
|
|
|
{
|
2000-08-04 18:10:14 +02:00
|
|
|
|
flag_isoc94 = 1;
|
2000-11-29 00:07:29 +01:00
|
|
|
|
goto iso_1994;
|
1998-12-01 22:05:17 +01:00
|
|
|
|
}
|
|
|
|
|
else if (!strcmp (argstart, "iso9899:199x")
|
2000-01-29 20:00:43 +01:00
|
|
|
|
|| !strcmp (argstart, "iso9899:1999")
|
|
|
|
|
|| !strcmp (argstart, "c9x")
|
|
|
|
|
|| !strcmp (argstart, "c99"))
|
1998-12-01 22:05:17 +01:00
|
|
|
|
{
|
|
|
|
|
flag_traditional = 0;
|
|
|
|
|
flag_writable_strings = 0;
|
|
|
|
|
flag_no_asm = 1;
|
|
|
|
|
flag_no_nonansi_builtin = 1;
|
2000-08-21 16:30:38 +02:00
|
|
|
|
flag_noniso_default_format_attributes = 0;
|
2000-01-29 20:00:43 +01:00
|
|
|
|
flag_isoc99 = 1;
|
2000-08-04 18:10:14 +02:00
|
|
|
|
flag_isoc94 = 1;
|
1998-12-01 22:05:17 +01:00
|
|
|
|
}
|
1998-12-08 11:26:36 +01:00
|
|
|
|
else if (!strcmp (argstart, "gnu89"))
|
|
|
|
|
{
|
|
|
|
|
flag_traditional = 0;
|
|
|
|
|
flag_writable_strings = 0;
|
|
|
|
|
flag_no_asm = 0;
|
|
|
|
|
flag_no_nonansi_builtin = 0;
|
2000-08-21 16:30:38 +02:00
|
|
|
|
flag_noniso_default_format_attributes = 1;
|
2000-01-29 20:00:43 +01:00
|
|
|
|
flag_isoc99 = 0;
|
2000-08-04 18:10:14 +02:00
|
|
|
|
flag_isoc94 = 0;
|
1998-12-08 11:26:36 +01:00
|
|
|
|
}
|
2000-01-29 20:00:43 +01:00
|
|
|
|
else if (!strcmp (argstart, "gnu9x") || !strcmp (argstart, "gnu99"))
|
1998-12-01 22:05:17 +01:00
|
|
|
|
{
|
|
|
|
|
flag_traditional = 0;
|
|
|
|
|
flag_writable_strings = 0;
|
|
|
|
|
flag_no_asm = 0;
|
|
|
|
|
flag_no_nonansi_builtin = 0;
|
2000-08-21 16:30:38 +02:00
|
|
|
|
flag_noniso_default_format_attributes = 1;
|
2000-01-29 20:00:43 +01:00
|
|
|
|
flag_isoc99 = 1;
|
2000-08-04 18:10:14 +02:00
|
|
|
|
flag_isoc94 = 1;
|
1998-12-01 22:05:17 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
error ("unknown C standard `%s'", argstart);
|
|
|
|
|
}
|
1993-06-25 20:01:20 +02:00
|
|
|
|
else if (!strcmp (p, "-fdollars-in-identifiers"))
|
1996-10-09 22:19:45 +02:00
|
|
|
|
dollars_in_ident = 1;
|
1994-06-23 23:39:11 +02:00
|
|
|
|
else if (!strcmp (p, "-fno-dollars-in-identifiers"))
|
1993-06-25 20:01:20 +02:00
|
|
|
|
dollars_in_ident = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-fsigned-char"))
|
|
|
|
|
flag_signed_char = 1;
|
|
|
|
|
else if (!strcmp (p, "-funsigned-char"))
|
|
|
|
|
flag_signed_char = 0;
|
|
|
|
|
else if (!strcmp (p, "-fno-signed-char"))
|
|
|
|
|
flag_signed_char = 0;
|
|
|
|
|
else if (!strcmp (p, "-fno-unsigned-char"))
|
|
|
|
|
flag_signed_char = 1;
|
1992-10-06 01:23:17 +01:00
|
|
|
|
else if (!strcmp (p, "-fsigned-bitfields")
|
|
|
|
|
|| !strcmp (p, "-fno-unsigned-bitfields"))
|
|
|
|
|
{
|
|
|
|
|
flag_signed_bitfields = 1;
|
|
|
|
|
explicit_flag_signed_bitfields = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (!strcmp (p, "-funsigned-bitfields")
|
|
|
|
|
|| !strcmp (p, "-fno-signed-bitfields"))
|
|
|
|
|
{
|
|
|
|
|
flag_signed_bitfields = 0;
|
|
|
|
|
explicit_flag_signed_bitfields = 1;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-fshort-enums"))
|
|
|
|
|
flag_short_enums = 1;
|
|
|
|
|
else if (!strcmp (p, "-fno-short-enums"))
|
|
|
|
|
flag_short_enums = 0;
|
1999-09-23 23:03:53 +02:00
|
|
|
|
else if (!strcmp (p, "-fshort-wchar"))
|
|
|
|
|
flag_short_wchar = 1;
|
|
|
|
|
else if (!strcmp (p, "-fno-short-wchar"))
|
|
|
|
|
flag_short_wchar = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-fcond-mismatch"))
|
|
|
|
|
flag_cond_mismatch = 1;
|
|
|
|
|
else if (!strcmp (p, "-fno-cond-mismatch"))
|
|
|
|
|
flag_cond_mismatch = 0;
|
|
|
|
|
else if (!strcmp (p, "-fshort-double"))
|
|
|
|
|
flag_short_double = 1;
|
|
|
|
|
else if (!strcmp (p, "-fno-short-double"))
|
|
|
|
|
flag_short_double = 0;
|
|
|
|
|
else if (!strcmp (p, "-fasm"))
|
|
|
|
|
flag_no_asm = 0;
|
|
|
|
|
else if (!strcmp (p, "-fno-asm"))
|
|
|
|
|
flag_no_asm = 1;
|
|
|
|
|
else if (!strcmp (p, "-fbuiltin"))
|
|
|
|
|
flag_no_builtin = 0;
|
|
|
|
|
else if (!strcmp (p, "-fno-builtin"))
|
|
|
|
|
flag_no_builtin = 1;
|
2001-11-18 04:30:57 +01:00
|
|
|
|
else if (!strncmp (p, "-fno-builtin-", strlen ("-fno-builtin-")))
|
|
|
|
|
disable_builtin_function (p + strlen ("-fno-builtin-"));
|
2001-08-31 18:34:44 +02:00
|
|
|
|
else if (p[0] == '-' && p[1] == 'f' && dump_switch_p (p + 2))
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-ansi"))
|
1998-12-01 22:05:17 +01:00
|
|
|
|
goto iso_1990;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
else if (!strcmp (p, "-Werror-implicit-function-declaration"))
|
|
|
|
|
mesg_implicit_function_declaration = 2;
|
|
|
|
|
else if (!strcmp (p, "-Wimplicit-function-declaration"))
|
|
|
|
|
mesg_implicit_function_declaration = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-implicit-function-declaration"))
|
|
|
|
|
mesg_implicit_function_declaration = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wimplicit-int"))
|
|
|
|
|
warn_implicit_int = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-implicit-int"))
|
|
|
|
|
warn_implicit_int = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wimplicit"))
|
1997-11-02 22:19:36 +01:00
|
|
|
|
{
|
|
|
|
|
warn_implicit_int = 1;
|
|
|
|
|
if (mesg_implicit_function_declaration != 2)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
mesg_implicit_function_declaration = 1;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wno-implicit"))
|
1997-11-02 22:19:36 +01:00
|
|
|
|
warn_implicit_int = 0, mesg_implicit_function_declaration = 0;
|
1998-07-08 14:16:05 +02:00
|
|
|
|
else if (!strcmp (p, "-Wlong-long"))
|
|
|
|
|
warn_long_long = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-long-long"))
|
|
|
|
|
warn_long_long = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wwrite-strings"))
|
1998-08-24 04:08:45 +02:00
|
|
|
|
flag_const_strings = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wno-write-strings"))
|
1998-08-24 04:08:45 +02:00
|
|
|
|
flag_const_strings = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wcast-qual"))
|
|
|
|
|
warn_cast_qual = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-cast-qual"))
|
|
|
|
|
warn_cast_qual = 0;
|
1994-06-24 22:17:01 +02:00
|
|
|
|
else if (!strcmp (p, "-Wbad-function-cast"))
|
|
|
|
|
warn_bad_function_cast = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-bad-function-cast"))
|
|
|
|
|
warn_bad_function_cast = 0;
|
1998-10-20 09:32:08 +02:00
|
|
|
|
else if (!strcmp (p, "-Wno-missing-noreturn"))
|
|
|
|
|
warn_missing_noreturn = 0;
|
2000-10-17 08:52:06 +02:00
|
|
|
|
else if (!strcmp (p, "-Wmissing-format-attribute"))
|
|
|
|
|
warn_missing_format_attribute = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-missing-format-attribute"))
|
|
|
|
|
warn_missing_format_attribute = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wpointer-arith"))
|
|
|
|
|
warn_pointer_arith = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-pointer-arith"))
|
|
|
|
|
warn_pointer_arith = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wstrict-prototypes"))
|
|
|
|
|
warn_strict_prototypes = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-strict-prototypes"))
|
|
|
|
|
warn_strict_prototypes = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wmissing-prototypes"))
|
|
|
|
|
warn_missing_prototypes = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-missing-prototypes"))
|
|
|
|
|
warn_missing_prototypes = 0;
|
1994-04-06 13:31:44 +02:00
|
|
|
|
else if (!strcmp (p, "-Wmissing-declarations"))
|
|
|
|
|
warn_missing_declarations = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-missing-declarations"))
|
|
|
|
|
warn_missing_declarations = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wredundant-decls"))
|
|
|
|
|
warn_redundant_decls = 1;
|
1992-04-04 10:50:38 +02:00
|
|
|
|
else if (!strcmp (p, "-Wno-redundant-decls"))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warn_redundant_decls = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wnested-externs"))
|
|
|
|
|
warn_nested_externs = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-nested-externs"))
|
|
|
|
|
warn_nested_externs = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wtraditional"))
|
|
|
|
|
warn_traditional = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-traditional"))
|
|
|
|
|
warn_traditional = 0;
|
2000-01-31 04:31:26 +01:00
|
|
|
|
else if (!strncmp (p, "-Wformat=", 9))
|
c-common.c (warn_format, [...]): Define.
* c-common.c (warn_format, warn_format_y2k,
warn_format_extra_args, warn_format_nonliteral): Define.
(check_format_info): Check warn_format_nonliteral and
warn_format_extra_args.
(check_format_info_main): Check warn_format_y2k.
(set_Wformat): New function.
* c-common.h (warn_format_y2k, warn_format_extra_args,
warn_format_nonliteral, set_Wformat): Declare.
* c-decl.c (warn_format): Remove definition.
(c_decode_option): Handle -Wformat-nonliteral,
-Wno-format-extra-args and -Wno-format-y2k, and negated versions.
Use set_Wformat.
* invoke.texi: Document these new options and -Wformat=2.
* toplev.c (documented_lang_options): Add these new options.
cp:
* decl2.c (warn_format): Remove definition.
(lang_decode_option): Handle -Wformat-nonliteral,
-Wno-format-extra-args and -Wno-format-y2k. Use set_Wformat.
testsuite:
* gcc.dg/format-no-exargs-1.c, gcc.dg/format-no-y2k-1.c,
gcc.dg/format-nonlit-1.c, gcc.dg/format-nonlit-2.c: New tests.
From-SVN: r37933
2000-12-01 23:43:33 +01:00
|
|
|
|
set_Wformat (atoi (p + 9));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wformat"))
|
c-common.c (warn_format, [...]): Define.
* c-common.c (warn_format, warn_format_y2k,
warn_format_extra_args, warn_format_nonliteral): Define.
(check_format_info): Check warn_format_nonliteral and
warn_format_extra_args.
(check_format_info_main): Check warn_format_y2k.
(set_Wformat): New function.
* c-common.h (warn_format_y2k, warn_format_extra_args,
warn_format_nonliteral, set_Wformat): Declare.
* c-decl.c (warn_format): Remove definition.
(c_decode_option): Handle -Wformat-nonliteral,
-Wno-format-extra-args and -Wno-format-y2k, and negated versions.
Use set_Wformat.
* invoke.texi: Document these new options and -Wformat=2.
* toplev.c (documented_lang_options): Add these new options.
cp:
* decl2.c (warn_format): Remove definition.
(lang_decode_option): Handle -Wformat-nonliteral,
-Wno-format-extra-args and -Wno-format-y2k. Use set_Wformat.
testsuite:
* gcc.dg/format-no-exargs-1.c, gcc.dg/format-no-y2k-1.c,
gcc.dg/format-nonlit-1.c, gcc.dg/format-nonlit-2.c: New tests.
From-SVN: r37933
2000-12-01 23:43:33 +01:00
|
|
|
|
set_Wformat (1);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wno-format"))
|
c-common.c (warn_format, [...]): Define.
* c-common.c (warn_format, warn_format_y2k,
warn_format_extra_args, warn_format_nonliteral): Define.
(check_format_info): Check warn_format_nonliteral and
warn_format_extra_args.
(check_format_info_main): Check warn_format_y2k.
(set_Wformat): New function.
* c-common.h (warn_format_y2k, warn_format_extra_args,
warn_format_nonliteral, set_Wformat): Declare.
* c-decl.c (warn_format): Remove definition.
(c_decode_option): Handle -Wformat-nonliteral,
-Wno-format-extra-args and -Wno-format-y2k, and negated versions.
Use set_Wformat.
* invoke.texi: Document these new options and -Wformat=2.
* toplev.c (documented_lang_options): Add these new options.
cp:
* decl2.c (warn_format): Remove definition.
(lang_decode_option): Handle -Wformat-nonliteral,
-Wno-format-extra-args and -Wno-format-y2k. Use set_Wformat.
testsuite:
* gcc.dg/format-no-exargs-1.c, gcc.dg/format-no-y2k-1.c,
gcc.dg/format-nonlit-1.c, gcc.dg/format-nonlit-2.c: New tests.
From-SVN: r37933
2000-12-01 23:43:33 +01:00
|
|
|
|
set_Wformat (0);
|
|
|
|
|
else if (!strcmp (p, "-Wformat-y2k"))
|
|
|
|
|
warn_format_y2k = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-format-y2k"))
|
|
|
|
|
warn_format_y2k = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wformat-extra-args"))
|
|
|
|
|
warn_format_extra_args = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-format-extra-args"))
|
|
|
|
|
warn_format_extra_args = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wformat-nonliteral"))
|
|
|
|
|
warn_format_nonliteral = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-format-nonliteral"))
|
|
|
|
|
warn_format_nonliteral = 0;
|
2000-12-07 08:56:44 +01:00
|
|
|
|
else if (!strcmp (p, "-Wformat-security"))
|
|
|
|
|
warn_format_security = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-format-security"))
|
|
|
|
|
warn_format_security = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wchar-subscripts"))
|
|
|
|
|
warn_char_subscripts = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-char-subscripts"))
|
|
|
|
|
warn_char_subscripts = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wconversion"))
|
|
|
|
|
warn_conversion = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-conversion"))
|
|
|
|
|
warn_conversion = 0;
|
|
|
|
|
else if (!strcmp (p, "-Wparentheses"))
|
|
|
|
|
warn_parentheses = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-parentheses"))
|
|
|
|
|
warn_parentheses = 0;
|
1992-11-22 22:22:32 +01:00
|
|
|
|
else if (!strcmp (p, "-Wreturn-type"))
|
|
|
|
|
warn_return_type = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-return-type"))
|
|
|
|
|
warn_return_type = 0;
|
2000-10-11 23:54:33 +02:00
|
|
|
|
else if (!strcmp (p, "-Wsequence-point"))
|
|
|
|
|
warn_sequence_point = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-sequence-point"))
|
|
|
|
|
warn_sequence_point = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wcomment"))
|
|
|
|
|
; /* cpp handles this one. */
|
|
|
|
|
else if (!strcmp (p, "-Wno-comment"))
|
|
|
|
|
; /* cpp handles this one. */
|
|
|
|
|
else if (!strcmp (p, "-Wcomments"))
|
|
|
|
|
; /* cpp handles this one. */
|
|
|
|
|
else if (!strcmp (p, "-Wno-comments"))
|
|
|
|
|
; /* cpp handles this one. */
|
|
|
|
|
else if (!strcmp (p, "-Wtrigraphs"))
|
|
|
|
|
; /* cpp handles this one. */
|
|
|
|
|
else if (!strcmp (p, "-Wno-trigraphs"))
|
|
|
|
|
; /* cpp handles this one. */
|
1997-04-13 18:47:53 +02:00
|
|
|
|
else if (!strcmp (p, "-Wundef"))
|
|
|
|
|
; /* cpp handles this one. */
|
|
|
|
|
else if (!strcmp (p, "-Wno-undef"))
|
|
|
|
|
; /* cpp handles this one. */
|
1992-04-17 04:05:56 +02:00
|
|
|
|
else if (!strcmp (p, "-Wimport"))
|
|
|
|
|
; /* cpp handles this one. */
|
|
|
|
|
else if (!strcmp (p, "-Wno-import"))
|
|
|
|
|
; /* cpp handles this one. */
|
1993-02-13 10:19:04 +01:00
|
|
|
|
else if (!strcmp (p, "-Wmissing-braces"))
|
|
|
|
|
warn_missing_braces = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-missing-braces"))
|
|
|
|
|
warn_missing_braces = 0;
|
1997-01-19 21:04:35 +01:00
|
|
|
|
else if (!strcmp (p, "-Wmain"))
|
|
|
|
|
warn_main = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-main"))
|
1999-04-12 16:05:29 +02:00
|
|
|
|
warn_main = -1;
|
1996-02-19 11:22:57 +01:00
|
|
|
|
else if (!strcmp (p, "-Wsign-compare"))
|
|
|
|
|
warn_sign_compare = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-sign-compare"))
|
|
|
|
|
warn_sign_compare = 0;
|
1999-09-30 08:19:54 +02:00
|
|
|
|
else if (!strcmp (p, "-Wfloat-equal"))
|
|
|
|
|
warn_float_equal = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-float-equal"))
|
|
|
|
|
warn_float_equal = 0;
|
1998-07-06 23:53:23 +02:00
|
|
|
|
else if (!strcmp (p, "-Wmultichar"))
|
|
|
|
|
warn_multichar = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-multichar"))
|
|
|
|
|
warn_multichar = 0;
|
2001-10-23 20:14:31 +02:00
|
|
|
|
else if (!strcmp (p, "-Wdiv-by-zero"))
|
|
|
|
|
warn_div_by_zero = 1;
|
|
|
|
|
else if (!strcmp (p, "-Wno-div-by-zero"))
|
|
|
|
|
warn_div_by_zero = 0;
|
1997-12-21 16:24:48 +01:00
|
|
|
|
else if (!strcmp (p, "-Wunknown-pragmas"))
|
|
|
|
|
/* Set to greater than 1, so that even unknown pragmas in system
|
|
|
|
|
headers will be warned about. */
|
|
|
|
|
warn_unknown_pragmas = 2;
|
|
|
|
|
else if (!strcmp (p, "-Wno-unknown-pragmas"))
|
|
|
|
|
warn_unknown_pragmas = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!strcmp (p, "-Wall"))
|
|
|
|
|
{
|
1993-01-15 01:35:00 +01:00
|
|
|
|
/* We save the value of warn_uninitialized, since if they put
|
|
|
|
|
-Wuninitialized on the command line, we need to generate a
|
|
|
|
|
warning about not using it without also specifying -O. */
|
|
|
|
|
if (warn_uninitialized != 1)
|
|
|
|
|
warn_uninitialized = 2;
|
1997-11-02 22:19:36 +01:00
|
|
|
|
warn_implicit_int = 1;
|
|
|
|
|
mesg_implicit_function_declaration = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warn_return_type = 1;
|
2000-05-17 10:15:29 +02:00
|
|
|
|
set_Wunused (1);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warn_switch = 1;
|
c-common.c (warn_format, [...]): Define.
* c-common.c (warn_format, warn_format_y2k,
warn_format_extra_args, warn_format_nonliteral): Define.
(check_format_info): Check warn_format_nonliteral and
warn_format_extra_args.
(check_format_info_main): Check warn_format_y2k.
(set_Wformat): New function.
* c-common.h (warn_format_y2k, warn_format_extra_args,
warn_format_nonliteral, set_Wformat): Declare.
* c-decl.c (warn_format): Remove definition.
(c_decode_option): Handle -Wformat-nonliteral,
-Wno-format-extra-args and -Wno-format-y2k, and negated versions.
Use set_Wformat.
* invoke.texi: Document these new options and -Wformat=2.
* toplev.c (documented_lang_options): Add these new options.
cp:
* decl2.c (warn_format): Remove definition.
(lang_decode_option): Handle -Wformat-nonliteral,
-Wno-format-extra-args and -Wno-format-y2k. Use set_Wformat.
testsuite:
* gcc.dg/format-no-exargs-1.c, gcc.dg/format-no-y2k-1.c,
gcc.dg/format-nonlit-1.c, gcc.dg/format-nonlit-2.c: New tests.
From-SVN: r37933
2000-12-01 23:43:33 +01:00
|
|
|
|
set_Wformat (1);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warn_char_subscripts = 1;
|
1992-03-23 03:07:53 +01:00
|
|
|
|
warn_parentheses = 1;
|
2000-10-11 23:54:33 +02:00
|
|
|
|
warn_sequence_point = 1;
|
1993-02-13 10:19:04 +01:00
|
|
|
|
warn_missing_braces = 1;
|
1997-01-19 21:04:35 +01:00
|
|
|
|
/* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn
|
|
|
|
|
it off only if it's not explicit. */
|
|
|
|
|
warn_main = 2;
|
1997-12-21 16:24:48 +01:00
|
|
|
|
/* Only warn about unknown pragmas that are not in system headers. */
|
|
|
|
|
warn_unknown_pragmas = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
1998-06-10 12:12:36 +02:00
|
|
|
|
return strings_processed;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
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
|
|
|
|
c_print_identifier (file, node, indent)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
FILE *file;
|
|
|
|
|
tree node;
|
|
|
|
|
int indent;
|
|
|
|
|
{
|
|
|
|
|
print_node (file, "global", IDENTIFIER_GLOBAL_VALUE (node), indent + 4);
|
|
|
|
|
print_node (file, "local", IDENTIFIER_LOCAL_VALUE (node), indent + 4);
|
|
|
|
|
print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
|
|
|
|
|
print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);
|
|
|
|
|
print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);
|
1992-09-16 02:54:45 +02:00
|
|
|
|
print_node (file, "limbo value", IDENTIFIER_LIMBO_VALUE (node), indent + 4);
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
if (C_IS_RESERVED_WORD (node))
|
|
|
|
|
{
|
|
|
|
|
tree rid = ridpointers[C_RID_CODE (node)];
|
|
|
|
|
indent_to (file, indent + 4);
|
|
|
|
|
fprintf (file, "rid ");
|
|
|
|
|
fprintf (file, HOST_PTR_PRINTF, (void *)rid);
|
|
|
|
|
fprintf (file, " \"%s\"", IDENTIFIER_POINTER (rid));
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1993-03-22 08:04:18 +01:00
|
|
|
|
/* Hook called at end of compilation to assume 1 elt
|
2000-09-06 08:06:46 +02:00
|
|
|
|
for a top-level tentative array defn that wasn't complete before. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1993-03-22 08:04:18 +01:00
|
|
|
|
void
|
|
|
|
|
finish_incomplete_decl (decl)
|
|
|
|
|
tree decl;
|
|
|
|
|
{
|
1996-01-16 02:05:06 +01:00
|
|
|
|
if (TREE_CODE (decl) == VAR_DECL)
|
1993-03-22 08:04:18 +01:00
|
|
|
|
{
|
|
|
|
|
tree type = TREE_TYPE (decl);
|
1996-01-16 02:05:06 +01:00
|
|
|
|
if (type != error_mark_node
|
|
|
|
|
&& TREE_CODE (type) == ARRAY_TYPE
|
2000-09-06 08:06:46 +02:00
|
|
|
|
&& ! DECL_EXTERNAL (decl)
|
1996-01-16 02:05:06 +01:00
|
|
|
|
&& TYPE_DOMAIN (type) == 0)
|
1993-03-22 08:04:18 +01:00
|
|
|
|
{
|
2000-09-06 08:06:46 +02:00
|
|
|
|
warning_with_decl (decl, "array `%s' assumed to have one element");
|
1996-01-16 02:05:06 +01:00
|
|
|
|
|
1993-03-22 08:04:18 +01:00
|
|
|
|
complete_array_type (type, NULL_TREE, 1);
|
|
|
|
|
|
|
|
|
|
layout_decl (decl, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Create a new `struct binding_level'. */
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
static struct binding_level *
|
1992-02-13 23:21:26 +01:00
|
|
|
|
make_binding_level ()
|
|
|
|
|
{
|
|
|
|
|
/* NOSTRICT */
|
|
|
|
|
return (struct binding_level *) xmalloc (sizeof (struct binding_level));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nonzero if we are currently in the global binding level. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
global_bindings_p ()
|
|
|
|
|
{
|
|
|
|
|
return current_binding_level == global_binding_level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
keep_next_level ()
|
|
|
|
|
{
|
|
|
|
|
keep_next_level_flag = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nonzero if the current level needs to have a BLOCK made. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
kept_level_p ()
|
|
|
|
|
{
|
|
|
|
|
return ((current_binding_level->keep_if_subblocks
|
|
|
|
|
&& current_binding_level->blocks != 0)
|
|
|
|
|
|| current_binding_level->keep
|
|
|
|
|
|| current_binding_level->names != 0
|
|
|
|
|
|| (current_binding_level->tags != 0
|
|
|
|
|
&& !current_binding_level->tag_transparent));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Identify this binding level as a level of parameters.
|
1993-02-27 20:08:53 +01:00
|
|
|
|
DEFINITION_FLAG is 1 for a definition, 0 for a declaration.
|
|
|
|
|
But it turns out there is no way to pass the right value for
|
|
|
|
|
DEFINITION_FLAG, so we ignore it. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
declare_parm_level (definition_flag)
|
1998-10-13 17:25:25 +02:00
|
|
|
|
int definition_flag ATTRIBUTE_UNUSED;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1993-02-27 20:08:53 +01:00
|
|
|
|
current_binding_level->parm_flag = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nonzero if currently making parm declarations. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
in_parm_level_p ()
|
|
|
|
|
{
|
|
|
|
|
return current_binding_level->parm_flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Enter a new binding level.
|
|
|
|
|
If TAG_TRANSPARENT is nonzero, do so only for the name space of variables,
|
|
|
|
|
not for that of tags. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pushlevel (tag_transparent)
|
|
|
|
|
int tag_transparent;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct binding_level *newlevel = NULL_BINDING_LEVEL;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* If this is the top level of a function,
|
|
|
|
|
just make sure that NAMED_LABELS is 0. */
|
|
|
|
|
|
|
|
|
|
if (current_binding_level == global_binding_level)
|
|
|
|
|
{
|
|
|
|
|
named_labels = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Reuse or create a struct for this binding level. */
|
|
|
|
|
|
|
|
|
|
if (free_binding_level)
|
|
|
|
|
{
|
|
|
|
|
newlevel = free_binding_level;
|
|
|
|
|
free_binding_level = free_binding_level->level_chain;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
newlevel = make_binding_level ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add this level to the front of the chain (stack) of levels that
|
|
|
|
|
are active. */
|
|
|
|
|
|
|
|
|
|
*newlevel = clear_binding_level;
|
|
|
|
|
newlevel->tag_transparent
|
|
|
|
|
= (tag_transparent
|
|
|
|
|
|| (current_binding_level
|
|
|
|
|
? current_binding_level->subblocks_tag_transparent
|
|
|
|
|
: 0));
|
|
|
|
|
newlevel->level_chain = current_binding_level;
|
|
|
|
|
current_binding_level = newlevel;
|
|
|
|
|
newlevel->keep = keep_next_level_flag;
|
|
|
|
|
keep_next_level_flag = 0;
|
|
|
|
|
newlevel->keep_if_subblocks = keep_next_if_subblocks;
|
|
|
|
|
keep_next_if_subblocks = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Clear the limbo values of all identifiers defined in BLOCK or a subblock. */
|
1996-04-16 23:32:49 +02:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
clear_limbo_values (block)
|
|
|
|
|
tree block;
|
|
|
|
|
{
|
|
|
|
|
tree tem;
|
|
|
|
|
|
|
|
|
|
for (tem = BLOCK_VARS (block); tem; tem = TREE_CHAIN (tem))
|
|
|
|
|
if (DECL_NAME (tem) != 0)
|
|
|
|
|
IDENTIFIER_LIMBO_VALUE (DECL_NAME (tem)) = 0;
|
|
|
|
|
|
|
|
|
|
for (tem = BLOCK_SUBBLOCKS (block); tem; tem = TREE_CHAIN (tem))
|
|
|
|
|
clear_limbo_values (tem);
|
|
|
|
|
}
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Exit a binding level.
|
|
|
|
|
Pop the level off, and restore the state of the identifier-decl mappings
|
|
|
|
|
that were in effect when this level was entered.
|
|
|
|
|
|
|
|
|
|
If KEEP is nonzero, this level had explicit declarations, so
|
|
|
|
|
and create a "block" (a BLOCK node) for the level
|
|
|
|
|
to record its declarations and subblocks for symbol table output.
|
|
|
|
|
|
|
|
|
|
If FUNCTIONBODY is nonzero, this level is the body of a function,
|
|
|
|
|
so create a block as if KEEP were set and also clear out all
|
|
|
|
|
label names.
|
|
|
|
|
|
|
|
|
|
If REVERSE is nonzero, reverse the order of decls before putting
|
|
|
|
|
them into the BLOCK. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
poplevel (keep, reverse, functionbody)
|
|
|
|
|
int keep;
|
|
|
|
|
int reverse;
|
|
|
|
|
int functionbody;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree link;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* The chain of decls was accumulated in reverse order.
|
|
|
|
|
Put it into forward order, just for cleanliness. */
|
|
|
|
|
tree decls;
|
|
|
|
|
tree tags = current_binding_level->tags;
|
|
|
|
|
tree subblocks = current_binding_level->blocks;
|
|
|
|
|
tree block = 0;
|
|
|
|
|
tree decl;
|
1992-09-01 22:30:57 +02:00
|
|
|
|
int block_previously_created;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
keep |= current_binding_level->keep;
|
|
|
|
|
|
|
|
|
|
/* This warning is turned off because it causes warnings for
|
|
|
|
|
declarations like `extern struct foo *x'. */
|
|
|
|
|
#if 0
|
|
|
|
|
/* Warn about incomplete structure types in this level. */
|
|
|
|
|
for (link = tags; link; link = TREE_CHAIN (link))
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (TREE_VALUE (link)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
tree type = TREE_VALUE (link);
|
1999-01-27 02:43:17 +01:00
|
|
|
|
tree type_name = TYPE_NAME (type);
|
|
|
|
|
char *id = IDENTIFIER_POINTER (TREE_CODE (type_name) == IDENTIFIER_NODE
|
|
|
|
|
? type_name
|
|
|
|
|
: DECL_NAME (type_name));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
switch (TREE_CODE (type))
|
|
|
|
|
{
|
|
|
|
|
case RECORD_TYPE:
|
1999-01-27 02:43:17 +01:00
|
|
|
|
error ("`struct %s' incomplete in scope ending here", id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
break;
|
|
|
|
|
case UNION_TYPE:
|
1999-01-27 02:43:17 +01:00
|
|
|
|
error ("`union %s' incomplete in scope ending here", id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
break;
|
|
|
|
|
case ENUMERAL_TYPE:
|
1999-01-27 02:43:17 +01:00
|
|
|
|
error ("`enum %s' incomplete in scope ending here", id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif /* 0 */
|
|
|
|
|
|
|
|
|
|
/* Get the decls in the order they were written.
|
|
|
|
|
Usually current_binding_level->names is in reverse order.
|
|
|
|
|
But parameter decls were previously put in forward order. */
|
|
|
|
|
|
|
|
|
|
if (reverse)
|
|
|
|
|
current_binding_level->names
|
|
|
|
|
= decls = nreverse (current_binding_level->names);
|
|
|
|
|
else
|
|
|
|
|
decls = current_binding_level->names;
|
|
|
|
|
|
|
|
|
|
/* Output any nested inline functions within this block
|
|
|
|
|
if they weren't already output. */
|
|
|
|
|
|
|
|
|
|
for (decl = decls; decl; decl = TREE_CHAIN (decl))
|
|
|
|
|
if (TREE_CODE (decl) == FUNCTION_DECL
|
|
|
|
|
&& ! TREE_ASM_WRITTEN (decl)
|
|
|
|
|
&& DECL_INITIAL (decl) != 0
|
|
|
|
|
&& TREE_ADDRESSABLE (decl))
|
1992-08-07 06:06:43 +02:00
|
|
|
|
{
|
|
|
|
|
/* If this decl was copied from a file-scope decl
|
|
|
|
|
on account of a block-scope extern decl,
|
1995-04-11 19:41:27 +02:00
|
|
|
|
propagate TREE_ADDRESSABLE to the file-scope decl.
|
|
|
|
|
|
|
|
|
|
DECL_ABSTRACT_ORIGIN can be set to itself if warn_return_type is
|
|
|
|
|
true, since then the decl goes through save_for_inline_copying. */
|
|
|
|
|
if (DECL_ABSTRACT_ORIGIN (decl) != 0
|
|
|
|
|
&& DECL_ABSTRACT_ORIGIN (decl) != decl)
|
1992-08-07 06:06:43 +02:00
|
|
|
|
TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-09-19 09:59:58 +02:00
|
|
|
|
/* We used to warn about unused variables in expand_end_bindings,
|
|
|
|
|
i.e. while generating RTL. But in function-at-a-time mode we may
|
|
|
|
|
choose to never expand a function at all (e.g. auto inlining), so
|
|
|
|
|
we do this explicitly now. */
|
|
|
|
|
warn_about_unused_variables (getdecls ());
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* If there were any declarations or structure tags in that level,
|
|
|
|
|
or if this level is a function body,
|
|
|
|
|
create a BLOCK to record them for the life of this function. */
|
|
|
|
|
|
1992-08-26 08:03:24 +02:00
|
|
|
|
block = 0;
|
1992-09-01 22:30:57 +02:00
|
|
|
|
block_previously_created = (current_binding_level->this_block != 0);
|
|
|
|
|
if (block_previously_created)
|
1992-08-26 08:03:24 +02:00
|
|
|
|
block = current_binding_level->this_block;
|
|
|
|
|
else if (keep || functionbody
|
|
|
|
|
|| (current_binding_level->keep_if_subblocks && subblocks != 0))
|
|
|
|
|
block = make_node (BLOCK);
|
|
|
|
|
if (block != 0)
|
|
|
|
|
{
|
|
|
|
|
BLOCK_VARS (block) = decls;
|
|
|
|
|
BLOCK_SUBBLOCKS (block) = subblocks;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* In each subblock, record that this is its superior. */
|
|
|
|
|
|
|
|
|
|
for (link = subblocks; link; link = TREE_CHAIN (link))
|
|
|
|
|
BLOCK_SUPERCONTEXT (link) = block;
|
|
|
|
|
|
|
|
|
|
/* Clear out the meanings of the local variables of this level. */
|
|
|
|
|
|
|
|
|
|
for (link = decls; link; link = TREE_CHAIN (link))
|
|
|
|
|
{
|
|
|
|
|
if (DECL_NAME (link) != 0)
|
|
|
|
|
{
|
|
|
|
|
/* If the ident. was used or addressed via a local extern decl,
|
|
|
|
|
don't forget that fact. */
|
1992-07-12 04:56:45 +02:00
|
|
|
|
if (DECL_EXTERNAL (link))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
if (TREE_USED (link))
|
|
|
|
|
TREE_USED (DECL_NAME (link)) = 1;
|
|
|
|
|
if (TREE_ADDRESSABLE (link))
|
|
|
|
|
TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (link)) = 1;
|
|
|
|
|
}
|
|
|
|
|
IDENTIFIER_LOCAL_VALUE (DECL_NAME (link)) = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Restore all name-meanings of the outer levels
|
|
|
|
|
that were shadowed by this level. */
|
|
|
|
|
|
|
|
|
|
for (link = current_binding_level->shadowed; link; link = TREE_CHAIN (link))
|
|
|
|
|
IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
|
|
|
|
|
|
|
|
|
|
/* If the level being exited is the top level of a function,
|
|
|
|
|
check over all the labels, and clear out the current
|
|
|
|
|
(function local) meanings of their names. */
|
|
|
|
|
|
|
|
|
|
if (functionbody)
|
|
|
|
|
{
|
1996-04-16 23:32:49 +02:00
|
|
|
|
clear_limbo_values (block);
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* If this is the top level block of a function,
|
|
|
|
|
the vars are the function's parameters.
|
|
|
|
|
Don't leave them in the BLOCK because they are
|
|
|
|
|
found in the FUNCTION_DECL instead. */
|
|
|
|
|
|
|
|
|
|
BLOCK_VARS (block) = 0;
|
|
|
|
|
|
|
|
|
|
/* Clear out the definitions of all label names,
|
|
|
|
|
since their scopes end here,
|
|
|
|
|
and add them to BLOCK_VARS. */
|
|
|
|
|
|
|
|
|
|
for (link = named_labels; link; link = TREE_CHAIN (link))
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree label = TREE_VALUE (link);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (DECL_INITIAL (label) == 0)
|
|
|
|
|
{
|
|
|
|
|
error_with_decl (label, "label `%s' used but not defined");
|
|
|
|
|
/* Avoid crashing later. */
|
|
|
|
|
define_label (input_filename, lineno,
|
|
|
|
|
DECL_NAME (label));
|
|
|
|
|
}
|
2000-05-17 10:15:29 +02:00
|
|
|
|
else if (warn_unused_label && !TREE_USED (label))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning_with_decl (label, "label `%s' defined but not used");
|
|
|
|
|
IDENTIFIER_LABEL_VALUE (DECL_NAME (label)) = 0;
|
|
|
|
|
|
|
|
|
|
/* Put the labels into the "variables" of the
|
|
|
|
|
top-level block, so debugger can see them. */
|
|
|
|
|
TREE_CHAIN (label) = BLOCK_VARS (block);
|
|
|
|
|
BLOCK_VARS (block) = label;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Pop the current level, and free the structure for reuse. */
|
|
|
|
|
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct binding_level *level = current_binding_level;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
current_binding_level = current_binding_level->level_chain;
|
|
|
|
|
|
|
|
|
|
level->level_chain = free_binding_level;
|
|
|
|
|
free_binding_level = level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Dispose of the block that we just made inside some higher level. */
|
|
|
|
|
if (functionbody)
|
|
|
|
|
DECL_INITIAL (current_function_decl) = block;
|
|
|
|
|
else if (block)
|
1992-09-01 22:30:57 +02:00
|
|
|
|
{
|
|
|
|
|
if (!block_previously_created)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
current_binding_level->blocks
|
|
|
|
|
= chainon (current_binding_level->blocks, block);
|
1992-09-01 22:30:57 +02:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* If we did not make a block for the level just exited,
|
|
|
|
|
any blocks made for inner levels
|
|
|
|
|
(since they cannot be recorded as subblocks in that level)
|
|
|
|
|
must be carried forward so they will later become subblocks
|
|
|
|
|
of something else. */
|
|
|
|
|
else if (subblocks)
|
|
|
|
|
current_binding_level->blocks
|
|
|
|
|
= chainon (current_binding_level->blocks, subblocks);
|
|
|
|
|
|
|
|
|
|
/* Set the TYPE_CONTEXTs for all of the tagged types belonging to this
|
|
|
|
|
binding contour so that they point to the appropriate construct, i.e.
|
|
|
|
|
either to the current FUNCTION_DECL node, or else to the BLOCK node
|
|
|
|
|
we just constructed.
|
|
|
|
|
|
|
|
|
|
Note that for tagged types whose scope is just the formal parameter
|
|
|
|
|
list for some function type specification, we can't properly set
|
|
|
|
|
their TYPE_CONTEXTs here, because we don't have a pointer to the
|
|
|
|
|
appropriate FUNCTION_TYPE node readily available to us. For those
|
|
|
|
|
cases, the TYPE_CONTEXTs of the relevant tagged type nodes get set
|
|
|
|
|
in `grokdeclarator' as soon as we have created the FUNCTION_TYPE
|
|
|
|
|
node which will represent the "scope" for these "parameter list local"
|
2000-08-11 00:01:22 +02:00
|
|
|
|
tagged types. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (functionbody)
|
|
|
|
|
for (link = tags; link; link = TREE_CHAIN (link))
|
|
|
|
|
TYPE_CONTEXT (TREE_VALUE (link)) = current_function_decl;
|
|
|
|
|
else if (block)
|
|
|
|
|
for (link = tags; link; link = TREE_CHAIN (link))
|
|
|
|
|
TYPE_CONTEXT (TREE_VALUE (link)) = block;
|
|
|
|
|
|
|
|
|
|
if (block)
|
|
|
|
|
TREE_USED (block) = 1;
|
2000-09-17 09:38:23 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return block;
|
|
|
|
|
}
|
1992-08-26 08:03:24 +02:00
|
|
|
|
|
|
|
|
|
/* Insert BLOCK at the end of the list of subblocks of the
|
|
|
|
|
current binding level. This is used when a BIND_EXPR is expanded,
|
1993-07-07 00:23:54 +02:00
|
|
|
|
to handle the BLOCK node inside the BIND_EXPR. */
|
1992-08-26 08:03:24 +02:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
insert_block (block)
|
|
|
|
|
tree block;
|
|
|
|
|
{
|
|
|
|
|
TREE_USED (block) = 1;
|
|
|
|
|
current_binding_level->blocks
|
|
|
|
|
= chainon (current_binding_level->blocks, block);
|
|
|
|
|
}
|
|
|
|
|
|
1992-09-01 22:30:57 +02:00
|
|
|
|
/* Set the BLOCK node for the innermost scope
|
1992-08-26 08:03:24 +02:00
|
|
|
|
(the one we are currently in). */
|
|
|
|
|
|
1992-09-01 22:30:57 +02:00
|
|
|
|
void
|
|
|
|
|
set_block (block)
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree block;
|
1992-08-26 08:03:24 +02:00
|
|
|
|
{
|
1992-09-01 22:30:57 +02:00
|
|
|
|
current_binding_level->this_block = block;
|
2001-02-23 21:38:58 +01:00
|
|
|
|
current_binding_level->names = chainon (current_binding_level->names,
|
|
|
|
|
BLOCK_VARS (block));
|
|
|
|
|
current_binding_level->blocks = chainon (current_binding_level->blocks,
|
|
|
|
|
BLOCK_SUBBLOCKS (block));
|
1992-08-26 08:03:24 +02:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
push_label_level ()
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct binding_level *newlevel;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Reuse or create a struct for this binding level. */
|
|
|
|
|
|
|
|
|
|
if (free_binding_level)
|
|
|
|
|
{
|
|
|
|
|
newlevel = free_binding_level;
|
|
|
|
|
free_binding_level = free_binding_level->level_chain;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
newlevel = make_binding_level ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add this level to the front of the chain (stack) of label levels. */
|
|
|
|
|
|
|
|
|
|
newlevel->level_chain = label_level_chain;
|
|
|
|
|
label_level_chain = newlevel;
|
|
|
|
|
|
|
|
|
|
newlevel->names = named_labels;
|
|
|
|
|
newlevel->shadowed = shadowed_labels;
|
|
|
|
|
named_labels = 0;
|
|
|
|
|
shadowed_labels = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pop_label_level ()
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct binding_level *level = label_level_chain;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
tree link, prev;
|
|
|
|
|
|
|
|
|
|
/* Clear out the definitions of the declared labels in this level.
|
|
|
|
|
Leave in the list any ordinary, non-declared labels. */
|
|
|
|
|
for (link = named_labels, prev = 0; link;)
|
|
|
|
|
{
|
|
|
|
|
if (C_DECLARED_LABEL_FLAG (TREE_VALUE (link)))
|
|
|
|
|
{
|
|
|
|
|
if (DECL_SOURCE_LINE (TREE_VALUE (link)) == 0)
|
|
|
|
|
{
|
1993-04-13 22:56:37 +02:00
|
|
|
|
error_with_decl (TREE_VALUE (link),
|
|
|
|
|
"label `%s' used but not defined");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Avoid crashing later. */
|
|
|
|
|
define_label (input_filename, lineno,
|
|
|
|
|
DECL_NAME (TREE_VALUE (link)));
|
|
|
|
|
}
|
2000-05-17 10:15:29 +02:00
|
|
|
|
else if (warn_unused_label && !TREE_USED (TREE_VALUE (link)))
|
2000-08-11 00:01:22 +02:00
|
|
|
|
warning_with_decl (TREE_VALUE (link),
|
1992-02-13 23:21:26 +01:00
|
|
|
|
"label `%s' defined but not used");
|
|
|
|
|
IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link))) = 0;
|
|
|
|
|
|
|
|
|
|
/* Delete this element from the list. */
|
|
|
|
|
link = TREE_CHAIN (link);
|
|
|
|
|
if (prev)
|
|
|
|
|
TREE_CHAIN (prev) = link;
|
|
|
|
|
else
|
|
|
|
|
named_labels = link;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
prev = link;
|
|
|
|
|
link = TREE_CHAIN (link);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Bring back all the labels that were shadowed. */
|
|
|
|
|
for (link = shadowed_labels; link; link = TREE_CHAIN (link))
|
|
|
|
|
if (DECL_NAME (TREE_VALUE (link)) != 0)
|
|
|
|
|
IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link)))
|
|
|
|
|
= TREE_VALUE (link);
|
|
|
|
|
|
|
|
|
|
named_labels = chainon (named_labels, level->names);
|
|
|
|
|
shadowed_labels = level->shadowed;
|
|
|
|
|
|
|
|
|
|
/* Pop the current level, and free the structure for reuse. */
|
|
|
|
|
label_level_chain = label_level_chain->level_chain;
|
|
|
|
|
level->level_chain = free_binding_level;
|
|
|
|
|
free_binding_level = level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Push a definition or a declaration of struct, union or enum tag "name".
|
|
|
|
|
"type" should be the type node.
|
|
|
|
|
We assume that the tag "name" is not already defined.
|
|
|
|
|
|
|
|
|
|
Note that the definition may really be just a forward reference.
|
|
|
|
|
In that case, the TYPE_SIZE will be zero. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pushtag (name, type)
|
|
|
|
|
tree name, type;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct binding_level *b;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Find the proper binding level for this type tag. */
|
|
|
|
|
|
|
|
|
|
for (b = current_binding_level; b->tag_transparent; b = b->level_chain)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (name)
|
|
|
|
|
{
|
|
|
|
|
/* Record the identifier as the type's name if it has none. */
|
|
|
|
|
|
|
|
|
|
if (TYPE_NAME (type) == 0)
|
|
|
|
|
TYPE_NAME (type) = name;
|
|
|
|
|
}
|
|
|
|
|
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
b->tags = tree_cons (name, type, b->tags);
|
1992-03-08 23:08:20 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Create a fake NULL-named TYPE_DECL node whose TREE_TYPE will be the
|
|
|
|
|
tagged type we just added to the current binding level. This fake
|
|
|
|
|
NULL-named TYPE_DECL node helps dwarfout.c to know when it needs
|
1992-08-14 13:33:04 +02:00
|
|
|
|
to output a representation of a tagged type, and it also gives
|
1992-02-13 23:21:26 +01:00
|
|
|
|
us a convenient place to record the "scope start" address for the
|
|
|
|
|
tagged type. */
|
|
|
|
|
|
1992-07-07 00:35:53 +02:00
|
|
|
|
TYPE_STUB_DECL (type) = pushdecl (build_decl (TYPE_DECL, NULL_TREE, type));
|
1996-11-20 21:36:53 +01:00
|
|
|
|
|
|
|
|
|
/* An approximation for now, so we can tell this is a function-scope tag.
|
|
|
|
|
This will be updated in poplevel. */
|
|
|
|
|
TYPE_CONTEXT (type) = DECL_CONTEXT (TYPE_STUB_DECL (type));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle when a new declaration NEWDECL
|
|
|
|
|
has the same name as an old one OLDDECL
|
|
|
|
|
in the same binding contour.
|
|
|
|
|
Prints an error message if appropriate.
|
|
|
|
|
|
|
|
|
|
If safely possible, alter OLDDECL to look like NEWDECL, and return 1.
|
1995-11-29 19:55:34 +01:00
|
|
|
|
Otherwise, return 0.
|
|
|
|
|
|
|
|
|
|
When DIFFERENT_BINDING_LEVEL is true, NEWDECL is an external declaration,
|
|
|
|
|
and OLDDECL is in an outer binding level and should thus not be changed. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
static int
|
1995-11-29 19:55:34 +01:00
|
|
|
|
duplicate_decls (newdecl, olddecl, different_binding_level)
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree newdecl, olddecl;
|
1995-11-29 19:55:34 +01:00
|
|
|
|
int different_binding_level;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
int types_match = comptypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
|
|
|
|
|
int new_is_definition = (TREE_CODE (newdecl) == FUNCTION_DECL
|
|
|
|
|
&& DECL_INITIAL (newdecl) != 0);
|
1992-06-29 06:54:53 +02:00
|
|
|
|
tree oldtype = TREE_TYPE (olddecl);
|
|
|
|
|
tree newtype = TREE_TYPE (newdecl);
|
1999-01-27 02:43:17 +01:00
|
|
|
|
int errmsg = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* c-common.c (decl_attributes,check_format_info,truthvalue_conversion,
c_get_alias_set): Likewise.
* c-decl.c (duplicate_decls): Likewise.
* c-typeck.c (default_conversion,build_unary_op): Likewise.
* calls.c (initialize_argument_information): Likewise.
* dwarf2out.c (decl_class_context,add_abstract_origin_attribute):
Likewise.
* dwarfout.c (decl_class_context,output_type): Likewise.
* expr.c (get_inner_reference): Likewise.
* fold-const.c (simple_operand_p,fold): Likewise.
* function.c (aggregate_value_p): Likewise.
* stmt.c (expand_asm_operands): Likewise.
* varasm.c (named_section): Likewise.
* call.c (check_dtor_name,build_new_method_call): Likewise.
* decl.c (push_class_binding,poplevel,pushtag,lookup_namespace_name,
make_typename_type,check_initializer,cp_finish_decl,xref_tag): Likewise.
* decl2.c (grokfield,build_expr_from_tree,build_expr_from_tree,
decl_namespace,arg_assoc_template_arg,arg_assoc,
validate_nonmember_using_decl,do_class_using_decl): Likewise.
* error.c (dump_template_argument,dump_expr,cp_file_of,cp_line_of,
args_to_string): Likewise.
* friend.c (is_friend): Likewise.
* lex.c (note_got_semicolon,note_list_got_semicolon,is_global): Likewise.
* method.c (build_overload_nested_name,build_overload_value,
build_qualified_name,build_qualified_name,hack_identifier): Likewise.
* parse.y (typename_sub,typename_sub1): Likewise.
* pt.c (push_inline_template_parms_recursive,check_template_shadow,
process_partial_specialization,convert_template_argument,
template_args_equal,add_pending_template,lookup_template_class,
for_each_template_parm_r,maybe_fold_nontype_arg,
tsubst,instantiate_template,type_unification_real,unify,
instantiate_pending_templates,set_mangled_name_for_template_decl):
Likewise.
* repo.c (repo_get_id,repo_template_used): Likewise.
* search.c (lookup_field_1): Likewise.
* tree.c (walk_tree,get_type_decl,cp_tree_equal,member_p): Likewise.
* xref.c (classname): Likewise.
From-SVN: r32698
2000-03-23 01:41:05 +01:00
|
|
|
|
if (DECL_P (olddecl))
|
2001-10-18 20:29:02 +02:00
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (newdecl) == FUNCTION_DECL
|
|
|
|
|
&& TREE_CODE (olddecl) == FUNCTION_DECL
|
|
|
|
|
&& (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl)))
|
|
|
|
|
{
|
|
|
|
|
if (DECL_DECLARED_INLINE_P (newdecl)
|
|
|
|
|
&& DECL_UNINLINABLE (newdecl)
|
|
|
|
|
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
|
|
|
|
|
/* Already warned elsewhere. */;
|
|
|
|
|
else if (DECL_DECLARED_INLINE_P (olddecl)
|
|
|
|
|
&& DECL_UNINLINABLE (olddecl)
|
|
|
|
|
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
|
|
|
|
|
/* Already warned. */;
|
|
|
|
|
else if (DECL_DECLARED_INLINE_P (newdecl)
|
|
|
|
|
&& ! DECL_DECLARED_INLINE_P (olddecl)
|
|
|
|
|
&& DECL_UNINLINABLE (olddecl)
|
|
|
|
|
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
|
|
|
|
|
{
|
|
|
|
|
warning_with_decl (newdecl,
|
|
|
|
|
"function `%s' redeclared as inline");
|
|
|
|
|
warning_with_decl (olddecl,
|
|
|
|
|
"previous declaration of function `%s' with attribute noinline");
|
|
|
|
|
}
|
|
|
|
|
else if (DECL_DECLARED_INLINE_P (olddecl)
|
|
|
|
|
&& DECL_UNINLINABLE (newdecl)
|
|
|
|
|
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
|
|
|
|
|
{
|
|
|
|
|
warning_with_decl (newdecl,
|
|
|
|
|
"function `%s' redeclared with attribute noinline");
|
|
|
|
|
warning_with_decl (olddecl,
|
|
|
|
|
"previous declaration of function `%s' was inline");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DECL_ATTRIBUTES (newdecl)
|
|
|
|
|
= (*targetm.merge_decl_attributes) (olddecl, newdecl);
|
|
|
|
|
}
|
1995-02-21 23:56:58 +01:00
|
|
|
|
|
1992-06-29 06:54:53 +02:00
|
|
|
|
if (TREE_CODE (newtype) == ERROR_MARK
|
|
|
|
|
|| TREE_CODE (oldtype) == ERROR_MARK)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
types_match = 0;
|
|
|
|
|
|
|
|
|
|
/* New decl is completely inconsistent with the old one =>
|
|
|
|
|
tell caller to replace the old one.
|
|
|
|
|
This is always an error except in the case of shadowing a builtin. */
|
|
|
|
|
if (TREE_CODE (olddecl) != TREE_CODE (newdecl))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (olddecl) == FUNCTION_DECL
|
1993-10-08 05:59:33 +01:00
|
|
|
|
&& (DECL_BUILT_IN (olddecl)
|
|
|
|
|
|| DECL_BUILT_IN_NONANSI (olddecl)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1993-10-08 05:59:33 +01:00
|
|
|
|
/* If you declare a built-in or predefined function name as static,
|
|
|
|
|
the old definition is overridden,
|
1992-02-13 23:21:26 +01:00
|
|
|
|
but optionally warn this was a bad choice of name. */
|
|
|
|
|
if (!TREE_PUBLIC (newdecl))
|
|
|
|
|
{
|
1993-10-08 05:59:33 +01:00
|
|
|
|
if (!warn_shadow)
|
|
|
|
|
;
|
|
|
|
|
else if (DECL_BUILT_IN (olddecl))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning_with_decl (newdecl, "shadowing built-in function `%s'");
|
1993-10-08 05:59:33 +01:00
|
|
|
|
else
|
|
|
|
|
warning_with_decl (newdecl, "shadowing library function `%s'");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
/* Likewise, if the built-in is not ansi, then programs can
|
1992-03-23 03:07:53 +01:00
|
|
|
|
override it even globally without an error. */
|
1993-10-08 05:59:33 +01:00
|
|
|
|
else if (! DECL_BUILT_IN (olddecl))
|
|
|
|
|
warning_with_decl (newdecl,
|
|
|
|
|
"library function `%s' declared as non-function");
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (DECL_BUILT_IN_NONANSI (olddecl))
|
|
|
|
|
warning_with_decl (newdecl,
|
|
|
|
|
"built-in function `%s' declared as non-function");
|
|
|
|
|
else
|
|
|
|
|
warning_with_decl (newdecl,
|
2000-08-11 00:01:22 +02:00
|
|
|
|
"built-in function `%s' declared as non-function");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error_with_decl (newdecl, "`%s' redeclared as different kind of symbol");
|
|
|
|
|
error_with_decl (olddecl, "previous declaration of `%s'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For real parm decl following a forward decl,
|
|
|
|
|
return 1 so old decl will be reused. */
|
|
|
|
|
if (types_match && TREE_CODE (newdecl) == PARM_DECL
|
|
|
|
|
&& TREE_ASM_WRITTEN (olddecl) && ! TREE_ASM_WRITTEN (newdecl))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
/* The new declaration is the same kind of object as the old one.
|
|
|
|
|
The declarations may partially match. Print warnings if they don't
|
|
|
|
|
match enough. Ultimately, copy most of the information from the new
|
|
|
|
|
decl to the old one, and keep using the old one. */
|
|
|
|
|
|
|
|
|
|
if (flag_traditional && TREE_CODE (newdecl) == FUNCTION_DECL
|
|
|
|
|
&& IDENTIFIER_IMPLICIT_DECL (DECL_NAME (newdecl)) == olddecl
|
|
|
|
|
&& DECL_INITIAL (olddecl) == 0)
|
|
|
|
|
/* If -traditional, avoid error for redeclaring fcn
|
|
|
|
|
after implicit decl. */
|
|
|
|
|
;
|
|
|
|
|
else if (TREE_CODE (olddecl) == FUNCTION_DECL
|
|
|
|
|
&& DECL_BUILT_IN (olddecl))
|
|
|
|
|
{
|
1992-06-21 23:15:34 +02:00
|
|
|
|
/* A function declaration for a built-in function. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (!TREE_PUBLIC (newdecl))
|
|
|
|
|
{
|
|
|
|
|
/* If you declare a built-in function name as static, the
|
|
|
|
|
built-in definition is overridden,
|
|
|
|
|
but optionally warn this was a bad choice of name. */
|
|
|
|
|
if (warn_shadow)
|
|
|
|
|
warning_with_decl (newdecl, "shadowing built-in function `%s'");
|
|
|
|
|
/* Discard the old built-in function. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else if (!types_match)
|
1992-07-01 04:20:59 +02:00
|
|
|
|
{
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Accept the return type of the new declaration if same modes. */
|
1995-11-29 19:55:34 +01:00
|
|
|
|
tree oldreturntype = TREE_TYPE (oldtype);
|
|
|
|
|
tree newreturntype = TREE_TYPE (newtype);
|
1995-01-03 21:30:52 +01:00
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
if (TYPE_MODE (oldreturntype) == TYPE_MODE (newreturntype))
|
|
|
|
|
{
|
1992-11-25 18:33:21 +01:00
|
|
|
|
/* Function types may be shared, so we can't just modify
|
|
|
|
|
the return type of olddecl's function type. */
|
1995-11-29 19:55:34 +01:00
|
|
|
|
tree trytype
|
1992-11-25 18:33:21 +01:00
|
|
|
|
= build_function_type (newreturntype,
|
1995-11-29 19:55:34 +01:00
|
|
|
|
TYPE_ARG_TYPES (oldtype));
|
c-common.c (c_format_attribute_table): Make format and format_arg attributes apply to function types rather than to decls.
* c-common.c (c_format_attribute_table): Make format and
format_arg attributes apply to function types rather than to
decls.
(is_valid_printf_arglist): Construct an attribute list and pass
that to check_function_format rather than a name.
* c-common.h (check_function_format): Adjust prototype.
* c-decl.c (duplicate_decls): Preserve attributes from type of
built-in decl when allowing for harmless conflict in types.
* c-format.c (record_function_format,
record_international_format, function_format_list,
international_format_info, international_format_list): Remove.
(function_format_info): Remove next, name and assembler_name.
Make format_num and first_arg_num be unsigned HOST_WIDE_INT.
(decode_format_attr): New.
(handle_format_attribute): Handle receiving a type rather than a
decl. Call decode_format_attr. Store format information in a
function_format_info.
(handle_format_arg_attribute): Correct comment. Handle receiving
a type rather than a decl. Use unsigned HOST_WIDE_INT for
arg_num.
(check_format_info_recurse, check_format_info_main): Take argument
numbers as unsigned HOST_WIDE_INT.
(check_function_format): Take a list of attributes from the
function type rather than a name or assembler name. Check for
format attributes in that list and the attributes on the type of
the current function rather than looking through
function_format_list.
(check_format_info): Use unsigned HOST_WIDE_INT for argument
numbers.
(check_format_info_recurse): Take format_arg attributes from the
type of the function calls rather than using
international_format_list. Allow for multiple format_arg
attributes.
* c-typeck.c (build_function_call): Pass type attributes to
check_function_format rather than name or assembler name. Don't
require there to be a name or assembler name to check formats.
cp:
* call.c (build_over_call), typeck.c (build_function_call_real):
Pass type attributes to check_function_format rather than name or
assembler name. Don't require there to be a name or assembler
name to check formats.
testsuite:
* g++.dg/warn/format2.C, gcc.dg/format/attr-7.c,
gcc.dg/format/multattr-1.c, gcc.dg/format/multattr-2.c,
gcc.dg/format/multattr-3.c: New tests.
* gcc.dg/format/attr-3.c: Update expected error texts. Remove
tests for format attributes on function pointers being rejected.
From-SVN: r45945
2001-10-02 09:19:47 +02:00
|
|
|
|
trytype = build_type_attribute_variant (trytype,
|
|
|
|
|
TYPE_ATTRIBUTES (oldtype));
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1995-11-29 19:55:34 +01:00
|
|
|
|
types_match = comptypes (newtype, trytype);
|
1993-02-10 09:30:25 +01:00
|
|
|
|
if (types_match)
|
1995-11-29 19:55:34 +01:00
|
|
|
|
oldtype = trytype;
|
1993-02-10 09:30:25 +01:00
|
|
|
|
}
|
|
|
|
|
/* Accept harmless mismatch in first argument type also.
|
2001-01-08 00:15:47 +01:00
|
|
|
|
This is for the ffs and fprintf builtins. */
|
1993-02-10 09:30:25 +01:00
|
|
|
|
if (TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != 0
|
1995-11-29 19:55:34 +01:00
|
|
|
|
&& TYPE_ARG_TYPES (oldtype) != 0
|
|
|
|
|
&& TREE_VALUE (TYPE_ARG_TYPES (newtype)) != 0
|
|
|
|
|
&& TREE_VALUE (TYPE_ARG_TYPES (oldtype)) != 0
|
|
|
|
|
&& (TYPE_MODE (TREE_VALUE (TYPE_ARG_TYPES (newtype)))
|
|
|
|
|
== TYPE_MODE (TREE_VALUE (TYPE_ARG_TYPES (oldtype)))))
|
1993-02-10 09:30:25 +01:00
|
|
|
|
{
|
|
|
|
|
/* Function types may be shared, so we can't just modify
|
|
|
|
|
the return type of olddecl's function type. */
|
1995-11-29 19:55:34 +01:00
|
|
|
|
tree trytype
|
|
|
|
|
= build_function_type (TREE_TYPE (oldtype),
|
2000-08-11 00:01:22 +02:00
|
|
|
|
tree_cons (NULL_TREE,
|
1995-11-29 19:55:34 +01:00
|
|
|
|
TREE_VALUE (TYPE_ARG_TYPES (newtype)),
|
|
|
|
|
TREE_CHAIN (TYPE_ARG_TYPES (oldtype))));
|
c-common.c (c_format_attribute_table): Make format and format_arg attributes apply to function types rather than to decls.
* c-common.c (c_format_attribute_table): Make format and
format_arg attributes apply to function types rather than to
decls.
(is_valid_printf_arglist): Construct an attribute list and pass
that to check_function_format rather than a name.
* c-common.h (check_function_format): Adjust prototype.
* c-decl.c (duplicate_decls): Preserve attributes from type of
built-in decl when allowing for harmless conflict in types.
* c-format.c (record_function_format,
record_international_format, function_format_list,
international_format_info, international_format_list): Remove.
(function_format_info): Remove next, name and assembler_name.
Make format_num and first_arg_num be unsigned HOST_WIDE_INT.
(decode_format_attr): New.
(handle_format_attribute): Handle receiving a type rather than a
decl. Call decode_format_attr. Store format information in a
function_format_info.
(handle_format_arg_attribute): Correct comment. Handle receiving
a type rather than a decl. Use unsigned HOST_WIDE_INT for
arg_num.
(check_format_info_recurse, check_format_info_main): Take argument
numbers as unsigned HOST_WIDE_INT.
(check_function_format): Take a list of attributes from the
function type rather than a name or assembler name. Check for
format attributes in that list and the attributes on the type of
the current function rather than looking through
function_format_list.
(check_format_info): Use unsigned HOST_WIDE_INT for argument
numbers.
(check_format_info_recurse): Take format_arg attributes from the
type of the function calls rather than using
international_format_list. Allow for multiple format_arg
attributes.
* c-typeck.c (build_function_call): Pass type attributes to
check_function_format rather than name or assembler name. Don't
require there to be a name or assembler name to check formats.
cp:
* call.c (build_over_call), typeck.c (build_function_call_real):
Pass type attributes to check_function_format rather than name or
assembler name. Don't require there to be a name or assembler
name to check formats.
testsuite:
* g++.dg/warn/format2.C, gcc.dg/format/attr-7.c,
gcc.dg/format/multattr-1.c, gcc.dg/format/multattr-2.c,
gcc.dg/format/multattr-3.c: New tests.
* gcc.dg/format/attr-3.c: Update expected error texts. Remove
tests for format attributes on function pointers being rejected.
From-SVN: r45945
2001-10-02 09:19:47 +02:00
|
|
|
|
trytype = build_type_attribute_variant (trytype,
|
|
|
|
|
TYPE_ATTRIBUTES (oldtype));
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
|
|
|
|
types_match = comptypes (newtype, trytype);
|
1992-11-25 18:33:21 +01:00
|
|
|
|
if (types_match)
|
1995-11-29 19:55:34 +01:00
|
|
|
|
oldtype = trytype;
|
1992-07-01 04:20:59 +02:00
|
|
|
|
}
|
1995-11-29 19:55:34 +01:00
|
|
|
|
if (! different_binding_level)
|
|
|
|
|
TREE_TYPE (olddecl) = oldtype;
|
1992-07-01 04:20:59 +02:00
|
|
|
|
}
|
|
|
|
|
if (!types_match)
|
1992-06-21 23:18:59 +02:00
|
|
|
|
{
|
|
|
|
|
/* If types don't match for a built-in, throw away the built-in. */
|
|
|
|
|
warning_with_decl (newdecl, "conflicting types for built-in function `%s'");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (olddecl) == FUNCTION_DECL
|
1992-06-21 23:15:34 +02:00
|
|
|
|
&& DECL_SOURCE_LINE (olddecl) == 0)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1992-06-21 23:15:34 +02:00
|
|
|
|
/* A function declaration for a predeclared function
|
|
|
|
|
that isn't actually built in. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (!TREE_PUBLIC (newdecl))
|
|
|
|
|
{
|
1992-08-14 13:33:04 +02:00
|
|
|
|
/* If you declare it as static, the
|
1992-06-21 23:15:34 +02:00
|
|
|
|
default definition is overridden. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else if (!types_match)
|
1992-06-21 23:15:34 +02:00
|
|
|
|
{
|
1992-06-22 03:35:52 +02:00
|
|
|
|
/* If the types don't match, preserve volatility indication.
|
|
|
|
|
Later on, we will discard everything else about the
|
|
|
|
|
default declaration. */
|
1992-06-21 23:15:34 +02:00
|
|
|
|
TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
1992-07-07 04:11:08 +02:00
|
|
|
|
/* Permit char *foo () to match void *foo (...) if not pedantic,
|
|
|
|
|
if one of them came from a system header file. */
|
1992-06-29 06:26:19 +02:00
|
|
|
|
else if (!types_match
|
|
|
|
|
&& TREE_CODE (olddecl) == FUNCTION_DECL
|
|
|
|
|
&& TREE_CODE (newdecl) == FUNCTION_DECL
|
1992-06-29 06:54:53 +02:00
|
|
|
|
&& TREE_CODE (TREE_TYPE (oldtype)) == POINTER_TYPE
|
|
|
|
|
&& TREE_CODE (TREE_TYPE (newtype)) == POINTER_TYPE
|
1992-07-07 04:11:08 +02:00
|
|
|
|
&& (DECL_IN_SYSTEM_HEADER (olddecl)
|
|
|
|
|
|| DECL_IN_SYSTEM_HEADER (newdecl))
|
1992-07-25 01:52:30 +02:00
|
|
|
|
&& ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (newtype))) == void_type_node
|
1992-06-29 06:54:53 +02:00
|
|
|
|
&& TYPE_ARG_TYPES (oldtype) == 0
|
|
|
|
|
&& self_promoting_args_p (TYPE_ARG_TYPES (newtype))
|
|
|
|
|
&& TREE_TYPE (TREE_TYPE (oldtype)) == char_type_node)
|
1992-06-29 06:26:19 +02:00
|
|
|
|
||
|
1992-06-29 06:54:53 +02:00
|
|
|
|
(TREE_TYPE (TREE_TYPE (newtype)) == char_type_node
|
|
|
|
|
&& TYPE_ARG_TYPES (newtype) == 0
|
|
|
|
|
&& self_promoting_args_p (TYPE_ARG_TYPES (oldtype))
|
1992-07-25 01:52:30 +02:00
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (oldtype))) == void_type_node)))
|
1992-06-29 06:26:19 +02:00
|
|
|
|
{
|
|
|
|
|
if (pedantic)
|
|
|
|
|
pedwarn_with_decl (newdecl, "conflicting types for `%s'");
|
1992-06-29 06:54:53 +02:00
|
|
|
|
/* Make sure we keep void * as ret type, not char *. */
|
1992-07-25 01:52:30 +02:00
|
|
|
|
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (oldtype))) == void_type_node)
|
1992-06-29 06:54:53 +02:00
|
|
|
|
TREE_TYPE (newdecl) = newtype = oldtype;
|
1994-07-03 01:09:49 +02:00
|
|
|
|
|
|
|
|
|
/* Set DECL_IN_SYSTEM_HEADER, so that if we see another declaration
|
|
|
|
|
we will come back here again. */
|
|
|
|
|
DECL_IN_SYSTEM_HEADER (newdecl) = 1;
|
1992-06-29 06:26:19 +02:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (!types_match
|
|
|
|
|
/* Permit char *foo (int, ...); followed by char *foo ();
|
|
|
|
|
if not pedantic. */
|
|
|
|
|
&& ! (TREE_CODE (olddecl) == FUNCTION_DECL
|
|
|
|
|
&& ! pedantic
|
|
|
|
|
/* Return types must still match. */
|
1992-06-29 06:54:53 +02:00
|
|
|
|
&& comptypes (TREE_TYPE (oldtype),
|
|
|
|
|
TREE_TYPE (newtype))
|
|
|
|
|
&& TYPE_ARG_TYPES (newtype) == 0))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error_with_decl (newdecl, "conflicting types for `%s'");
|
|
|
|
|
/* Check for function type mismatch
|
|
|
|
|
involving an empty arglist vs a nonempty one. */
|
|
|
|
|
if (TREE_CODE (olddecl) == FUNCTION_DECL
|
1992-06-29 06:54:53 +02:00
|
|
|
|
&& comptypes (TREE_TYPE (oldtype),
|
|
|
|
|
TREE_TYPE (newtype))
|
|
|
|
|
&& ((TYPE_ARG_TYPES (oldtype) == 0
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& DECL_INITIAL (olddecl) == 0)
|
|
|
|
|
||
|
1992-06-29 06:54:53 +02:00
|
|
|
|
(TYPE_ARG_TYPES (newtype) == 0
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& DECL_INITIAL (newdecl) == 0)))
|
|
|
|
|
{
|
|
|
|
|
/* Classify the problem further. */
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree t = TYPE_ARG_TYPES (oldtype);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (t == 0)
|
1992-06-29 06:54:53 +02:00
|
|
|
|
t = TYPE_ARG_TYPES (newtype);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
for (; t; t = TREE_CHAIN (t))
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree type = TREE_VALUE (t);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1992-07-25 01:52:30 +02:00
|
|
|
|
if (TREE_CHAIN (t) == 0
|
|
|
|
|
&& TYPE_MAIN_VARIANT (type) != void_type_node)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
capital from diagnostics.
* c-lex.c (cb_file_change): Similarly.
* c-parse.in : Similarly.
* cfgrtl.c (verify_flow_info): Similarly.
* collect2.c: Similarly.
* cppfiles.c (find_include_file): Similarly.
* cppinit.c (cpp_handle_option): Similarly.
* cpplex.c (cpp_spell_token): Similarly.
* cppmain.c (do_preprocessing): Similarly.
* gcc.c (translate_options, process_command, do_spec1,
main, pfatal_execute): Similarly.
* genattr.c (main): Similarly.
* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
write_test_expr, main): Similarly.
* gencodes.c (main): Similarly.
* genconfig.c (main): Similarly.
* genconstants.c (main): Similarly.
* genemit.c (main): Similarly.
* genextract.c (main): Similarly.
* genflags.c (main): Similarly.
* genopinit.c (main): Similarly.
* genoutput.c (process_template, main): Similarly.
* genpeep.c (main): Similarly.
* genrecog.c (main): Similarly.
* gensupport.c (is_predicable, identify_predicable_attribute,
alter_predicate_for_insn, init_md_reader_args, main): Similarly.
* ggc-page.c (alloc_anon): Similarly.
* mips-tfile.c (add_string, add_procedure, add_file, read_line,
parse_begin, parse_bend, parse_def, parse_end, parse_file,
parse_stabs_common, parse_stabs, write_varray, write_object,
read_seek, copy_object, main, error): Similarly.
* profile.c (compute_branch_probabilities): Similarly.
* reg-stack.c (check_asm_stack_operands): Similarly.
* reload.c (find_reloads): Similarly.
* reload1.c (spill_failure, failed_reload): Similarly.
* rtl-error.c (_fatal_insn_not_found): Similarly.
* toplev.c (read_integral_parameter, crash_signal,
decode_f_option, set_target_switch, parse_options_and_default_flags)
: Similarly.
* tradcif.y (parse_number, yylex): Similarly.
* tradcpp.c (main, fancy_abort): Similarly.
* tree.c (tree_check_failed): Similarly.
* varray.c (varray_check_failed): Similarly.
* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
* call.c (build_java_interface_fn_ref): Similarly.
* except.c (is_admissible_throw_operand): Similarly.
* init.c (build_java_class_ref): Similarly.
* xref.c (open_xref_file): Similarly.
objc:
* objc-act.c (get_object_ref, lookup_and_install_protocols,
build_objc_string_object, objc_declare_alias, build_ivar_chain,
finish_message_expr, build_protocol_expr, is_public,
start_class): Similarly.
testsuite:
* objc.dg/alias.m: Update.
* objc.dg/class-1.m: Update.
* objc.dg/const-str-1.m: Update.
* objc.dg/fwd-proto-1.m: Update.
* objc.dg/id-1.m: Update.
* objc.dg/super-class-1.m: Update.
From-SVN: r47518
2001-12-02 01:04:36 +01:00
|
|
|
|
error ("a parameter list with an ellipsis can't match an empty parameter name list declaration");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-08 06:51:16 +02:00
|
|
|
|
if (simple_type_promotes_to (type) != NULL_TREE)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
capital from diagnostics.
* c-lex.c (cb_file_change): Similarly.
* c-parse.in : Similarly.
* cfgrtl.c (verify_flow_info): Similarly.
* collect2.c: Similarly.
* cppfiles.c (find_include_file): Similarly.
* cppinit.c (cpp_handle_option): Similarly.
* cpplex.c (cpp_spell_token): Similarly.
* cppmain.c (do_preprocessing): Similarly.
* gcc.c (translate_options, process_command, do_spec1,
main, pfatal_execute): Similarly.
* genattr.c (main): Similarly.
* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
write_test_expr, main): Similarly.
* gencodes.c (main): Similarly.
* genconfig.c (main): Similarly.
* genconstants.c (main): Similarly.
* genemit.c (main): Similarly.
* genextract.c (main): Similarly.
* genflags.c (main): Similarly.
* genopinit.c (main): Similarly.
* genoutput.c (process_template, main): Similarly.
* genpeep.c (main): Similarly.
* genrecog.c (main): Similarly.
* gensupport.c (is_predicable, identify_predicable_attribute,
alter_predicate_for_insn, init_md_reader_args, main): Similarly.
* ggc-page.c (alloc_anon): Similarly.
* mips-tfile.c (add_string, add_procedure, add_file, read_line,
parse_begin, parse_bend, parse_def, parse_end, parse_file,
parse_stabs_common, parse_stabs, write_varray, write_object,
read_seek, copy_object, main, error): Similarly.
* profile.c (compute_branch_probabilities): Similarly.
* reg-stack.c (check_asm_stack_operands): Similarly.
* reload.c (find_reloads): Similarly.
* reload1.c (spill_failure, failed_reload): Similarly.
* rtl-error.c (_fatal_insn_not_found): Similarly.
* toplev.c (read_integral_parameter, crash_signal,
decode_f_option, set_target_switch, parse_options_and_default_flags)
: Similarly.
* tradcif.y (parse_number, yylex): Similarly.
* tradcpp.c (main, fancy_abort): Similarly.
* tree.c (tree_check_failed): Similarly.
* varray.c (varray_check_failed): Similarly.
* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
* call.c (build_java_interface_fn_ref): Similarly.
* except.c (is_admissible_throw_operand): Similarly.
* init.c (build_java_class_ref): Similarly.
* xref.c (open_xref_file): Similarly.
objc:
* objc-act.c (get_object_ref, lookup_and_install_protocols,
build_objc_string_object, objc_declare_alias, build_ivar_chain,
finish_message_expr, build_protocol_expr, is_public,
start_class): Similarly.
testsuite:
* objc.dg/alias.m: Update.
* objc.dg/class-1.m: Update.
* objc.dg/const-str-1.m: Update.
* objc.dg/fwd-proto-1.m: Update.
* objc.dg/id-1.m: Update.
* objc.dg/super-class-1.m: Update.
From-SVN: r47518
2001-12-02 01:04:36 +01:00
|
|
|
|
error ("an argument type that has a default promotion can't match an empty parameter name list declaration");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
error_with_decl (olddecl, "previous declaration of `%s'");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1994-08-12 13:52:04 +02:00
|
|
|
|
errmsg = redeclaration_error_message (newdecl, olddecl);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (errmsg)
|
|
|
|
|
{
|
1999-01-27 02:43:17 +01:00
|
|
|
|
switch (errmsg)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
error_with_decl (newdecl, "redefinition of `%s'");
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
error_with_decl (newdecl, "redeclaration of `%s'");
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
error_with_decl (newdecl, "conflicting declarations of `%s'");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
error_with_decl (olddecl,
|
1992-09-12 01:22:07 +02:00
|
|
|
|
((DECL_INITIAL (olddecl)
|
|
|
|
|
&& current_binding_level == global_binding_level)
|
|
|
|
|
? "`%s' previously defined here"
|
|
|
|
|
: "`%s' previously declared here"));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
1995-02-21 23:56:58 +01:00
|
|
|
|
else if (TREE_CODE (newdecl) == TYPE_DECL
|
2000-08-11 00:01:22 +02:00
|
|
|
|
&& (DECL_IN_SYSTEM_HEADER (olddecl)
|
1995-02-21 23:56:58 +01:00
|
|
|
|
|| DECL_IN_SYSTEM_HEADER (newdecl)))
|
|
|
|
|
{
|
|
|
|
|
warning_with_decl (newdecl, "redefinition of `%s'");
|
2000-08-11 00:01:22 +02:00
|
|
|
|
warning_with_decl
|
1995-02-21 23:56:58 +01:00
|
|
|
|
(olddecl,
|
|
|
|
|
((DECL_INITIAL (olddecl)
|
|
|
|
|
&& current_binding_level == global_binding_level)
|
|
|
|
|
? "`%s' previously defined here"
|
|
|
|
|
: "`%s' previously declared here"));
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (TREE_CODE (olddecl) == FUNCTION_DECL
|
|
|
|
|
&& DECL_INITIAL (olddecl) != 0
|
1992-06-29 06:54:53 +02:00
|
|
|
|
&& TYPE_ARG_TYPES (oldtype) == 0
|
1995-04-25 19:30:35 +02:00
|
|
|
|
&& TYPE_ARG_TYPES (newtype) != 0
|
|
|
|
|
&& TYPE_ACTUAL_ARG_TYPES (oldtype) != 0)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree type, parm;
|
|
|
|
|
int nargs;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Prototype decl follows defn w/o prototype. */
|
|
|
|
|
|
1992-06-29 06:54:53 +02:00
|
|
|
|
for (parm = TYPE_ACTUAL_ARG_TYPES (oldtype),
|
|
|
|
|
type = TYPE_ARG_TYPES (newtype),
|
1992-02-13 23:21:26 +01:00
|
|
|
|
nargs = 1;
|
1999-01-27 02:43:17 +01:00
|
|
|
|
;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
parm = TREE_CHAIN (parm), type = TREE_CHAIN (type), nargs++)
|
|
|
|
|
{
|
1999-01-27 02:43:17 +01:00
|
|
|
|
if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node
|
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
|
|
|
|
|
{
|
|
|
|
|
warning_with_decl (newdecl, "prototype for `%s' follows");
|
|
|
|
|
warning_with_decl (olddecl, "non-prototype definition here");
|
|
|
|
|
break;
|
|
|
|
|
}
|
1992-07-25 01:52:30 +02:00
|
|
|
|
if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node
|
|
|
|
|
|| TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-08-11 00:01:22 +02:00
|
|
|
|
error_with_decl (newdecl,
|
|
|
|
|
"prototype for `%s' follows and number of arguments doesn't match");
|
1999-01-27 02:43:17 +01:00
|
|
|
|
error_with_decl (olddecl, "non-prototype definition here");
|
|
|
|
|
errmsg = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* Type for passing arg must be consistent
|
|
|
|
|
with that declared for the arg. */
|
|
|
|
|
if (! comptypes (TREE_VALUE (parm), TREE_VALUE (type))
|
|
|
|
|
/* If -traditional, allow `unsigned int' instead of `int'
|
|
|
|
|
in the prototype. */
|
|
|
|
|
&& (! (flag_traditional
|
1992-07-15 20:34:18 +02:00
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == integer_type_node
|
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_VALUE (type)) == unsigned_type_node)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1999-01-27 02:43:17 +01:00
|
|
|
|
error_with_decl (newdecl,
|
|
|
|
|
"prototype for `%s' follows and argument %d doesn't match",
|
|
|
|
|
nargs);
|
|
|
|
|
error_with_decl (olddecl, "non-prototype definition here");
|
|
|
|
|
errmsg = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-05-15 04:18:01 +02:00
|
|
|
|
/* Warn about mismatches in various flags. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
1992-05-15 04:18:01 +02:00
|
|
|
|
/* Warn if function is now inline
|
|
|
|
|
but was previously declared not inline and has been called. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (TREE_CODE (olddecl) == FUNCTION_DECL
|
2001-10-08 18:37:06 +02:00
|
|
|
|
&& ! DECL_DECLARED_INLINE_P (olddecl)
|
|
|
|
|
&& DECL_DECLARED_INLINE_P (newdecl)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TREE_USED (olddecl))
|
|
|
|
|
warning_with_decl (newdecl,
|
|
|
|
|
"`%s' declared inline after being called");
|
|
|
|
|
if (TREE_CODE (olddecl) == FUNCTION_DECL
|
2001-10-08 18:37:06 +02:00
|
|
|
|
&& ! DECL_DECLARED_INLINE_P (olddecl)
|
|
|
|
|
&& DECL_DECLARED_INLINE_P (newdecl)
|
1992-07-05 23:12:43 +02:00
|
|
|
|
&& DECL_INITIAL (olddecl) != 0)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning_with_decl (newdecl,
|
1992-07-05 23:12:43 +02:00
|
|
|
|
"`%s' declared inline after its definition");
|
1994-03-21 23:07:03 +01:00
|
|
|
|
|
|
|
|
|
/* If pedantic, warn when static declaration follows a non-static
|
|
|
|
|
declaration. Otherwise, do so only for functions. */
|
|
|
|
|
if ((pedantic || TREE_CODE (olddecl) == FUNCTION_DECL)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TREE_PUBLIC (olddecl)
|
|
|
|
|
&& !TREE_PUBLIC (newdecl))
|
|
|
|
|
warning_with_decl (newdecl, "static declaration for `%s' follows non-static");
|
|
|
|
|
|
1999-01-16 17:43:26 +01:00
|
|
|
|
/* If warn_traditional, warn when a non-static function
|
2000-08-11 00:01:22 +02:00
|
|
|
|
declaration follows a static one. */
|
2000-08-21 16:54:28 +02:00
|
|
|
|
if (warn_traditional && !in_system_header
|
1999-01-16 17:43:26 +01:00
|
|
|
|
&& TREE_CODE (olddecl) == FUNCTION_DECL
|
|
|
|
|
&& !TREE_PUBLIC (olddecl)
|
|
|
|
|
&& TREE_PUBLIC (newdecl))
|
|
|
|
|
warning_with_decl (newdecl, "non-static declaration for `%s' follows static");
|
|
|
|
|
|
1994-04-18 23:56:01 +02:00
|
|
|
|
/* Warn when const declaration follows a non-const
|
|
|
|
|
declaration, but not for functions. */
|
|
|
|
|
if (TREE_CODE (olddecl) != FUNCTION_DECL
|
|
|
|
|
&& !TREE_READONLY (olddecl)
|
|
|
|
|
&& TREE_READONLY (newdecl))
|
|
|
|
|
warning_with_decl (newdecl, "const declaration for `%s' follows non-const");
|
1992-05-15 04:18:01 +02:00
|
|
|
|
/* These bits are logically part of the type, for variables.
|
|
|
|
|
But not for functions
|
|
|
|
|
(where qualifiers are not valid ANSI anyway). */
|
1994-04-18 23:56:01 +02:00
|
|
|
|
else if (pedantic && TREE_CODE (olddecl) != FUNCTION_DECL
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& (TREE_READONLY (newdecl) != TREE_READONLY (olddecl)
|
|
|
|
|
|| TREE_THIS_VOLATILE (newdecl) != TREE_THIS_VOLATILE (olddecl)))
|
|
|
|
|
pedwarn_with_decl (newdecl, "type qualifiers for `%s' conflict with previous decl");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1992-07-31 08:14:04 +02:00
|
|
|
|
/* Optionally warn about more than one declaration for the same name. */
|
1994-08-12 15:10:54 +02:00
|
|
|
|
if (errmsg == 0 && warn_redundant_decls && DECL_SOURCE_LINE (olddecl) != 0
|
1997-12-07 01:31:01 +01:00
|
|
|
|
/* Don't warn about a function declaration
|
1992-07-31 08:14:04 +02:00
|
|
|
|
followed by a definition. */
|
|
|
|
|
&& !(TREE_CODE (newdecl) == FUNCTION_DECL && DECL_INITIAL (newdecl) != 0
|
1993-07-06 08:12:49 +02:00
|
|
|
|
&& DECL_INITIAL (olddecl) == 0)
|
|
|
|
|
/* Don't warn about extern decl followed by (tentative) definition. */
|
|
|
|
|
&& !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl)))
|
1992-07-31 08:14:04 +02:00
|
|
|
|
{
|
|
|
|
|
warning_with_decl (newdecl, "redundant redeclaration of `%s' in same scope");
|
|
|
|
|
warning_with_decl (olddecl, "previous declaration of `%s'");
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Copy all the DECL_... slots specified in the new decl
|
1992-06-29 06:54:53 +02:00
|
|
|
|
except for any that we copy here from the old type.
|
|
|
|
|
|
|
|
|
|
Past this point, we don't change OLDTYPE and NEWTYPE
|
|
|
|
|
even if we change the types of NEWDECL and OLDDECL. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (types_match)
|
|
|
|
|
{
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* When copying info to olddecl, we store into write_olddecl
|
|
|
|
|
instead. This allows us to avoid modifying olddecl when
|
|
|
|
|
different_binding_level is true. */
|
|
|
|
|
tree write_olddecl = different_binding_level ? newdecl : olddecl;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Merge the data types specified in the two decls. */
|
|
|
|
|
if (TREE_CODE (newdecl) != FUNCTION_DECL || !DECL_BUILT_IN (olddecl))
|
1995-11-29 19:55:34 +01:00
|
|
|
|
{
|
|
|
|
|
if (different_binding_level)
|
2001-01-25 03:03:14 +01:00
|
|
|
|
{
|
|
|
|
|
if (TYPE_ARG_TYPES (oldtype) != 0
|
|
|
|
|
&& TYPE_ARG_TYPES (newtype) == 0)
|
|
|
|
|
TREE_TYPE (newdecl) = common_type (newtype, oldtype);
|
|
|
|
|
else
|
|
|
|
|
TREE_TYPE (newdecl)
|
|
|
|
|
= build_type_attribute_variant
|
|
|
|
|
(newtype,
|
|
|
|
|
merge_attributes (TYPE_ATTRIBUTES (newtype),
|
|
|
|
|
TYPE_ATTRIBUTES (oldtype)));
|
|
|
|
|
}
|
1995-11-29 19:55:34 +01:00
|
|
|
|
else
|
|
|
|
|
TREE_TYPE (newdecl)
|
|
|
|
|
= TREE_TYPE (olddecl)
|
|
|
|
|
= common_type (newtype, oldtype);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Lay the type out, unless already done. */
|
|
|
|
|
if (oldtype != TREE_TYPE (newdecl))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_TYPE (newdecl) != error_mark_node)
|
|
|
|
|
layout_type (TREE_TYPE (newdecl));
|
|
|
|
|
if (TREE_CODE (newdecl) != FUNCTION_DECL
|
|
|
|
|
&& TREE_CODE (newdecl) != TYPE_DECL
|
|
|
|
|
&& TREE_CODE (newdecl) != CONST_DECL)
|
|
|
|
|
layout_decl (newdecl, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Since the type is OLDDECL's, make OLDDECL's size go with. */
|
|
|
|
|
DECL_SIZE (newdecl) = DECL_SIZE (olddecl);
|
c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-decl.c (duplicate_decls, finish_enum): Likewise.
(finish_decl): Remove -Wlarger-than code from here.
* flags.h (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
Clean up checking to see if in table.
(make_bit_field_ref): Remove extra parm to bitsize_int.
* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
and for computing size of decl.
* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
Move -Wlarger-than code to here.
(layout_record): Remove extra arg to bitsize_int.
Set TYPE_BINFO_SIZE_UNIT.
(layout_union): Remove extra arg to bitsize_int.
Use proper type for size of QUAL_UNION.
(layout_type): Remove extra arg to bitsize_int.
* toplev.c (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
(decode_W_option): Clean up id-clash and larger-than- cases.
* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
(struct tree_decl): New field size_unit.
(size_int_wide): No HIGH operand; NUMBER is now signed.
(size_int_2): Deleted.
(size_int, bitsize_int): Don't use it and rework args.
* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
* ch/satisfy.c (safe_satisfy_decl): Likewise.
* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
(avoid_overlap, build_base_field): Likewise.
(build_base_field, build_base_fields, is_empty_class):
Test DECL_SIZE with integer_zero.
(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
* cp/cp-tree.h (struct lang_type): New field size_unit.
(CLASSTYPE_SIZE_UNIT): New macro.
* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
(cp_finish_decl): Delete -Wlarger-than processing.
* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
* cp/tree.c (make_binfo): binfo vector is one entry longer.
(walk_tree): Walk DECL_SIZE_UNIT.
* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
(duplicate_decls): Likewise.
(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
(finish_decl): Delete -Wlarger-than processing.
* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
* java/constants.c (build_constants_constructor): Likewise.
From-SVN: r32068
2000-02-20 02:11:00 +01:00
|
|
|
|
DECL_SIZE_UNIT (newdecl) = DECL_SIZE_UNIT (olddecl);
|
1999-11-03 19:11:23 +01:00
|
|
|
|
DECL_MODE (newdecl) = DECL_MODE (olddecl);
|
1992-04-04 10:50:38 +02:00
|
|
|
|
if (TREE_CODE (olddecl) != FUNCTION_DECL)
|
|
|
|
|
if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl))
|
2000-06-14 07:30:09 +02:00
|
|
|
|
{
|
|
|
|
|
DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl);
|
|
|
|
|
DECL_USER_ALIGN (newdecl) |= DECL_ALIGN (olddecl);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-07-28 04:20:22 +02:00
|
|
|
|
/* Keep the old rtl since we can safely use it. */
|
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME...
* varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the
contents of the RTL, to determine the name of the object.
* tree.h (DECL_RTL): Allocate RTL lazily.
(SET_DECL_RTL): New macro.
(DECL_RTL_SET_P): Likewise.
(COPY_DECL_RTL): Likewise.
(DECL_RTL_IF_SET): Likewise.
* varasm.c (make_decl_rtl): Add assertions about the kind of
declaration we are processing.
* c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
(start_decl): Likewise.
(finish_decl): Likewise.
* c-semantics.c (emit_local_var): Likewise.
* calls.c (expand_call): Likewise.
* dbxout.c (dbxout_symbol): Likewise.
* emit-rtl.c (unshare_all_rtl): Likewise.
(unshare_all_decls): Likewise.
(reset_used_decls): Likewise.
* expr.c (store_constructor): Likewise.
(safe_from_p): Likewise.
(expand_expr): Likewise.
* function.c (put_var_into_stack): Likewise.
(instantiate_decls_1): Likewise.
(assign_parms): Likewise.
(expand_function_start): Likewise.
(expand_function_end): Likewise.
* ggc-common.c (gcc_mark_trees): Likewise.
* integrate.c (function_cannot_inline_p): Likewise.
(copy_decl_for_inlining): Likewise.
(expand_inline_function): Likewise.
(integrate_parm_decls): Likewise.
(integrate_decl_tree): Likewise.
* print-tree.c (print_node): Likewise.
* reg-stack.c (stack_result): Likewise.
* stmt.c (label_rtx): Likewise.
(expand_return): Likewise.
(expand_decl): Likewise.
(expand_decl_cleanup): Likewise.
(expand_anon_union_decl): Likewise.
* toplev.c (check_global_declarations): Likewise.
(rest_of_decl_compilation): Likewise.
* tree.c (simple_cst_equal): Likewise.
* objc/objc-act.c (generate_static_references): Likewise.
* class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* cp-tree.h (DECL_IN_MEMORY_P): Likewise.
* decl.c (duplicate_decls): Likewise.
(builtin_function): Likewise.
(build_library_fn): Likewise.
(build_cp_library_fn): Likewise.
(check_initializer): Likewise.
(cp_finish_decl): Likewise.
* decl2.c (grokfield): Likewise.
(grok_function_init): Remove #if 0'd code.
(finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* friend.c (do_friend): Likewise.
* init.c (get_temp_regvar): Likewise.
* method.c (make_thunk): Likewise.
* pt.c (tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Likewise.
* semantics.c (genrtl_named_return_value): Likewise.
(expand_body): Likewise.
(genrtl_finish_function): Likewise.
* tree.c (cp_tree_equal): Likewise.
* com.c (ffecom_member_phase_2): Use COPY_DECL_RTL,
DECL_RTL_SET_P, etc.
(duplicate_decls): Likewise.
(start_decl): Likewise.
* class.c (build_static_field_ref): Likewise.
(make_method_value): Likewise.
(get_dispatch_table): Likewise.
* decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
From-SVN: r40482
2001-03-15 03:51:03 +01:00
|
|
|
|
COPY_DECL_RTL (olddecl, newdecl);
|
1992-07-28 04:20:22 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Merge the type qualifiers. */
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
if (TREE_CODE (olddecl) == FUNCTION_DECL
|
|
|
|
|
&& DECL_BUILT_IN_NONANSI (olddecl) && TREE_THIS_VOLATILE (olddecl)
|
|
|
|
|
&& ! TREE_THIS_VOLATILE (newdecl))
|
1995-11-29 19:55:34 +01:00
|
|
|
|
TREE_THIS_VOLATILE (write_olddecl) = 0;
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (TREE_READONLY (newdecl))
|
1995-11-29 19:55:34 +01:00
|
|
|
|
TREE_READONLY (write_olddecl) = 1;
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (TREE_THIS_VOLATILE (newdecl))
|
1992-07-07 03:47:54 +02:00
|
|
|
|
{
|
1995-11-29 19:55:34 +01:00
|
|
|
|
TREE_THIS_VOLATILE (write_olddecl) = 1;
|
2000-07-18 19:53:35 +02:00
|
|
|
|
if (TREE_CODE (newdecl) == VAR_DECL
|
|
|
|
|
/* If an automatic variable is re-declared in the same
|
|
|
|
|
function scope, but the old declaration was not
|
|
|
|
|
volatile, make_var_volatile() would crash because the
|
|
|
|
|
variable would have been assigned to a pseudo, not a
|
|
|
|
|
MEM. Since this duplicate declaration is invalid
|
|
|
|
|
anyway, we just skip the call. */
|
|
|
|
|
&& errmsg == 0)
|
1992-07-07 03:47:54 +02:00
|
|
|
|
make_var_volatile (newdecl);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* Keep source location of definition rather than declaration. */
|
|
|
|
|
/* When called with different_binding_level set, keep the old
|
|
|
|
|
information so that meaningful diagnostics can be given. */
|
|
|
|
|
if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0
|
|
|
|
|
&& ! different_binding_level)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
|
|
|
|
|
DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
|
|
|
|
|
}
|
|
|
|
|
|
1992-07-07 03:47:54 +02:00
|
|
|
|
/* Merge the unused-warning information. */
|
|
|
|
|
if (DECL_IN_SYSTEM_HEADER (olddecl))
|
|
|
|
|
DECL_IN_SYSTEM_HEADER (newdecl) = 1;
|
|
|
|
|
else if (DECL_IN_SYSTEM_HEADER (newdecl))
|
1995-11-29 19:55:34 +01:00
|
|
|
|
DECL_IN_SYSTEM_HEADER (write_olddecl) = 1;
|
1992-07-07 03:47:54 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Merge the initialization information. */
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* When called with different_binding_level set, don't copy over
|
|
|
|
|
DECL_INITIAL, so that we don't accidentally change function
|
|
|
|
|
declarations into function definitions. */
|
|
|
|
|
if (DECL_INITIAL (newdecl) == 0 && ! different_binding_level)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
|
1994-02-17 23:49:29 +01:00
|
|
|
|
|
|
|
|
|
/* Merge the section attribute.
|
|
|
|
|
We want to issue an error if the sections conflict but that must be
|
|
|
|
|
done later in decl_attributes since we are called before attributes
|
|
|
|
|
are assigned. */
|
|
|
|
|
if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
|
|
|
|
|
DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
|
1994-04-09 14:25:26 +02:00
|
|
|
|
|
1999-09-07 07:49:18 +02:00
|
|
|
|
/* Copy the assembler name.
|
|
|
|
|
Currently, it can only be defined in the prototype. */
|
Compute DECL_ASSEMBLER_NAME lazily.
* tree.h (DECL_ASSEMBLER_NAME): Compute it lazily.
(DECL_ASSEMBLER_NAME_SET_P): New macro.
(SET_DECL_ASSEMBLER_NAME): Likewise.
(COPY_DECL_ASSEMBLER_NAME): Likewise.
(set_decl_assembler_name): Declare.
(lang_set_decl_assembler_name): Likewise.
* tree.c (lang_set_decl_assembler_name): New variab.e
(set_decl_assembler_name): New function.
(init_obstacks): Set lang_set_decl_assembler_name.
(build_decl): Don't set DECL_ASSEMBLER_NAME.
* c-decl.c (duplicate_decls): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(builtin_function): Likewise.
(finish_decl): Likewise.
* dbxout.c (dbxout_type_methods): Likewise.
* ggc-common.c (ggc_mark_trees): Likewise.
* profile.c (output_func_start_profiler): Likewise.
* varasm.c (make_decl_rtl): Likewise.
* class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(add_method): Remove optimization involving comparison of
DECL_ASSEMBLER_NAME.
(build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(check_methods): Likewise.
(build_clone): Likewise.
(built_vtt): Likewise.
* cp-tree.h (DECL_NEEDED_P): Likewise.
* decl.c (pushtag): Likewise.
(duplicate_decls): Likewise.
(pushdecl): Likewise.
(builtin_function): Likewise.
(build_library_fn_1): Set DECL_LANGUAGE for library functions.
(build_cp_library_fn): Likewise.
(maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(make_rtl_for_nonlocal_decl): Likewise.
(cp_finish_decl): Likewise.
(grokfndecl): Likewise.
(grokvardecl): Likewise.
(grokdeclarator): Likewise.
(start_function): Likewise.
(cp_missing_return_ok_p): Likewise.
* decl2.c (grokclassfn): Likewise.
(check_classfn): Likewise.
(finish_static_data_member_decl): Likewise.
(grokfield): Likewise.
* error.c (GLOBAL_IORD_P): Remove.
(dump_global_iord): Improve output.
(dump_decl): Avoid using DECL_ASSEMBLER_NAME.
* except.c (nothrow_libfn_p): Summarily reject any function not in
namespace-scope.
* init.c (build_java_class_ref): Don't explicitly set
DECL_ASSEMBLER_NAME after calling mangle_decl.
* mangle.c (mangle_decl_string): Handle extern "C" functions.
(mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl.
* method.c (set_mangled_name_for_decl): Don't explicitly set
DECL_ASSEMBLER_NAME after calling mangle_decl.
(make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and
IDENTIFIER_GLOBAL_VALUE for the thunk.
* pt.c (set_mangled_name_for_template_decl): Remove.
(check_explicit_specialization): Don't use it.
(looup_template_class): Don't set DECL_ASSEMBLER_NAME.
(tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME.
* rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(tinfo_base_init): Likewise.
(create_real_tinfo_var): Likewise.
* search.c (looup_field_1): Likewise.
* semantics.c (finish_named_return_value): Likewise.
* tree.c (init_tree): Set lang_set_decl_assembler_name.
* com.c (builtin_function): Use SET_DECL_ASSEMBLER_NAME.
* class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME.
(layout_class): Likewise.
(layout_class_method): Likewise.
(emit_register_classes): Likewise.
* decl.c (builtin_function): Likewise.
(give_name_to_locals): Likewise.
From-SVN: r40642
2001-03-20 00:50:04 +01:00
|
|
|
|
COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
|
1999-09-07 07:49:18 +02:00
|
|
|
|
|
1995-01-14 02:09:01 +01:00
|
|
|
|
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
|
|
|
|
{
|
|
|
|
|
DECL_STATIC_CONSTRUCTOR(newdecl) |= DECL_STATIC_CONSTRUCTOR(olddecl);
|
|
|
|
|
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
|
1998-07-30 12:38:22 +02:00
|
|
|
|
|
|
|
|
|
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
|
|
|
|
|
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
|
1998-10-11 04:21:54 +02:00
|
|
|
|
DECL_NO_CHECK_MEMORY_USAGE (newdecl)
|
|
|
|
|
|= DECL_NO_CHECK_MEMORY_USAGE (olddecl);
|
1999-12-04 04:00:04 +01:00
|
|
|
|
DECL_NO_LIMIT_STACK (newdecl)
|
|
|
|
|
|= DECL_NO_LIMIT_STACK (olddecl);
|
1995-01-14 02:09:01 +01:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
/* If cannot merge, then use the new type and qualifiers,
|
|
|
|
|
and don't preserve the old rtl. */
|
1995-11-29 19:55:34 +01:00
|
|
|
|
else if (! different_binding_level)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
|
|
|
|
|
TREE_READONLY (olddecl) = TREE_READONLY (newdecl);
|
|
|
|
|
TREE_THIS_VOLATILE (olddecl) = TREE_THIS_VOLATILE (newdecl);
|
|
|
|
|
TREE_SIDE_EFFECTS (olddecl) = TREE_SIDE_EFFECTS (newdecl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Merge the storage class information. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* For functions, static overrides non-static. */
|
|
|
|
|
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
|
|
|
|
{
|
|
|
|
|
TREE_PUBLIC (newdecl) &= TREE_PUBLIC (olddecl);
|
|
|
|
|
/* This is since we don't automatically
|
|
|
|
|
copy the attributes of NEWDECL into OLDDECL. */
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* No need to worry about different_binding_level here because
|
|
|
|
|
then TREE_PUBLIC (newdecl) was true. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
|
|
|
|
|
/* If this clears `static', clear it in the identifier too. */
|
|
|
|
|
if (! TREE_PUBLIC (olddecl))
|
|
|
|
|
TREE_PUBLIC (DECL_NAME (olddecl)) = 0;
|
|
|
|
|
}
|
1992-07-12 04:56:45 +02:00
|
|
|
|
if (DECL_EXTERNAL (newdecl))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-08-28 03:44:28 +02:00
|
|
|
|
if (! different_binding_level)
|
|
|
|
|
{
|
|
|
|
|
/* Don't mess with these flags on local externs; they remain
|
|
|
|
|
external even if there's a declaration at file scope which
|
|
|
|
|
isn't. */
|
|
|
|
|
TREE_STATIC (newdecl) = TREE_STATIC (olddecl);
|
|
|
|
|
DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* An extern decl does not override previous storage class. */
|
|
|
|
|
TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
|
1996-03-05 13:51:14 +01:00
|
|
|
|
if (! DECL_EXTERNAL (newdecl))
|
|
|
|
|
DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TREE_STATIC (olddecl) = TREE_STATIC (newdecl);
|
|
|
|
|
TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
|
|
|
|
|
}
|
1992-09-07 08:57:50 +02:00
|
|
|
|
|
1995-11-29 19:55:34 +01:00
|
|
|
|
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-02-21 15:42:27 +01:00
|
|
|
|
/* If we're redefining a function previously defined as extern
|
|
|
|
|
inline, make sure we emit debug info for the inline before we
|
|
|
|
|
throw it away, in case it was inlined into a function that hasn't
|
|
|
|
|
been written out yet. */
|
|
|
|
|
if (new_is_definition && DECL_INITIAL (olddecl) && TREE_USED (olddecl))
|
|
|
|
|
{
|
Makefile.in (emit-rtl.o, c-decl.o): Depend on debug.h.
* Makefile.in (emit-rtl.o, c-decl.o): Depend on debug.h.
(final.o): Don't depend on xcoffout.h, dbxout.h or sdbout.h.
(toplev.o): Don't depend on xcoffout.h.
* c-decl.c: Include debug.h
(duplicate_decls): Use debug hook.
* dbxout.c (dbxout_source_file, dbxout_args): Make static.
(dbx_debug_hooks, xcoff_debug_hooks): Update.
(dbxout_types): Remove.
* dbxout.h (dbxout_source_file, dbxout_types, dbxout_args): Remove.
* debug.c (do_nothing_debug_hooks): Update.
(debug_true_tree, debug_nothing_rtx): New.
* debug.h (struct rtx_def): New.
(struct gcc_debug_hooks): New hooks ignore_block,
outlining_inline_function and label.
(debug_true_tree, debug_nothing_rtx, dwarf2out_frame_init,
dwarf2out_frame_finish): New.
* dwarf2out.c (dwarf2out_ignore_block, dwarf2out_abstract_function):
Make static, update prototype.
(dwarf2_debug_hooks): Update.
* dwarf2out.h (dwarf2out_ignore_block, dwarf2out_abstract_function,
dwarf2out_frame_init, dwarf2out_frame_finish): Remove.
* dwarfout.c (dwarf_debug_hooks): Update.
* emit-rtl.c: Include debug.h.
(remove_unnecessary_notes): Use debug hook.
* final.c: Don't include dbxout.h, xcoffout.h or sdbout.h.
(final_scan_insn): Use debug hook.
* integrate.c (output_inline_function): Use debug hook.
* sdbout.c (sdbout_toplevel_data, sdbout_label): Make static.
(sdb_debug_hooks): Update.
* sdbout.h (sdbout_label, sdbout_toplevel_data): Remove.
* toplev.c: Don't include xcoffout.h.
(note_outlining_of_inline_function, debug_ignore_block): Remove.
* toplev.h (note_outlining_of_inline_function, debug_ignore_block):
Remove.
* tree.h (dwarf2out_do_frame): Remove.
From-SVN: r44163
2001-07-19 23:17:09 +02:00
|
|
|
|
(*debug_hooks->outlining_inline_function) (olddecl);
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
|
2001-02-21 15:42:27 +01:00
|
|
|
|
/* The new defn must not be inline. */
|
|
|
|
|
DECL_INLINE (newdecl) = 0;
|
|
|
|
|
DECL_UNINLINABLE (newdecl) = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* If either decl says `inline', this fn is inline,
|
|
|
|
|
unless its definition was passed already. */
|
2001-10-08 18:37:06 +02:00
|
|
|
|
if (DECL_DECLARED_INLINE_P (newdecl)
|
|
|
|
|
&& DECL_DECLARED_INLINE_P (olddecl) == 0)
|
|
|
|
|
DECL_DECLARED_INLINE_P (olddecl) = 1;
|
2001-02-21 15:42:27 +01:00
|
|
|
|
|
2001-10-08 18:37:06 +02:00
|
|
|
|
DECL_DECLARED_INLINE_P (newdecl) = DECL_DECLARED_INLINE_P (olddecl);
|
2001-10-18 20:29:02 +02:00
|
|
|
|
|
|
|
|
|
DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
|
|
|
|
|
= (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
|
2001-02-21 15:42:27 +01:00
|
|
|
|
}
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (DECL_BUILT_IN (olddecl))
|
|
|
|
|
{
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* Get rid of any built-in function if new arg types don't match it
|
|
|
|
|
or if we have a function definition. */
|
|
|
|
|
if (! types_match || new_is_definition)
|
|
|
|
|
{
|
|
|
|
|
if (! different_binding_level)
|
|
|
|
|
{
|
|
|
|
|
TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
|
1999-09-24 12:07:04 +02:00
|
|
|
|
DECL_BUILT_IN_CLASS (olddecl) = NOT_BUILT_IN;
|
1995-11-29 19:55:34 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* If redeclaring a builtin function, and not a definition,
|
|
|
|
|
it stays built in. */
|
1999-09-24 12:07:04 +02:00
|
|
|
|
DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
|
1995-11-29 19:55:34 +01:00
|
|
|
|
DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* Also preserve various other info from the definition. */
|
|
|
|
|
else if (! new_is_definition)
|
2001-03-27 04:17:48 +02:00
|
|
|
|
DECL_NUM_STMTS (newdecl) = DECL_NUM_STMTS (olddecl);
|
1995-11-29 19:55:34 +01:00
|
|
|
|
if (! new_is_definition)
|
|
|
|
|
{
|
|
|
|
|
DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
|
|
|
|
|
/* When called with different_binding_level set, don't copy over
|
|
|
|
|
DECL_INITIAL, so that we don't accidentally change function
|
|
|
|
|
declarations into function definitions. */
|
|
|
|
|
if (! different_binding_level)
|
2001-12-04 11:34:40 +01:00
|
|
|
|
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
|
1995-11-29 19:55:34 +01:00
|
|
|
|
DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl);
|
2001-12-04 11:34:40 +01:00
|
|
|
|
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
|
1995-11-29 19:55:34 +01:00
|
|
|
|
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
|
1997-07-19 04:16:12 +02:00
|
|
|
|
if (DECL_INLINE (newdecl))
|
2001-12-04 11:34:40 +01:00
|
|
|
|
DECL_ABSTRACT_ORIGIN (newdecl)
|
|
|
|
|
= (different_binding_level
|
|
|
|
|
? DECL_ORIGIN (olddecl)
|
|
|
|
|
: DECL_ABSTRACT_ORIGIN (olddecl));
|
1995-11-29 19:55:34 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (different_binding_level)
|
2000-08-28 03:44:28 +02:00
|
|
|
|
return 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1992-09-07 08:57:50 +02:00
|
|
|
|
/* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
|
1998-04-04 15:32:39 +02:00
|
|
|
|
But preserve OLDDECL's DECL_UID. */
|
1992-09-07 08:57:50 +02:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
unsigned olddecl_uid = DECL_UID (olddecl);
|
1992-09-07 08:57:50 +02:00
|
|
|
|
|
Use memset/memcmp instead of bzero/bcmp.
* c-decl.c (duplicate_decls, copy_lang_decl), dwarfout.c
(dwarfout_line), gcc.c (main, save_string), tree.c (init_obstacks,
perm_calloc, get_identifier, maybe_get_identifier,
real_value_from_int_cst, simple_cst_equal), varasm.c
(assemble_name, assemble_real, immed_real_const_1,
compare_constant_1, decode_rtx_const, output_constant_pool): Use
strrchr () instead of rindex (). Use memcmp () instead of bcmp
(). Use memcpy () instead of bcopy (). Use memset () instead of
bzero ().
cp:
* tree.c (cp_tree_equal): Use memcmp () instead of bcmp ().
From-SVN: r37228
2000-11-03 19:55:54 +01:00
|
|
|
|
memcpy ((char *) olddecl + sizeof (struct tree_common),
|
|
|
|
|
(char *) newdecl + sizeof (struct tree_common),
|
|
|
|
|
sizeof (struct tree_decl) - sizeof (struct tree_common));
|
1992-09-07 08:57:50 +02:00
|
|
|
|
DECL_UID (olddecl) = olddecl_uid;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1998-02-18 11:38:57 +01:00
|
|
|
|
/* NEWDECL contains the merged attribute lists.
|
|
|
|
|
Update OLDDECL to be the same. */
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl);
|
1998-02-18 11:38:57 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record a decl-node X as belonging to the current lexical scope.
|
|
|
|
|
Check for errors (such as an incompatible declaration for the same
|
|
|
|
|
name already seen in the same scope).
|
|
|
|
|
|
|
|
|
|
Returns either X or an old decl for the same name.
|
|
|
|
|
If an old decl is returned, it may have been smashed
|
|
|
|
|
to agree with what X says. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
pushdecl (x)
|
|
|
|
|
tree x;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree t;
|
|
|
|
|
tree name = DECL_NAME (x);
|
|
|
|
|
struct binding_level *b = current_binding_level;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-10-08 18:37:06 +02:00
|
|
|
|
/* Functions need the lang_decl data. */
|
|
|
|
|
if (TREE_CODE (x) == FUNCTION_DECL && ! DECL_LANG_SPECIFIC (x))
|
|
|
|
|
DECL_LANG_SPECIFIC (x) = (struct lang_decl *)
|
|
|
|
|
ggc_alloc_cleared (sizeof (struct lang_decl));
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
DECL_CONTEXT (x) = current_function_decl;
|
1993-02-27 20:08:53 +01:00
|
|
|
|
/* A local extern declaration for a function doesn't constitute nesting.
|
|
|
|
|
A local auto declaration does, since it's a forward decl
|
|
|
|
|
for a nested function coming later. */
|
2000-09-17 09:38:23 +02:00
|
|
|
|
if ((TREE_CODE (x) == FUNCTION_DECL || TREE_CODE (x) == VAR_DECL)
|
|
|
|
|
&& DECL_INITIAL (x) == 0 && DECL_EXTERNAL (x))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
DECL_CONTEXT (x) = 0;
|
|
|
|
|
|
|
|
|
|
if (name)
|
|
|
|
|
{
|
1995-11-29 19:55:34 +01:00
|
|
|
|
int different_binding_level = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-11-03 01:00:01 +01:00
|
|
|
|
if (warn_nested_externs
|
|
|
|
|
&& DECL_EXTERNAL (x)
|
|
|
|
|
&& b != global_binding_level
|
|
|
|
|
&& x != IDENTIFIER_IMPLICIT_DECL (name)
|
|
|
|
|
/* No error messages for __FUNCTION__ and __PRETTY_FUNCTION__. */
|
|
|
|
|
&& !DECL_IN_SYSTEM_HEADER (x))
|
|
|
|
|
warning ("nested extern declaration of `%s'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
|
1995-11-29 19:55:34 +01:00
|
|
|
|
t = lookup_name_current_level (name);
|
1994-07-13 03:37:25 +02:00
|
|
|
|
/* Don't type check externs here when -traditional. This is so that
|
|
|
|
|
code with conflicting declarations inside blocks will get warnings
|
|
|
|
|
not errors. X11 for instance depends on this. */
|
1995-11-29 19:55:34 +01:00
|
|
|
|
if (! t && DECL_EXTERNAL (x) && TREE_PUBLIC (x) && ! flag_traditional)
|
|
|
|
|
{
|
2001-11-03 01:00:01 +01:00
|
|
|
|
t = lookup_name (name);
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* Type decls at global scope don't conflict with externs declared
|
|
|
|
|
inside lexical blocks. */
|
|
|
|
|
if (t && TREE_CODE (t) == TYPE_DECL)
|
|
|
|
|
t = 0;
|
|
|
|
|
different_binding_level = 1;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (t != 0 && t == error_mark_node)
|
|
|
|
|
/* error_mark_node is 0 for a while during initialization! */
|
|
|
|
|
{
|
|
|
|
|
t = 0;
|
|
|
|
|
error_with_decl (x, "`%s' used prior to declaration");
|
|
|
|
|
}
|
|
|
|
|
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* If this decl is `static' and an implicit decl was seen previously,
|
|
|
|
|
warn. But don't complain if -traditional,
|
|
|
|
|
since traditional compilers don't complain. */
|
|
|
|
|
if (! flag_traditional && TREE_PUBLIC (name)
|
|
|
|
|
/* Don't test for DECL_EXTERNAL, because grokdeclarator
|
|
|
|
|
sets this for all functions. */
|
|
|
|
|
&& ! TREE_PUBLIC (x)
|
1996-09-22 17:37:08 +02:00
|
|
|
|
&& (TREE_CODE (x) == FUNCTION_DECL || b == global_binding_level)
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* We used to warn also for explicit extern followed by static,
|
|
|
|
|
but sometimes you need to do it that way. */
|
|
|
|
|
&& IDENTIFIER_IMPLICIT_DECL (name) != 0)
|
|
|
|
|
{
|
|
|
|
|
pedwarn ("`%s' was declared implicitly `extern' and later `static'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
pedwarn_with_file_and_line
|
|
|
|
|
(DECL_SOURCE_FILE (IDENTIFIER_IMPLICIT_DECL (name)),
|
|
|
|
|
DECL_SOURCE_LINE (IDENTIFIER_IMPLICIT_DECL (name)),
|
|
|
|
|
"previous declaration of `%s'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
1998-05-06 01:18:02 +02:00
|
|
|
|
TREE_THIS_VOLATILE (name) = 1;
|
1995-11-29 19:55:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (t != 0 && duplicate_decls (x, t, different_binding_level))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (t) == PARM_DECL)
|
|
|
|
|
{
|
|
|
|
|
/* Don't allow more than one "real" duplicate
|
|
|
|
|
of a forward parm decl. */
|
|
|
|
|
TREE_ASM_WRITTEN (t) = TREE_ASM_WRITTEN (x);
|
|
|
|
|
return t;
|
|
|
|
|
}
|
1995-11-29 19:55:34 +01:00
|
|
|
|
return t;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-05-25 05:57:15 +02:00
|
|
|
|
/* If we are processing a typedef statement, generate a whole new
|
|
|
|
|
..._TYPE node (which will be just an variant of the existing
|
|
|
|
|
..._TYPE node with identical properties) and then install the
|
|
|
|
|
TYPE_DECL node generated to represent the typedef name as the
|
|
|
|
|
TYPE_NAME of this brand new (duplicate) ..._TYPE node.
|
|
|
|
|
|
|
|
|
|
The whole point here is to end up with a situation where each
|
|
|
|
|
and every ..._TYPE node the compiler creates will be uniquely
|
|
|
|
|
associated with AT MOST one node representing a typedef name.
|
|
|
|
|
This way, even though the compiler substitutes corresponding
|
|
|
|
|
..._TYPE nodes for TYPE_DECL (i.e. "typedef name") nodes very
|
|
|
|
|
early on, later parts of the compiler can always do the reverse
|
|
|
|
|
translation and get back the corresponding typedef name. For
|
|
|
|
|
example, given:
|
|
|
|
|
|
|
|
|
|
typedef struct S MY_TYPE;
|
|
|
|
|
MY_TYPE object;
|
|
|
|
|
|
|
|
|
|
Later parts of the compiler might only know that `object' was of
|
1998-05-06 23:09:07 +02:00
|
|
|
|
type `struct S' if it were not for code just below. With this
|
1992-05-25 05:57:15 +02:00
|
|
|
|
code however, later parts of the compiler see something like:
|
|
|
|
|
|
|
|
|
|
struct S' == struct S
|
|
|
|
|
typedef struct S' MY_TYPE;
|
|
|
|
|
struct S' object;
|
|
|
|
|
|
|
|
|
|
And they can then deduce (from the node for type struct S') that
|
|
|
|
|
the original object declaration was:
|
|
|
|
|
|
|
|
|
|
MY_TYPE object;
|
|
|
|
|
|
|
|
|
|
Being able to do this is important for proper support of protoize,
|
|
|
|
|
and also for generating precise symbolic debugging information
|
|
|
|
|
which takes full account of the programmer's (typedef) vocabulary.
|
|
|
|
|
|
|
|
|
|
Obviously, we don't want to generate a duplicate ..._TYPE node if
|
|
|
|
|
the TYPE_DECL node that we are now processing really represents a
|
|
|
|
|
standard built-in type.
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
Since all standard types are effectively declared at line zero
|
|
|
|
|
in the source file, we can easily check to see if we are working
|
|
|
|
|
on a standard type by checking the current value of lineno. */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (x) == TYPE_DECL)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
{
|
|
|
|
|
if (DECL_SOURCE_LINE (x) == 0)
|
|
|
|
|
{
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (TYPE_NAME (TREE_TYPE (x)) == 0)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
TYPE_NAME (TREE_TYPE (x)) = x;
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_TYPE (x) != error_mark_node
|
1998-02-07 23:44:35 +01:00
|
|
|
|
&& DECL_ORIGINAL_TYPE (x) == NULL_TREE)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
{
|
|
|
|
|
tree tt = TREE_TYPE (x);
|
1996-02-12 21:03:24 +01:00
|
|
|
|
DECL_ORIGINAL_TYPE (x) = tt;
|
2000-08-11 00:01:22 +02:00
|
|
|
|
tt = build_type_copy (tt);
|
|
|
|
|
TYPE_NAME (tt) = x;
|
2000-05-05 20:16:49 +02:00
|
|
|
|
TREE_USED (tt) = TREE_USED (x);
|
2000-08-11 00:01:22 +02:00
|
|
|
|
TREE_TYPE (x) = tt;
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1992-09-16 02:54:45 +02:00
|
|
|
|
/* Multiple external decls of the same identifier ought to match.
|
1994-07-13 03:37:25 +02:00
|
|
|
|
Check against both global declarations (when traditional) and out of
|
|
|
|
|
scope (limbo) block level declarations.
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1992-09-16 02:54:45 +02:00
|
|
|
|
We get warnings about inline functions where they are defined.
|
|
|
|
|
Avoid duplicate warnings where they are used. */
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
if (TREE_PUBLIC (x)
|
|
|
|
|
&& ! (TREE_CODE (x) == FUNCTION_DECL && DECL_INLINE (x)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1994-07-13 03:37:25 +02:00
|
|
|
|
tree decl;
|
|
|
|
|
|
|
|
|
|
if (flag_traditional && IDENTIFIER_GLOBAL_VALUE (name) != 0
|
|
|
|
|
&& (DECL_EXTERNAL (IDENTIFIER_GLOBAL_VALUE (name))
|
|
|
|
|
|| TREE_PUBLIC (IDENTIFIER_GLOBAL_VALUE (name))))
|
|
|
|
|
decl = IDENTIFIER_GLOBAL_VALUE (name);
|
|
|
|
|
else if (IDENTIFIER_LIMBO_VALUE (name) != 0)
|
|
|
|
|
/* Decls in limbo are always extern, so no need to check that. */
|
|
|
|
|
decl = IDENTIFIER_LIMBO_VALUE (name);
|
|
|
|
|
else
|
|
|
|
|
decl = 0;
|
1992-09-16 02:54:45 +02:00
|
|
|
|
|
1994-07-13 03:37:25 +02:00
|
|
|
|
if (decl && ! comptypes (TREE_TYPE (x), TREE_TYPE (decl))
|
1993-01-09 10:09:53 +01:00
|
|
|
|
/* If old decl is built-in, we already warned if we should. */
|
|
|
|
|
&& !DECL_BUILT_IN (decl))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
pedwarn_with_decl (x,
|
|
|
|
|
"type mismatch with previous external decl");
|
1992-09-16 02:54:45 +02:00
|
|
|
|
pedwarn_with_decl (decl, "previous external decl of `%s'");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If a function has had an implicit declaration, and then is defined,
|
|
|
|
|
make sure they are compatible. */
|
|
|
|
|
|
|
|
|
|
if (IDENTIFIER_IMPLICIT_DECL (name) != 0
|
|
|
|
|
&& IDENTIFIER_GLOBAL_VALUE (name) == 0
|
|
|
|
|
&& TREE_CODE (x) == FUNCTION_DECL
|
|
|
|
|
&& ! comptypes (TREE_TYPE (x),
|
|
|
|
|
TREE_TYPE (IDENTIFIER_IMPLICIT_DECL (name))))
|
|
|
|
|
{
|
|
|
|
|
warning_with_decl (x, "type mismatch with previous implicit declaration");
|
1992-03-23 03:07:53 +01:00
|
|
|
|
warning_with_decl (IDENTIFIER_IMPLICIT_DECL (name),
|
|
|
|
|
"previous implicit declaration of `%s'");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* In PCC-compatibility mode, extern decls of vars with no current decl
|
|
|
|
|
take effect at top level no matter where they are. */
|
1992-07-12 04:56:45 +02:00
|
|
|
|
if (flag_traditional && DECL_EXTERNAL (x)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& lookup_name (name) == 0)
|
|
|
|
|
{
|
|
|
|
|
tree type = TREE_TYPE (x);
|
|
|
|
|
|
|
|
|
|
/* But don't do this if the type contains temporary nodes. */
|
|
|
|
|
while (type)
|
|
|
|
|
{
|
|
|
|
|
if (type == error_mark_node)
|
|
|
|
|
break;
|
2000-05-23 19:28:23 +02:00
|
|
|
|
if (TYPE_CONTEXT (type))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
warning_with_decl (x, "type of external `%s' is not global");
|
|
|
|
|
/* By exiting the loop early, we leave TYPE nonzero,
|
|
|
|
|
and thus prevent globalization of the decl. */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (type) == FUNCTION_TYPE
|
|
|
|
|
&& TYPE_ARG_TYPES (type) != 0)
|
|
|
|
|
/* The types might not be truly local,
|
|
|
|
|
but the list of arg types certainly is temporary.
|
|
|
|
|
Since prototypes are nontraditional,
|
|
|
|
|
ok not to do the traditional thing. */
|
|
|
|
|
break;
|
|
|
|
|
type = TREE_TYPE (type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type == 0)
|
|
|
|
|
b = global_binding_level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This name is new in its binding level.
|
|
|
|
|
Install the new declaration and return it. */
|
|
|
|
|
if (b == global_binding_level)
|
|
|
|
|
{
|
|
|
|
|
/* Install a global value. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* If the first global decl has external linkage,
|
|
|
|
|
warn if we later see static one. */
|
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (name) == 0 && TREE_PUBLIC (x))
|
|
|
|
|
TREE_PUBLIC (name) = 1;
|
|
|
|
|
|
|
|
|
|
IDENTIFIER_GLOBAL_VALUE (name) = x;
|
|
|
|
|
|
1992-09-16 02:54:45 +02:00
|
|
|
|
/* We no longer care about any previous block level declarations. */
|
|
|
|
|
IDENTIFIER_LIMBO_VALUE (name) = 0;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Don't forget if the function was used via an implicit decl. */
|
|
|
|
|
if (IDENTIFIER_IMPLICIT_DECL (name)
|
|
|
|
|
&& TREE_USED (IDENTIFIER_IMPLICIT_DECL (name)))
|
|
|
|
|
TREE_USED (x) = 1, TREE_USED (name) = 1;
|
|
|
|
|
|
|
|
|
|
/* Don't forget if its address was taken in that way. */
|
|
|
|
|
if (IDENTIFIER_IMPLICIT_DECL (name)
|
|
|
|
|
&& TREE_ADDRESSABLE (IDENTIFIER_IMPLICIT_DECL (name)))
|
|
|
|
|
TREE_ADDRESSABLE (x) = 1;
|
|
|
|
|
|
|
|
|
|
/* Warn about mismatches against previous implicit decl. */
|
|
|
|
|
if (IDENTIFIER_IMPLICIT_DECL (name) != 0
|
|
|
|
|
/* If this real decl matches the implicit, don't complain. */
|
|
|
|
|
&& ! (TREE_CODE (x) == FUNCTION_DECL
|
1992-07-15 20:34:18 +02:00
|
|
|
|
&& (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (x)))
|
|
|
|
|
== integer_type_node)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
pedwarn ("`%s' was previously implicitly declared to return `int'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
|
|
|
|
|
/* If this decl is `static' and an `extern' was seen previously,
|
|
|
|
|
that is erroneous. */
|
|
|
|
|
if (TREE_PUBLIC (name)
|
1992-07-12 04:56:45 +02:00
|
|
|
|
&& ! TREE_PUBLIC (x) && ! DECL_EXTERNAL (x))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1992-10-28 22:39:12 +01:00
|
|
|
|
/* Okay to redeclare an ANSI built-in as static. */
|
|
|
|
|
if (t != 0 && DECL_BUILT_IN (t))
|
1992-03-23 03:07:53 +01:00
|
|
|
|
;
|
|
|
|
|
/* Okay to declare a non-ANSI built-in as anything. */
|
|
|
|
|
else if (t != 0 && DECL_BUILT_IN_NONANSI (t))
|
|
|
|
|
;
|
1995-11-29 19:55:34 +01:00
|
|
|
|
/* Okay to have global type decl after an earlier extern
|
|
|
|
|
declaration inside a lexical block. */
|
|
|
|
|
else if (TREE_CODE (x) == TYPE_DECL)
|
|
|
|
|
;
|
1992-03-23 03:07:53 +01:00
|
|
|
|
else if (IDENTIFIER_IMPLICIT_DECL (name))
|
1998-05-06 01:18:02 +02:00
|
|
|
|
{
|
|
|
|
|
if (! TREE_THIS_VOLATILE (name))
|
|
|
|
|
pedwarn ("`%s' was declared implicitly `extern' and later `static'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else
|
|
|
|
|
pedwarn ("`%s' was declared `extern' and later `static'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Here to install a non-global value. */
|
|
|
|
|
tree oldlocal = IDENTIFIER_LOCAL_VALUE (name);
|
|
|
|
|
tree oldglobal = IDENTIFIER_GLOBAL_VALUE (name);
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
IDENTIFIER_LOCAL_VALUE (name) = x;
|
|
|
|
|
|
|
|
|
|
/* If this is an extern function declaration, see if we
|
1992-07-28 04:20:22 +02:00
|
|
|
|
have a global definition or declaration for the function. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (oldlocal == 0
|
|
|
|
|
&& oldglobal != 0
|
|
|
|
|
&& TREE_CODE (x) == FUNCTION_DECL
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
&& TREE_CODE (oldglobal) == FUNCTION_DECL
|
2001-10-08 18:37:06 +02:00
|
|
|
|
&& DECL_EXTERNAL (x)
|
|
|
|
|
&& ! DECL_DECLARED_INLINE_P (x))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* We have one. Their types must agree. */
|
|
|
|
|
if (! comptypes (TREE_TYPE (x),
|
|
|
|
|
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (name))))
|
1992-07-28 04:20:22 +02:00
|
|
|
|
pedwarn_with_decl (x, "extern declaration of `%s' doesn't match global one");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Inner extern decl is inline if global one is.
|
|
|
|
|
Copy enough to really inline it. */
|
2001-10-08 18:37:06 +02:00
|
|
|
|
if (DECL_DECLARED_INLINE_P (oldglobal))
|
1992-07-28 04:20:22 +02:00
|
|
|
|
{
|
2001-10-08 18:37:06 +02:00
|
|
|
|
DECL_DECLARED_INLINE_P (x)
|
|
|
|
|
= DECL_DECLARED_INLINE_P (oldglobal);
|
1992-07-28 04:20:22 +02:00
|
|
|
|
DECL_INLINE (x) = DECL_INLINE (oldglobal);
|
1992-11-22 22:55:39 +01:00
|
|
|
|
DECL_INITIAL (x) = (current_function_decl == oldglobal
|
|
|
|
|
? 0 : DECL_INITIAL (oldglobal));
|
1992-07-28 04:20:22 +02:00
|
|
|
|
DECL_SAVED_INSNS (x) = DECL_SAVED_INSNS (oldglobal);
|
2001-03-27 04:17:48 +02:00
|
|
|
|
DECL_NUM_STMTS (x) = DECL_NUM_STMTS (oldglobal);
|
1992-07-28 04:20:22 +02:00
|
|
|
|
DECL_ARGUMENTS (x) = DECL_ARGUMENTS (oldglobal);
|
1992-08-07 06:06:43 +02:00
|
|
|
|
DECL_RESULT (x) = DECL_RESULT (oldglobal);
|
|
|
|
|
TREE_ASM_WRITTEN (x) = TREE_ASM_WRITTEN (oldglobal);
|
2000-08-28 03:44:28 +02:00
|
|
|
|
DECL_ABSTRACT_ORIGIN (x)
|
|
|
|
|
= DECL_ABSTRACT_ORIGIN (oldglobal);
|
1992-07-28 04:20:22 +02:00
|
|
|
|
}
|
|
|
|
|
/* Inner extern decl is built-in if global one is. */
|
|
|
|
|
if (DECL_BUILT_IN (oldglobal))
|
|
|
|
|
{
|
1999-09-24 12:07:04 +02:00
|
|
|
|
DECL_BUILT_IN_CLASS (x) = DECL_BUILT_IN_CLASS (oldglobal);
|
1994-04-11 12:20:41 +02:00
|
|
|
|
DECL_FUNCTION_CODE (x) = DECL_FUNCTION_CODE (oldglobal);
|
1992-07-28 04:20:22 +02:00
|
|
|
|
}
|
|
|
|
|
/* Keep the arg types from a file-scope fcn defn. */
|
|
|
|
|
if (TYPE_ARG_TYPES (TREE_TYPE (oldglobal)) != 0
|
|
|
|
|
&& DECL_INITIAL (oldglobal)
|
|
|
|
|
&& TYPE_ARG_TYPES (TREE_TYPE (x)) == 0)
|
|
|
|
|
TREE_TYPE (x) = TREE_TYPE (oldglobal);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
#if 0
|
|
|
|
|
/* This case is probably sometimes the right thing to do. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* If we have a local external declaration,
|
|
|
|
|
then any file-scope declaration should not
|
|
|
|
|
have been static. */
|
|
|
|
|
if (oldlocal == 0 && oldglobal != 0
|
|
|
|
|
&& !TREE_PUBLIC (oldglobal)
|
1992-07-12 04:56:45 +02:00
|
|
|
|
&& DECL_EXTERNAL (x) && TREE_PUBLIC (x))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning ("`%s' locally external but globally static",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* If we have a local external declaration,
|
|
|
|
|
and no file-scope declaration has yet been seen,
|
|
|
|
|
then if we later have a file-scope decl it must not be static. */
|
|
|
|
|
if (oldlocal == 0
|
1992-07-12 04:56:45 +02:00
|
|
|
|
&& DECL_EXTERNAL (x)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TREE_PUBLIC (x))
|
|
|
|
|
{
|
1995-11-29 19:55:34 +01:00
|
|
|
|
if (oldglobal == 0)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
TREE_PUBLIC (name) = 1;
|
1992-09-16 02:54:45 +02:00
|
|
|
|
|
|
|
|
|
/* Save this decl, so that we can do type checking against
|
|
|
|
|
other decls after it falls out of scope.
|
|
|
|
|
|
|
|
|
|
Only save it once. This prevents temporary decls created in
|
|
|
|
|
expand_inline_function from being used here, since this
|
|
|
|
|
will have been set when the inline function was parsed.
|
|
|
|
|
It also helps give slightly better warnings. */
|
|
|
|
|
if (IDENTIFIER_LIMBO_VALUE (name) == 0)
|
|
|
|
|
IDENTIFIER_LIMBO_VALUE (name) = x;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Warn if shadowing an argument at the top level of the body. */
|
1992-07-12 04:56:45 +02:00
|
|
|
|
if (oldlocal != 0 && !DECL_EXTERNAL (x)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* This warning doesn't apply to the parms of a nested fcn. */
|
|
|
|
|
&& ! current_binding_level->parm_flag
|
|
|
|
|
/* Check that this is one level down from the parms. */
|
|
|
|
|
&& current_binding_level->level_chain->parm_flag
|
|
|
|
|
/* Check that the decl being shadowed
|
|
|
|
|
comes from the parm level, one level up. */
|
|
|
|
|
&& chain_member (oldlocal, current_binding_level->level_chain->names))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (oldlocal) == PARM_DECL)
|
|
|
|
|
pedwarn ("declaration of `%s' shadows a parameter",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
else
|
|
|
|
|
pedwarn ("declaration of `%s' shadows a symbol from the parameter list",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Maybe warn if shadowing something else. */
|
1992-07-12 04:56:45 +02:00
|
|
|
|
else if (warn_shadow && !DECL_EXTERNAL (x)
|
1992-05-22 21:11:09 +02:00
|
|
|
|
/* No shadow warnings for internally generated vars. */
|
1992-10-06 01:23:17 +01:00
|
|
|
|
&& DECL_SOURCE_LINE (x) != 0
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* No shadow warnings for vars made for inlining. */
|
1992-05-22 22:41:45 +02:00
|
|
|
|
&& ! DECL_FROM_INLINE (x))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
top level:
* c-common.c (declare_function_name): Use func_id_node,
function_id_node, and pretty_function_id_node. Do not make
__func__ visible at file scope.
* c-common.h (c_tree_index): Add CTI_FUNCTION_ID,
CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID.
(function_id_node, pretty_function_id_node, func_id_node): New
macros.
* c-decl.c (init_decl_processing): Initialize function_id_node,
pretty_function_id_node, and func_id_node.
(c_make_fname_decl): Correct comment.
* tree.h (struct tree_identifier): Constify pointer member.
* c-decl.c (pushdecl, implicit_decl_warning): Constify a char *.
* c-pragma.h (struct weak_syms): Constify name and value members.
(add_weak): Constify arguments.
* calls.c (special_function_p): Constify a char *.
(expand_call): Remove variable which is initialized and then
never used.
* dependence.c (struct def_use, struct induction, struct subscript):
Constify 'variable' member.
(get_low_bound, have_induction_variable): Constify char * argument.
(find_induction_variable): Add braces to avoid dangling else.
(classify_dependence): Constify char * arrays.
* profile.c (output_func_start_profiler): Constify a char *.
* stor-layout.c (finalize_record_size): Constify a char *.
* tree.c (is_attribute_p): Constify a char *.
* varasm.c (add_weak, remove_from_pending_weak_list): Constify argument.
* varasm.c (make_function_rtl, make_decl_rtl): Rearrange code
for comprehensibility. Do not call get_identifier if we did
not change the DECL_ASSEMBLER_NAME of the decl. Use alloca to
create temporary string constants, not ggc_alloc_string. No
need to copy result of ASM_FORMAT_PRIVATE_NAME. Use const
char * to hold IDENTIFIER_POINTERs.
ch:
* inout.c (add_enum_to_list): Use DECL_NAME directly, don't get
its IDENTIFIER_POINTER and immediately call get_identifier on it.
* lex.c (yywrap): Constify a char *.
cp:
* class.c (build_secondary_vtable): Constify a char *.
* decl.c (init_decl_processing): Initialize function_id_node,
pretty_function_id_node, and func_id_node.
* input.c (struct input_source): Constify 'str'.
(feed_input): Constify first argument.
* mangle.c (write_identifier): Constify argument.
* pt.c (mangle_class_name_for_template): Constify argument.
f:
* ansify.c: Use #line, not # <number>.
java:
* jcf-parse.c (set_source_filename): Constify a char *.
* jcf-write.c (append_innerclasses_attribute,
make_class_file_name): Constify a char *. Don't recycle a
variable for an unrelated purpose.
* parse.y: (build_alias_initializer_parameter_list): Constify a char *.
(breakdown_qualified): Do not modify IDENTIFIER_POINTER strings.
From-SVN: r36055
2000-08-29 23:39:49 +02:00
|
|
|
|
const char *id = IDENTIFIER_POINTER (name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (TREE_CODE (x) == PARM_DECL
|
1993-02-27 20:08:53 +01:00
|
|
|
|
&& current_binding_level->level_chain->parm_flag)
|
|
|
|
|
/* Don't warn about the parm names in function declarator
|
|
|
|
|
within a function declarator.
|
|
|
|
|
It would be nice to avoid warning in any function
|
|
|
|
|
declarator in a declaration, as opposed to a definition,
|
|
|
|
|
but there is no way to tell it's not a definition. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
;
|
|
|
|
|
else if (oldlocal != 0 && TREE_CODE (oldlocal) == PARM_DECL)
|
1999-01-27 02:43:17 +01:00
|
|
|
|
warning ("declaration of `%s' shadows a parameter", id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (oldlocal != 0)
|
1999-01-27 02:43:17 +01:00
|
|
|
|
warning ("declaration of `%s' shadows previous local", id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (IDENTIFIER_GLOBAL_VALUE (name) != 0
|
|
|
|
|
&& IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node)
|
1999-01-27 02:43:17 +01:00
|
|
|
|
warning ("declaration of `%s' shadows global declaration", id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If storing a local value, there may already be one (inherited).
|
|
|
|
|
If so, record it for restoration when this binding level ends. */
|
|
|
|
|
if (oldlocal != 0)
|
|
|
|
|
b->shadowed = tree_cons (name, oldlocal, b->shadowed);
|
|
|
|
|
}
|
|
|
|
|
|
2000-06-08 00:43:44 +02:00
|
|
|
|
/* Keep count of variables in this level with incomplete type.
|
|
|
|
|
If the input is erroneous, we can have error_mark in the type
|
|
|
|
|
slot (e.g. "f(void a, ...)") - that doesn't count as an
|
|
|
|
|
incomplete type. */
|
|
|
|
|
if (TREE_TYPE (x) != error_mark_node
|
|
|
|
|
&& !COMPLETE_TYPE_P (TREE_TYPE (x)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
++b->n_incomplete;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Put decls on list in reverse order.
|
|
|
|
|
We will reverse them later if necessary. */
|
|
|
|
|
TREE_CHAIN (x) = b->names;
|
|
|
|
|
b->names = x;
|
|
|
|
|
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL, if appropriate. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
pushdecl_top_level (x)
|
|
|
|
|
tree x;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree t;
|
|
|
|
|
struct binding_level *b = current_binding_level;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
current_binding_level = global_binding_level;
|
|
|
|
|
t = pushdecl (x);
|
|
|
|
|
current_binding_level = b;
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Generate an implicit declaration for identifier FUNCTIONID
|
|
|
|
|
as a function of type int (). Print a warning if appropriate. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
implicitly_declare (functionid)
|
|
|
|
|
tree functionid;
|
|
|
|
|
{
|
2001-10-02 09:12:25 +02:00
|
|
|
|
tree decl;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int traditional_warning = 0;
|
|
|
|
|
/* Only one "implicit declaration" warning per identifier. */
|
|
|
|
|
int implicit_warning;
|
|
|
|
|
|
|
|
|
|
/* We used to reuse an old implicit decl here,
|
|
|
|
|
but this loses with inline functions because it can clobber
|
|
|
|
|
the saved decl chains. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
#if 0
|
|
|
|
|
if (IDENTIFIER_IMPLICIT_DECL (functionid) != 0)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
decl = IDENTIFIER_IMPLICIT_DECL (functionid);
|
2000-08-11 00:01:22 +02:00
|
|
|
|
else
|
|
|
|
|
#endif
|
1992-02-13 23:21:26 +01:00
|
|
|
|
decl = build_decl (FUNCTION_DECL, functionid, default_function_type);
|
|
|
|
|
|
|
|
|
|
/* Warn of implicit decl following explicit local extern decl.
|
|
|
|
|
This is probably a program designed for traditional C. */
|
|
|
|
|
if (TREE_PUBLIC (functionid) && IDENTIFIER_GLOBAL_VALUE (functionid) == 0)
|
|
|
|
|
traditional_warning = 1;
|
|
|
|
|
|
|
|
|
|
/* Warn once of an implicit declaration. */
|
|
|
|
|
implicit_warning = (IDENTIFIER_IMPLICIT_DECL (functionid) == 0);
|
|
|
|
|
|
1992-07-12 04:56:45 +02:00
|
|
|
|
DECL_EXTERNAL (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TREE_PUBLIC (decl) = 1;
|
|
|
|
|
|
|
|
|
|
/* Record that we have an implicit decl and this is it. */
|
|
|
|
|
IDENTIFIER_IMPLICIT_DECL (functionid) = decl;
|
|
|
|
|
|
|
|
|
|
/* ANSI standard says implicit declarations are in the innermost block.
|
|
|
|
|
So we record the decl in the standard fashion.
|
|
|
|
|
If flag_traditional is set, pushdecl does it top-level. */
|
|
|
|
|
pushdecl (decl);
|
|
|
|
|
|
|
|
|
|
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
|
|
|
|
maybe_objc_check_decl (decl);
|
|
|
|
|
|
2001-05-01 14:11:35 +02:00
|
|
|
|
rest_of_decl_compilation (decl, NULL, 0, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-07-31 20:10:31 +02:00
|
|
|
|
if (implicit_warning)
|
|
|
|
|
implicit_decl_warning (functionid);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (warn_traditional && traditional_warning)
|
|
|
|
|
warning ("function `%s' was previously declared within a block",
|
|
|
|
|
IDENTIFIER_POINTER (functionid));
|
|
|
|
|
|
|
|
|
|
/* Write a record describing this implicit function declaration to the
|
|
|
|
|
prototypes file (if requested). */
|
|
|
|
|
|
|
|
|
|
gen_aux_info_record (decl, 0, 1, 0);
|
|
|
|
|
|
2001-10-02 09:12:25 +02:00
|
|
|
|
/* Possibly apply some default attributes to this implicit declaration. */
|
|
|
|
|
decl_attributes (&decl, NULL_TREE, 0);
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-31 20:10:31 +02:00
|
|
|
|
void
|
|
|
|
|
implicit_decl_warning (id)
|
|
|
|
|
tree id;
|
|
|
|
|
{
|
top level:
* c-common.c (declare_function_name): Use func_id_node,
function_id_node, and pretty_function_id_node. Do not make
__func__ visible at file scope.
* c-common.h (c_tree_index): Add CTI_FUNCTION_ID,
CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID.
(function_id_node, pretty_function_id_node, func_id_node): New
macros.
* c-decl.c (init_decl_processing): Initialize function_id_node,
pretty_function_id_node, and func_id_node.
(c_make_fname_decl): Correct comment.
* tree.h (struct tree_identifier): Constify pointer member.
* c-decl.c (pushdecl, implicit_decl_warning): Constify a char *.
* c-pragma.h (struct weak_syms): Constify name and value members.
(add_weak): Constify arguments.
* calls.c (special_function_p): Constify a char *.
(expand_call): Remove variable which is initialized and then
never used.
* dependence.c (struct def_use, struct induction, struct subscript):
Constify 'variable' member.
(get_low_bound, have_induction_variable): Constify char * argument.
(find_induction_variable): Add braces to avoid dangling else.
(classify_dependence): Constify char * arrays.
* profile.c (output_func_start_profiler): Constify a char *.
* stor-layout.c (finalize_record_size): Constify a char *.
* tree.c (is_attribute_p): Constify a char *.
* varasm.c (add_weak, remove_from_pending_weak_list): Constify argument.
* varasm.c (make_function_rtl, make_decl_rtl): Rearrange code
for comprehensibility. Do not call get_identifier if we did
not change the DECL_ASSEMBLER_NAME of the decl. Use alloca to
create temporary string constants, not ggc_alloc_string. No
need to copy result of ASM_FORMAT_PRIVATE_NAME. Use const
char * to hold IDENTIFIER_POINTERs.
ch:
* inout.c (add_enum_to_list): Use DECL_NAME directly, don't get
its IDENTIFIER_POINTER and immediately call get_identifier on it.
* lex.c (yywrap): Constify a char *.
cp:
* class.c (build_secondary_vtable): Constify a char *.
* decl.c (init_decl_processing): Initialize function_id_node,
pretty_function_id_node, and func_id_node.
* input.c (struct input_source): Constify 'str'.
(feed_input): Constify first argument.
* mangle.c (write_identifier): Constify argument.
* pt.c (mangle_class_name_for_template): Constify argument.
f:
* ansify.c: Use #line, not # <number>.
java:
* jcf-parse.c (set_source_filename): Constify a char *.
* jcf-write.c (append_innerclasses_attribute,
make_class_file_name): Constify a char *. Don't recycle a
variable for an unrelated purpose.
* parse.y: (build_alias_initializer_parameter_list): Constify a char *.
(breakdown_qualified): Do not modify IDENTIFIER_POINTER strings.
From-SVN: r36055
2000-08-29 23:39:49 +02:00
|
|
|
|
const char *name = IDENTIFIER_POINTER (id);
|
2000-07-31 20:10:31 +02:00
|
|
|
|
if (mesg_implicit_function_declaration == 2)
|
|
|
|
|
error ("implicit declaration of function `%s'", name);
|
|
|
|
|
else if (mesg_implicit_function_declaration == 1)
|
|
|
|
|
warning ("implicit declaration of function `%s'", name);
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Return zero if the declaration NEWDECL is valid
|
|
|
|
|
when the declaration OLDDECL (assumed to be for the same name)
|
|
|
|
|
has already been seen.
|
1999-01-27 02:43:17 +01:00
|
|
|
|
Otherwise return 1 if NEWDECL is a redefinition, 2 if it is a redeclaration,
|
|
|
|
|
and 3 if it is a conflicting declaration. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1999-01-27 02:43:17 +01:00
|
|
|
|
static int
|
1992-02-13 23:21:26 +01:00
|
|
|
|
redeclaration_error_message (newdecl, olddecl)
|
|
|
|
|
tree newdecl, olddecl;
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (newdecl) == TYPE_DECL)
|
|
|
|
|
{
|
|
|
|
|
if (flag_traditional && TREE_TYPE (newdecl) == TREE_TYPE (olddecl))
|
|
|
|
|
return 0;
|
1995-09-12 00:41:44 +02:00
|
|
|
|
/* pushdecl creates distinct types for TYPE_DECLs by calling
|
|
|
|
|
build_type_copy, so the above comparison generally fails. We do
|
|
|
|
|
another test against the TYPE_MAIN_VARIANT of the olddecl, which
|
|
|
|
|
is equivalent to what this code used to do before the build_type_copy
|
|
|
|
|
call. The variant type distinction should not matter for traditional
|
|
|
|
|
code, because it doesn't have type qualifiers. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
if (flag_traditional
|
1995-09-12 00:41:44 +02:00
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_TYPE (olddecl)) == TREE_TYPE (newdecl))
|
|
|
|
|
return 0;
|
1995-02-21 23:56:58 +01:00
|
|
|
|
if (DECL_IN_SYSTEM_HEADER (olddecl) || DECL_IN_SYSTEM_HEADER (newdecl))
|
|
|
|
|
return 0;
|
1999-01-27 02:43:17 +01:00
|
|
|
|
return 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
|
|
|
|
{
|
|
|
|
|
/* Declarations of functions can insist on internal linkage
|
|
|
|
|
but they can't be inconsistent with internal linkage,
|
|
|
|
|
so there can be no error on that account.
|
|
|
|
|
However defining the same name twice is no good. */
|
|
|
|
|
if (DECL_INITIAL (olddecl) != 0 && DECL_INITIAL (newdecl) != 0
|
|
|
|
|
/* However, defining once as extern inline and a second
|
|
|
|
|
time in another way is ok. */
|
2001-10-08 18:37:06 +02:00
|
|
|
|
&& ! (DECL_DECLARED_INLINE_P (olddecl) && DECL_EXTERNAL (olddecl)
|
|
|
|
|
&& ! (DECL_DECLARED_INLINE_P (newdecl)
|
|
|
|
|
&& DECL_EXTERNAL (newdecl))))
|
1999-01-27 02:43:17 +01:00
|
|
|
|
return 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2000-09-17 09:38:23 +02:00
|
|
|
|
else if (DECL_CONTEXT (newdecl) == NULL_TREE)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* Objects declared at top level: */
|
|
|
|
|
/* If at least one is a reference, it's ok. */
|
1992-07-12 04:56:45 +02:00
|
|
|
|
if (DECL_EXTERNAL (newdecl) || DECL_EXTERNAL (olddecl))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return 0;
|
|
|
|
|
/* Reject two definitions. */
|
|
|
|
|
if (DECL_INITIAL (olddecl) != 0 && DECL_INITIAL (newdecl) != 0)
|
1999-01-27 02:43:17 +01:00
|
|
|
|
return 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Now we have two tentative defs, or one tentative and one real def. */
|
|
|
|
|
/* Insist that the linkage match. */
|
|
|
|
|
if (TREE_PUBLIC (olddecl) != TREE_PUBLIC (newdecl))
|
1999-01-27 02:43:17 +01:00
|
|
|
|
return 3;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else if (current_binding_level->parm_flag
|
|
|
|
|
&& TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl))
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
{
|
1994-03-18 00:45:04 +01:00
|
|
|
|
/* Newdecl has block scope. If olddecl has block scope also, then
|
|
|
|
|
reject two definitions, and reject a definition together with an
|
|
|
|
|
external reference. Otherwise, it is OK, because newdecl must
|
|
|
|
|
be an extern reference to olddecl. */
|
|
|
|
|
if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl))
|
1995-03-06 00:27:16 +01:00
|
|
|
|
&& DECL_CONTEXT (newdecl) == DECL_CONTEXT (olddecl))
|
1999-01-27 02:43:17 +01:00
|
|
|
|
return 2;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the LABEL_DECL corresponding to identifier ID as a label.
|
|
|
|
|
Create one if none exists so far for the current function.
|
|
|
|
|
This function is called for both label definitions and label references. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
lookup_label (id)
|
|
|
|
|
tree id;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree decl = IDENTIFIER_LABEL_VALUE (id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1993-01-25 07:36:24 +01:00
|
|
|
|
if (current_function_decl == 0)
|
|
|
|
|
{
|
|
|
|
|
error ("label %s referenced outside of any function",
|
|
|
|
|
IDENTIFIER_POINTER (id));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Use a label already defined or ref'd with this name. */
|
|
|
|
|
if (decl != 0)
|
|
|
|
|
{
|
|
|
|
|
/* But not if it is inherited and wasn't declared to be inheritable. */
|
|
|
|
|
if (DECL_CONTEXT (decl) != current_function_decl
|
|
|
|
|
&& ! C_DECLARED_LABEL_FLAG (decl))
|
|
|
|
|
return shadow_label (id);
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
decl = build_decl (LABEL_DECL, id, void_type_node);
|
|
|
|
|
|
|
|
|
|
/* A label not explicitly declared must be local to where it's ref'd. */
|
|
|
|
|
DECL_CONTEXT (decl) = current_function_decl;
|
|
|
|
|
|
|
|
|
|
DECL_MODE (decl) = VOIDmode;
|
|
|
|
|
|
|
|
|
|
/* Say where one reference is to the label,
|
|
|
|
|
for the sake of the error if it is not defined. */
|
|
|
|
|
DECL_SOURCE_LINE (decl) = lineno;
|
|
|
|
|
DECL_SOURCE_FILE (decl) = input_filename;
|
|
|
|
|
|
|
|
|
|
IDENTIFIER_LABEL_VALUE (id) = decl;
|
|
|
|
|
|
|
|
|
|
named_labels = tree_cons (NULL_TREE, decl, named_labels);
|
|
|
|
|
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make a label named NAME in the current function,
|
|
|
|
|
shadowing silently any that may be inherited from containing functions
|
|
|
|
|
or containing scopes.
|
|
|
|
|
|
|
|
|
|
Note that valid use, if the label being shadowed
|
|
|
|
|
comes from another scope in the same function,
|
|
|
|
|
requires calling declare_nonlocal_label right away. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
shadow_label (name)
|
|
|
|
|
tree name;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree decl = IDENTIFIER_LABEL_VALUE (name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (decl != 0)
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree dup;
|
1994-10-01 11:58:44 +01:00
|
|
|
|
|
|
|
|
|
/* Check to make sure that the label hasn't already been declared
|
|
|
|
|
at this label scope */
|
|
|
|
|
for (dup = named_labels; dup; dup = TREE_CHAIN (dup))
|
|
|
|
|
if (TREE_VALUE (dup) == decl)
|
|
|
|
|
{
|
2000-08-11 00:01:22 +02:00
|
|
|
|
error ("duplicate label declaration `%s'",
|
1994-10-01 11:58:44 +01:00
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
error_with_decl (TREE_VALUE (dup),
|
|
|
|
|
"this is a previous declaration");
|
|
|
|
|
/* Just use the previous declaration. */
|
|
|
|
|
return lookup_label (name);
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
|
|
|
|
|
IDENTIFIER_LABEL_VALUE (name) = decl = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return lookup_label (name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Define a label, specifying the location in the source file.
|
|
|
|
|
Return the LABEL_DECL node for the label, if the definition is valid.
|
|
|
|
|
Otherwise return 0. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
define_label (filename, line, name)
|
top level:
* Makefile.in (WARN_CFLAGS): Add -Wwrite-strings.
(tree.o): Depend on output.h.
* c-decl.c (pending_invalid_xref_file,
current_function_prototype_file): Constify.
(pushdecl): Constify a local char *.
(define_label): Constify filename parameter.
* c-lex.c (init_parse): Constify parameter and return value.
* c-typeck.c (c_expand_asm_operands): Constify filename parameter.
* c-tree.h: Update prototypes.
* c-parse.in: Constify filename member of %union, and if_stmt_file.
* c-parse.y, c-parse.c, c-parse.h, objc/objc-parse.y,
objc/objc-parse.c: Regenerate.
* dwarfout.c (dwarfout_init): Constify main_input_filename parameter.
* dwarfout.h: Update prototypes.
* expr.c (expand_expr): Constify a local char *.
* flags.h: Constify main_input_filename.
* function.c (expand_function_end): Constify filename parameter.
* genrecog.c (make_insn_sequence): Use a character array for
c_test_pos.
(main): Remove unused variables.
* input.h: Constify input_filename, main_input_filename, and
file_stack.name. Update prototypes.
* output.h: Declare first_global_object_name and
weak_global_object_name here, as const char *.
* stmt.c (expand_asm_operands): Constify filename parameter.
* toplev.c (compile_file, push_srcloc, debug_start_source_file):
Constify filename parameter.
(input_filename, main_input_filename): Constify.
* toplev.h: Update prototypes.
* tree.c: Include output.h. Don't declare
first_global_object_name or weak_global_object_name. Clean up string
bashing in get_file_function_name_long.
* tree.h (struct tree_decl): Constify filename member.
(input_filename): Constify.
Update prototypes.
* varasm.c (first_global_object_name, weak_global_object_name):
Constify.
(assemble_start_function, assemble_variable): Clean up string bashing.
* gcc.c: Constify all spec-related strings initialized,
transitively, from string constants. Constify all strings
and string variables related to multilibs.
(set_spec, read_specs): Cast argument to free to PTR.
(used_arg): Do not modify multilib_matches. Use strncmp plus
length comparison to compare multilib switches.
* genmultilib: Constify everything declared in multilib.h.
ch:
* ch-tree.h: Update prototypes. Remove prototypes for
functions declared elsewhere.
* decl.c (define_label): Constify filename parameter.
* grant.c (globalize_decl, set_default_grant_file): Constify
local char * variables. Don't declare
first_global_object_name or asm_out_file.
* lang.c (chill_real_input_filename): Constify.
* lex.c (init_parse): Constify parameter and return value.
* parse.c: Don't declare input_filename.
(ch_expand_asm_operands): Constify filename parameter.
(parse_multi_dimension_case_action): Constify local char *.
* satisfy.c (safe_satisfy_decl): Constify local char *.
cp:
* cp-tree.h: Constify tree_srcloc.filename, tinst_level.file,
and pending_inline.filename. Update prototypes.
* decl.c (define_label): Constify filename parameter.
* decl2.c (warn_if_unknown_interface): Constify local char *.
* input.c Constify input_source.filename. Don't declare
input_filename or lineno. Constify filename parameter to feed_input.
* lex.c (init_parse): Constify parameter and return value.
(cp_pragma_interface, cp_pragma_implementation): Constify
filename argument.
(reinit_parse_for_method, reinit_parse_for_block,
reinit_parse_for_expr, feed_defarg, handle_cp_pragma):
Constify local char *.
* pt.c: Don't declare lineno or input_filename.
(print_template_context, tsubst_friend_function, tsubst_decl,
tsubst, instantiate_decl): Constify local char *.
* semantics.c (expand_body): Constify local char *.
* tree.c (build_srcloc): Constify filename parameter.
* typeck.c (c_expand_asm_operands): Constify filename
parameter.
f:
* com.c (ffecom_subscript_check_): Constify array_name
parameter. Clean up string bashing.
(ffecom_arrayref_, ffecom_char_args_x_): Constify array_name
parameter.
(ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_,
ffecom_sym_transform_, ffecom_sym_transform_assign_): Constify
local char *.
(init_parse): Constify parameter and return value.
* lex.c: Include dwarfout.h instead of prototyping dwarfout_*
functions here.
(ffelex_file_pop_, ffelex_file_push_): Constify filename parameter.
(ffelex_hash_, ffelex_include_): Constify local char *.
* std.c (ffestd_exec_end): Constify local char *.
* where.c (ffewhere_file_new): Constify filename parameter.
* where.h: Update prototypes.
java:
* check_init.c (check_init): Constify local char *.
* class.c (push_class): Constify local char *.
* java_tree.h: Update prototypes.
* jcf-io.c (open_class): Constify filename parameter and
return value.
(find_class): Remove redundant string copy. Cast return from
open_class.
* jcf-parse.c (read_class, parse_class_file, yyparse):
Constify local char *.
* jcf-write.c (generate_bytecode_insns, generate_classfile):
Constify local char *.
* jcf.h (JCF): Constify filename and classname.
(JCF_FINISH): Cast args to FREE to char * when appropriate.
* lang.c (init_parse): Constify parameter and return value.
* lex.c (java_get_line_col): Constify filename parameter.
* parse.h: Constify parser_ctxt.filename. Update prototypes.
* parse.y (java_parser_context_suspend,
issue_warning_error_from_context, safe_layout_class): Constify
local char *.
* parse.c: Regenerate.
From-SVN: r33804
2000-05-09 21:56:01 +02:00
|
|
|
|
const char *filename;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int line;
|
|
|
|
|
tree name;
|
|
|
|
|
{
|
|
|
|
|
tree decl = lookup_label (name);
|
|
|
|
|
|
|
|
|
|
/* If label with this name is known from an outer context, shadow it. */
|
|
|
|
|
if (decl != 0 && DECL_CONTEXT (decl) != current_function_decl)
|
|
|
|
|
{
|
|
|
|
|
shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
|
|
|
|
|
IDENTIFIER_LABEL_VALUE (name) = 0;
|
|
|
|
|
decl = lookup_label (name);
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-21 16:54:28 +02:00
|
|
|
|
if (warn_traditional && !in_system_header && lookup_name (name))
|
2000-08-29 19:34:26 +02:00
|
|
|
|
warning_with_file_and_line (filename, line,
|
|
|
|
|
"traditional C lacks a separate namespace for labels, identifier `%s' conflicts",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (DECL_INITIAL (decl) != 0)
|
|
|
|
|
{
|
2000-08-29 19:34:26 +02:00
|
|
|
|
error_with_file_and_line (filename, line, "duplicate label `%s'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Mark label as having been defined. */
|
|
|
|
|
DECL_INITIAL (decl) = error_mark_node;
|
|
|
|
|
/* Say where in the source. */
|
|
|
|
|
DECL_SOURCE_FILE (decl) = filename;
|
|
|
|
|
DECL_SOURCE_LINE (decl) = line;
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the list of declarations of the current level.
|
|
|
|
|
Note that this list is in reverse order unless/until
|
|
|
|
|
you nreverse it; and when you do nreverse it, you must
|
|
|
|
|
store the result back using `storedecls' or you will lose. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
getdecls ()
|
|
|
|
|
{
|
|
|
|
|
return current_binding_level->names;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the list of type-tags (for structs, etc) of the current level. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
gettags ()
|
|
|
|
|
{
|
|
|
|
|
return current_binding_level->tags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Store the list of declarations of the current level.
|
|
|
|
|
This is done for the parameter declarations of a function being defined,
|
|
|
|
|
after they are modified in the light of any missing parameters. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
storedecls (decls)
|
|
|
|
|
tree decls;
|
|
|
|
|
{
|
|
|
|
|
current_binding_level->names = decls;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Similarly, store the list of tags of the current level. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
storetags (tags)
|
|
|
|
|
tree tags;
|
|
|
|
|
{
|
|
|
|
|
current_binding_level->tags = tags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given NAME, an IDENTIFIER_NODE,
|
|
|
|
|
return the structure (or union or enum) definition for that name.
|
|
|
|
|
Searches binding levels from BINDING_LEVEL up to the global level.
|
|
|
|
|
If THISLEVEL_ONLY is nonzero, searches only the specified context
|
|
|
|
|
(but skips any tag-transparent contexts to find one that is
|
|
|
|
|
meaningful for tags).
|
|
|
|
|
CODE says which kind of type the caller wants;
|
|
|
|
|
it is RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE.
|
|
|
|
|
If the wrong kind of type is found, an error is reported. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
lookup_tag (code, name, binding_level, thislevel_only)
|
|
|
|
|
enum tree_code code;
|
|
|
|
|
struct binding_level *binding_level;
|
|
|
|
|
tree name;
|
|
|
|
|
int thislevel_only;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct binding_level *level;
|
2001-01-31 11:24:40 +01:00
|
|
|
|
int thislevel = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
for (level = binding_level; level; level = level->level_chain)
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree tail;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_PURPOSE (tail) == name)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (TREE_VALUE (tail)) != code)
|
|
|
|
|
{
|
|
|
|
|
/* Definition isn't the kind we were looking for. */
|
|
|
|
|
pending_invalid_xref = name;
|
|
|
|
|
pending_invalid_xref_file = input_filename;
|
|
|
|
|
pending_invalid_xref_line = lineno;
|
2001-01-31 11:24:40 +01:00
|
|
|
|
/* If in the same binding level as a declaration as a tag
|
|
|
|
|
of a different type, this must not be allowed to
|
|
|
|
|
shadow that tag, so give the error immediately.
|
|
|
|
|
(For example, "struct foo; union foo;" is invalid.) */
|
|
|
|
|
if (thislevel)
|
|
|
|
|
pending_xref_error ();
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
return TREE_VALUE (tail);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-01-31 11:24:40 +01:00
|
|
|
|
if (! level->tag_transparent)
|
|
|
|
|
{
|
|
|
|
|
if (thislevel_only)
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
thislevel = 0;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print an error message now
|
|
|
|
|
for a recent invalid struct, union or enum cross reference.
|
|
|
|
|
We don't print them immediately because they are not invalid
|
|
|
|
|
when used in the `struct foo;' construct for shadowing. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pending_xref_error ()
|
|
|
|
|
{
|
|
|
|
|
if (pending_invalid_xref != 0)
|
|
|
|
|
error_with_file_and_line (pending_invalid_xref_file,
|
|
|
|
|
pending_invalid_xref_line,
|
|
|
|
|
"`%s' defined as wrong kind of tag",
|
|
|
|
|
IDENTIFIER_POINTER (pending_invalid_xref));
|
|
|
|
|
pending_invalid_xref = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a type, find the tag that was defined for it and return the tag name.
|
|
|
|
|
Otherwise return 0. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
lookup_tag_reverse (type)
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
struct binding_level *level;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
for (level = current_binding_level; level; level = level->level_chain)
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree tail;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_VALUE (tail) == type)
|
|
|
|
|
return TREE_PURPOSE (tail);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Look up NAME in the current binding level and its superiors
|
|
|
|
|
in the namespace of variables, functions and typedefs.
|
|
|
|
|
Return a ..._DECL node of some kind representing its definition,
|
|
|
|
|
or return 0 if it is undefined. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
lookup_name (name)
|
|
|
|
|
tree name;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree val;
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (current_binding_level != global_binding_level
|
|
|
|
|
&& IDENTIFIER_LOCAL_VALUE (name))
|
|
|
|
|
val = IDENTIFIER_LOCAL_VALUE (name);
|
|
|
|
|
else
|
|
|
|
|
val = IDENTIFIER_GLOBAL_VALUE (name);
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Similar to `lookup_name' but look only at current binding level. */
|
|
|
|
|
|
1993-04-05 08:59:02 +02:00
|
|
|
|
tree
|
1992-02-13 23:21:26 +01:00
|
|
|
|
lookup_name_current_level (name)
|
|
|
|
|
tree name;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree t;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (current_binding_level == global_binding_level)
|
|
|
|
|
return IDENTIFIER_GLOBAL_VALUE (name);
|
|
|
|
|
|
|
|
|
|
if (IDENTIFIER_LOCAL_VALUE (name) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (t = current_binding_level->names; t; t = TREE_CHAIN (t))
|
|
|
|
|
if (DECL_NAME (t) == name)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-06 23:28:22 +02:00
|
|
|
|
/* Mark ARG for GC. */
|
2000-04-18 20:14:10 +02:00
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
static void
|
1999-09-06 23:28:22 +02:00
|
|
|
|
mark_binding_level (arg)
|
|
|
|
|
void *arg;
|
|
|
|
|
{
|
|
|
|
|
struct binding_level *level = *(struct binding_level **) arg;
|
|
|
|
|
|
2000-04-18 20:14:10 +02:00
|
|
|
|
for (; level != 0; level = level->level_chain)
|
1999-09-06 23:28:22 +02:00
|
|
|
|
{
|
|
|
|
|
ggc_mark_tree (level->names);
|
|
|
|
|
ggc_mark_tree (level->tags);
|
|
|
|
|
ggc_mark_tree (level->shadowed);
|
|
|
|
|
ggc_mark_tree (level->blocks);
|
|
|
|
|
ggc_mark_tree (level->this_block);
|
|
|
|
|
ggc_mark_tree (level->parm_order);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Create the predefined scalar types of C,
|
1996-07-04 00:07:53 +02:00
|
|
|
|
and some nodes representing standard constants (0, 1, (void *) 0).
|
1992-02-13 23:21:26 +01:00
|
|
|
|
Initialize the global binding level.
|
|
|
|
|
Make definitions for built-in primitive functions. */
|
|
|
|
|
|
|
|
|
|
void
|
c-common.c: Include c-lex.h.
* c-common.c: Include c-lex.h.
(c_common_lang_init): Change prototype. Call init_c_lex and
init_pragma from here.
* c-common.h (c_common_lang_init): Change prototype.
* c-decl.c (init_decl_processing): Rename. Call c_parse_init.
* c-lang.c (c_init): Change prototype. Update.
(c_init_options): Update.
* c-lex.c (cpp_filename): Remove.
(init_c_lex): Update. Read the main file, and get the original
file name.
(yyparse): Finish the command line options.
* c-parse.in (c_parse_init): Call init_reswords here.
(init_parse): Remove.
* c-tree.h (c_init_decl_processing): New.
* cpphash.c (_cpp_init_hashtable): After initializing the hash
table, populate it.
* cppinit.c (read_original_filename, cpp_finish_options): New.
(cpp_create_reader): New prototype. Defer hash table initialization.
(cpp_start_read): Rename cpp_read_main_file. Initialize the
hash table. Get the original filename.
* cpplib.h (cpp_create_reader): Update.
(cpp_start_read): Remove.
(cpp_read_main_file, cpp_finish_options): New.
* cppmain.c (main, do_preprocessing): Update.
* langhooks.h (struct langhooks): Update init prototype.
* toplev.c (general_init, parse_options_and_default_flags,
process_options, lang_indpendent_init, lang_dependent_init,
init_asm_output): New; perform the bulk of initialization.
(compile_file): Move most of initialization to above functions.
(debug_hooks): Initialize statically.
(set_Wunused): Relocate.
(toplev_main): Move most of initialization to other init functions.
Have a clear logic flow.
* tree.h (init_parse, init_decl_processing): Remove.
ada:
* misc.c (gnat_init): Change prototype. Include the
functionality of the old init_parse and init_decl_processing.
(gnat_init_decl_processing): New prototype.
(init_parse): Remove.
* utils.c (init_decl_processing): Rename gnat_init_decl_processing.
cp: * cp-tree.h (init_reswords, cxx_init_decl_processing): New.
(cxx_init): Update prototype.
* decl.c (init_decl_processing): Rename. Move null node init
to its creation time.
* lex.c (cxx_init_options): Update.
(cxx_init): Combine with old init_parse; also call
cxx_init_decl_processing.
f: * com.c (ffecom_init_decl_processing): Renamed from
init_decl_processing.
(init_parse): Move contents to ffe_init.
(ffe_init): Update prototype.
java: * decl.c (init_decl_processing): Rename java_init_decl_processing.
* java-tree.h: New prototype.
* lang.c (java_init): Update prototype. Combine with old init_parse.
objc: * objc-act.c (objc_init): Update prototype, combine with old
init_parse.
(objc_init_options): Update.
From-SVN: r47046
2001-11-15 11:01:10 +01:00
|
|
|
|
c_init_decl_processing ()
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree endlink;
|
1999-07-20 12:41:10 +02:00
|
|
|
|
tree ptr_ftype_void, ptr_ftype_ptr;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
c-common.c: Include c-lex.h.
* c-common.c: Include c-lex.h.
(c_common_lang_init): Change prototype. Call init_c_lex and
init_pragma from here.
* c-common.h (c_common_lang_init): Change prototype.
* c-decl.c (init_decl_processing): Rename. Call c_parse_init.
* c-lang.c (c_init): Change prototype. Update.
(c_init_options): Update.
* c-lex.c (cpp_filename): Remove.
(init_c_lex): Update. Read the main file, and get the original
file name.
(yyparse): Finish the command line options.
* c-parse.in (c_parse_init): Call init_reswords here.
(init_parse): Remove.
* c-tree.h (c_init_decl_processing): New.
* cpphash.c (_cpp_init_hashtable): After initializing the hash
table, populate it.
* cppinit.c (read_original_filename, cpp_finish_options): New.
(cpp_create_reader): New prototype. Defer hash table initialization.
(cpp_start_read): Rename cpp_read_main_file. Initialize the
hash table. Get the original filename.
* cpplib.h (cpp_create_reader): Update.
(cpp_start_read): Remove.
(cpp_read_main_file, cpp_finish_options): New.
* cppmain.c (main, do_preprocessing): Update.
* langhooks.h (struct langhooks): Update init prototype.
* toplev.c (general_init, parse_options_and_default_flags,
process_options, lang_indpendent_init, lang_dependent_init,
init_asm_output): New; perform the bulk of initialization.
(compile_file): Move most of initialization to above functions.
(debug_hooks): Initialize statically.
(set_Wunused): Relocate.
(toplev_main): Move most of initialization to other init functions.
Have a clear logic flow.
* tree.h (init_parse, init_decl_processing): Remove.
ada:
* misc.c (gnat_init): Change prototype. Include the
functionality of the old init_parse and init_decl_processing.
(gnat_init_decl_processing): New prototype.
(init_parse): Remove.
* utils.c (init_decl_processing): Rename gnat_init_decl_processing.
cp: * cp-tree.h (init_reswords, cxx_init_decl_processing): New.
(cxx_init): Update prototype.
* decl.c (init_decl_processing): Rename. Move null node init
to its creation time.
* lex.c (cxx_init_options): Update.
(cxx_init): Combine with old init_parse; also call
cxx_init_decl_processing.
f: * com.c (ffecom_init_decl_processing): Renamed from
init_decl_processing.
(init_parse): Move contents to ffe_init.
(ffe_init): Update prototype.
java: * decl.c (init_decl_processing): Rename java_init_decl_processing.
* java-tree.h: New prototype.
* lang.c (java_init): Update prototype. Combine with old init_parse.
objc: * objc-act.c (objc_init): Update prototype, combine with old
init_parse.
(objc_init_options): Update.
From-SVN: r47046
2001-11-15 11:01:10 +01:00
|
|
|
|
/* Adds some ggc roots, and reserved words for c-parse.in. */
|
|
|
|
|
c_parse_init ();
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
current_function_decl = NULL;
|
|
|
|
|
named_labels = NULL;
|
|
|
|
|
current_binding_level = NULL_BINDING_LEVEL;
|
|
|
|
|
free_binding_level = NULL_BINDING_LEVEL;
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
|
|
|
|
/* Make the binding_level structure for global names. */
|
|
|
|
|
pushlevel (0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
global_binding_level = current_binding_level;
|
|
|
|
|
|
1999-09-10 12:36:02 +02:00
|
|
|
|
build_common_tree_nodes (flag_signed_char);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
c-common.c (SIZE_TYPE, WCHAR_TYPE): Define.
* c-common.c (SIZE_TYPE, WCHAR_TYPE): Define.
(flag_short_double, flag_short_wchar): Define.
(c_common_nodes_and_builtins): Create many tree nodes shared
between C and C++ here instead of in cp/decl.c and ...
* c-decl.c (init_decl_processing): ... here.
(SIZE_TYPE, WCHAR_TYPE): Don't define.
(flag_short_double, flag_short_wchar): Don't define.
(record_builtin_type): New function.
(build_void_list_node): New function.
* c-common.h (flag_short_double, flag_short_wchar,
record_builtin_type, build_void_list_node): Declare.
cp:
* decl.c (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE): Don't define.
(record_builtin_type): Make non-static.
(flag_short_double): Don't declare.
(init_decl_processing): Remove the creation of many tree nodes now
in c_common_nodes_and_builtins.
(build_void_list_node): New function.
* decl2.c (flag_short_double, flag_short_wchar): Don't define.
* cp-tree.h (flag_short_wchar): Don't declare.
From-SVN: r38695
2001-01-05 00:53:54 +01:00
|
|
|
|
c_common_nodes_and_builtins ();
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1995-01-17 22:43:40 +01:00
|
|
|
|
boolean_type_node = integer_type_node;
|
|
|
|
|
boolean_true_node = integer_one_node;
|
|
|
|
|
boolean_false_node = integer_zero_node;
|
|
|
|
|
|
2000-11-13 15:14:44 +01:00
|
|
|
|
/* With GCC, C99's _Bool is always of size 1. */
|
|
|
|
|
c_bool_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
|
|
|
|
|
TREE_SET_CODE (c_bool_type_node, BOOLEAN_TYPE);
|
|
|
|
|
TYPE_MAX_VALUE (c_bool_type_node) = build_int_2 (1, 0);
|
|
|
|
|
TREE_TYPE (TYPE_MAX_VALUE (c_bool_type_node)) = c_bool_type_node;
|
|
|
|
|
TYPE_PRECISION (c_bool_type_node) = 1;
|
|
|
|
|
pushdecl (build_decl (TYPE_DECL, get_identifier ("_Bool"),
|
|
|
|
|
c_bool_type_node));
|
|
|
|
|
c_bool_false_node = build_int_2 (0, 0);
|
|
|
|
|
TREE_TYPE (c_bool_false_node) = c_bool_type_node;
|
|
|
|
|
c_bool_true_node = build_int_2 (1, 0);
|
|
|
|
|
TREE_TYPE (c_bool_true_node) = c_bool_type_node;
|
|
|
|
|
|
1999-07-20 12:41:10 +02:00
|
|
|
|
endlink = void_list_node;
|
1997-09-10 20:00:28 +02:00
|
|
|
|
ptr_ftype_void = build_function_type (ptr_type_node, endlink);
|
|
|
|
|
ptr_ftype_ptr
|
|
|
|
|
= build_function_type (ptr_type_node,
|
|
|
|
|
tree_cons (NULL_TREE, ptr_type_node, endlink));
|
|
|
|
|
|
2000-05-18 19:53:04 +02:00
|
|
|
|
/* Types which are common to the fortran compiler and libf2c. When
|
2000-08-11 00:01:22 +02:00
|
|
|
|
changing these, you also need to be concerned with f/com.h. */
|
2000-05-18 19:53:04 +02:00
|
|
|
|
|
|
|
|
|
if (TYPE_PRECISION (float_type_node)
|
|
|
|
|
== TYPE_PRECISION (long_integer_type_node))
|
|
|
|
|
{
|
|
|
|
|
g77_integer_type_node = long_integer_type_node;
|
|
|
|
|
g77_uinteger_type_node = long_unsigned_type_node;
|
|
|
|
|
}
|
|
|
|
|
else if (TYPE_PRECISION (float_type_node)
|
|
|
|
|
== TYPE_PRECISION (integer_type_node))
|
|
|
|
|
{
|
|
|
|
|
g77_integer_type_node = integer_type_node;
|
|
|
|
|
g77_uinteger_type_node = unsigned_type_node;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
g77_integer_type_node = g77_uinteger_type_node = NULL_TREE;
|
|
|
|
|
|
|
|
|
|
if (g77_integer_type_node != NULL_TREE)
|
|
|
|
|
{
|
|
|
|
|
pushdecl (build_decl (TYPE_DECL, get_identifier ("__g77_integer"),
|
|
|
|
|
g77_integer_type_node));
|
|
|
|
|
pushdecl (build_decl (TYPE_DECL, get_identifier ("__g77_uinteger"),
|
|
|
|
|
g77_uinteger_type_node));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TYPE_PRECISION (float_type_node) * 2
|
|
|
|
|
== TYPE_PRECISION (long_integer_type_node))
|
|
|
|
|
{
|
|
|
|
|
g77_longint_type_node = long_integer_type_node;
|
|
|
|
|
g77_ulongint_type_node = long_unsigned_type_node;
|
|
|
|
|
}
|
|
|
|
|
else if (TYPE_PRECISION (float_type_node) * 2
|
|
|
|
|
== TYPE_PRECISION (long_long_integer_type_node))
|
|
|
|
|
{
|
|
|
|
|
g77_longint_type_node = long_long_integer_type_node;
|
|
|
|
|
g77_ulongint_type_node = long_long_unsigned_type_node;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
g77_longint_type_node = g77_ulongint_type_node = NULL_TREE;
|
|
|
|
|
|
|
|
|
|
if (g77_longint_type_node != NULL_TREE)
|
|
|
|
|
{
|
|
|
|
|
pushdecl (build_decl (TYPE_DECL, get_identifier ("__g77_longint"),
|
|
|
|
|
g77_longint_type_node));
|
|
|
|
|
pushdecl (build_decl (TYPE_DECL, get_identifier ("__g77_ulongint"),
|
|
|
|
|
g77_ulongint_type_node));
|
|
|
|
|
}
|
|
|
|
|
|
1995-01-17 22:43:40 +01:00
|
|
|
|
pedantic_lvalues = pedantic;
|
|
|
|
|
|
2000-03-08 12:21:28 +01:00
|
|
|
|
make_fname_decl = c_make_fname_decl;
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
start_fname_decls ();
|
1992-05-17 21:29:11 +02:00
|
|
|
|
|
1993-03-22 08:04:18 +01:00
|
|
|
|
incomplete_decl_finalize_hook = finish_incomplete_decl;
|
1998-06-25 17:14:41 +02:00
|
|
|
|
|
1999-09-06 23:28:22 +02:00
|
|
|
|
/* Record our roots. */
|
|
|
|
|
|
|
|
|
|
ggc_add_tree_root (c_global_trees, CTI_MAX);
|
2000-09-17 09:38:23 +02:00
|
|
|
|
ggc_add_root (&c_stmt_tree, 1, sizeof c_stmt_tree, mark_stmt_tree);
|
|
|
|
|
ggc_add_tree_root (&c_scope_stmt_stack, 1);
|
1999-09-06 23:28:22 +02:00
|
|
|
|
ggc_add_tree_root (&named_labels, 1);
|
|
|
|
|
ggc_add_tree_root (&shadowed_labels, 1);
|
|
|
|
|
ggc_add_root (¤t_binding_level, 1, sizeof current_binding_level,
|
|
|
|
|
mark_binding_level);
|
|
|
|
|
ggc_add_root (&label_level_chain, 1, sizeof label_level_chain,
|
|
|
|
|
mark_binding_level);
|
|
|
|
|
ggc_add_tree_root (&static_ctors, 1);
|
|
|
|
|
ggc_add_tree_root (&static_dtors, 1);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-03-08 12:21:28 +01:00
|
|
|
|
/* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the
|
|
|
|
|
decl, NAME is the initialization string and TYPE_DEP indicates whether
|
|
|
|
|
NAME depended on the type of the function. As we don't yet implement
|
|
|
|
|
delayed emission of static data, we mark the decl as emitted
|
|
|
|
|
so it is not placed in the output. Anything using it must therefore pull
|
|
|
|
|
out the STRING_CST initializer directly. This does mean that these names
|
top level:
* c-common.c (declare_function_name): Use func_id_node,
function_id_node, and pretty_function_id_node. Do not make
__func__ visible at file scope.
* c-common.h (c_tree_index): Add CTI_FUNCTION_ID,
CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID.
(function_id_node, pretty_function_id_node, func_id_node): New
macros.
* c-decl.c (init_decl_processing): Initialize function_id_node,
pretty_function_id_node, and func_id_node.
(c_make_fname_decl): Correct comment.
* tree.h (struct tree_identifier): Constify pointer member.
* c-decl.c (pushdecl, implicit_decl_warning): Constify a char *.
* c-pragma.h (struct weak_syms): Constify name and value members.
(add_weak): Constify arguments.
* calls.c (special_function_p): Constify a char *.
(expand_call): Remove variable which is initialized and then
never used.
* dependence.c (struct def_use, struct induction, struct subscript):
Constify 'variable' member.
(get_low_bound, have_induction_variable): Constify char * argument.
(find_induction_variable): Add braces to avoid dangling else.
(classify_dependence): Constify char * arrays.
* profile.c (output_func_start_profiler): Constify a char *.
* stor-layout.c (finalize_record_size): Constify a char *.
* tree.c (is_attribute_p): Constify a char *.
* varasm.c (add_weak, remove_from_pending_weak_list): Constify argument.
* varasm.c (make_function_rtl, make_decl_rtl): Rearrange code
for comprehensibility. Do not call get_identifier if we did
not change the DECL_ASSEMBLER_NAME of the decl. Use alloca to
create temporary string constants, not ggc_alloc_string. No
need to copy result of ASM_FORMAT_PRIVATE_NAME. Use const
char * to hold IDENTIFIER_POINTERs.
ch:
* inout.c (add_enum_to_list): Use DECL_NAME directly, don't get
its IDENTIFIER_POINTER and immediately call get_identifier on it.
* lex.c (yywrap): Constify a char *.
cp:
* class.c (build_secondary_vtable): Constify a char *.
* decl.c (init_decl_processing): Initialize function_id_node,
pretty_function_id_node, and func_id_node.
* input.c (struct input_source): Constify 'str'.
(feed_input): Constify first argument.
* mangle.c (write_identifier): Constify argument.
* pt.c (mangle_class_name_for_template): Constify argument.
f:
* ansify.c: Use #line, not # <number>.
java:
* jcf-parse.c (set_source_filename): Constify a char *.
* jcf-write.c (append_innerclasses_attribute,
make_class_file_name): Constify a char *. Don't recycle a
variable for an unrelated purpose.
* parse.y: (build_alias_initializer_parameter_list): Constify a char *.
(breakdown_qualified): Do not modify IDENTIFIER_POINTER strings.
From-SVN: r36055
2000-08-29 23:39:49 +02:00
|
|
|
|
are string merging candidates, which is wrong for C99's __func__. FIXME. */
|
2000-03-08 12:21:28 +01:00
|
|
|
|
|
|
|
|
|
static tree
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
c_make_fname_decl (id, type_dep)
|
2000-03-08 12:21:28 +01:00
|
|
|
|
tree id;
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
int type_dep;
|
2000-03-08 12:21:28 +01:00
|
|
|
|
{
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
const char *name = fname_as_string (type_dep);
|
2000-03-08 12:21:28 +01:00
|
|
|
|
tree decl, type, init;
|
|
|
|
|
size_t length = strlen (name);
|
|
|
|
|
|
|
|
|
|
type = build_array_type
|
|
|
|
|
(build_qualified_type (char_type_node, TYPE_QUAL_CONST),
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
build_index_type (size_int (length)));
|
2000-03-08 12:21:28 +01:00
|
|
|
|
|
|
|
|
|
decl = build_decl (VAR_DECL, id, type);
|
2001-08-01 19:57:27 +02:00
|
|
|
|
/* We don't push the decl, so have to set its context here. */
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
DECL_CONTEXT (decl) = current_function_decl;
|
|
|
|
|
|
2000-03-08 12:21:28 +01:00
|
|
|
|
TREE_STATIC (decl) = 1;
|
|
|
|
|
TREE_READONLY (decl) = 1;
|
|
|
|
|
DECL_ARTIFICIAL (decl) = 1;
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
|
2000-03-08 12:21:28 +01:00
|
|
|
|
init = build_string (length + 1, name);
|
|
|
|
|
TREE_TYPE (init) = type;
|
|
|
|
|
DECL_INITIAL (decl) = init;
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
|
|
|
|
|
TREE_USED (decl) = 1;
|
|
|
|
|
|
|
|
|
|
finish_decl (decl, init, NULL_TREE);
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
2000-03-08 12:21:28 +01:00
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Return a definition for a builtin function named NAME and whose data type
|
|
|
|
|
is TYPE. TYPE should be a function type with argument types.
|
|
|
|
|
FUNCTION_CODE tells later passes how to compile calls to this function.
|
|
|
|
|
See tree.h for its possible values.
|
|
|
|
|
|
|
|
|
|
If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
|
|
|
|
|
the name to be called if we can't opencode the function. */
|
|
|
|
|
|
1992-03-23 03:07:53 +01:00
|
|
|
|
tree
|
1999-09-24 12:07:04 +02:00
|
|
|
|
builtin_function (name, type, function_code, class, library_name)
|
bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.h (bitmap_print): Likewise.
* c-decl.c (builtin_function, grokdeclarator, grokfield): Likewise.
* c-lang.c (build_objc_string): Likewise.
* c-lex.c (yyerror, extend_token_buffer): Likewise. Don't include
limits.h or ctype.h. Remove unused variable `p'.
* c-lex.h (yyerror): Qualify a char* with the `const' keyword.
* c-pragma.c (handle_pragma_token): Likewise.
* c-pragma.h (handle_pragma_token): Likewise.
* c-tree.h (build_objc_string, builtin_function, grokfield,
build_indirect_ref, lvalue_or_else, readonly_warning, error_init,
pedwarn_init): Likewise.
* c-typeck.c (convert_for_assignment, warn_for_assignment,
push_string, warning_init, incomplete_type_error,
build_indirect_ref, lvalue_or_else, readonly_warning,
build_c_cast, spelling, push_member_name, print_spelling,
error_init, pedwarn_init, start_init): Likewise.
* objc/objc-act.c (build_objc_string): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* tree.h (lvalue_or_else, print_node, print_node_brief): Likewise.
From-SVN: r25296
1999-02-18 21:38:48 +01:00
|
|
|
|
const char *name;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
tree type;
|
1999-09-24 12:07:04 +02:00
|
|
|
|
int function_code;
|
|
|
|
|
enum built_in_class class;
|
bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.h (bitmap_print): Likewise.
* c-decl.c (builtin_function, grokdeclarator, grokfield): Likewise.
* c-lang.c (build_objc_string): Likewise.
* c-lex.c (yyerror, extend_token_buffer): Likewise. Don't include
limits.h or ctype.h. Remove unused variable `p'.
* c-lex.h (yyerror): Qualify a char* with the `const' keyword.
* c-pragma.c (handle_pragma_token): Likewise.
* c-pragma.h (handle_pragma_token): Likewise.
* c-tree.h (build_objc_string, builtin_function, grokfield,
build_indirect_ref, lvalue_or_else, readonly_warning, error_init,
pedwarn_init): Likewise.
* c-typeck.c (convert_for_assignment, warn_for_assignment,
push_string, warning_init, incomplete_type_error,
build_indirect_ref, lvalue_or_else, readonly_warning,
build_c_cast, spelling, push_member_name, print_spelling,
error_init, pedwarn_init, start_init): Likewise.
* objc/objc-act.c (build_objc_string): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* tree.h (lvalue_or_else, print_node, print_node_brief): Likewise.
From-SVN: r25296
1999-02-18 21:38:48 +01:00
|
|
|
|
const char *library_name;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
|
1992-07-12 04:56:45 +02:00
|
|
|
|
DECL_EXTERNAL (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TREE_PUBLIC (decl) = 1;
|
1992-05-04 05:37:06 +02:00
|
|
|
|
/* If -traditional, permit redefining a builtin function any way you like.
|
|
|
|
|
(Though really, if the program redefines these functions,
|
|
|
|
|
it probably won't work right unless compiled with -fno-builtin.) */
|
|
|
|
|
if (flag_traditional && name[0] != '_')
|
|
|
|
|
DECL_BUILT_IN_NONANSI (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (library_name)
|
Compute DECL_ASSEMBLER_NAME lazily.
* tree.h (DECL_ASSEMBLER_NAME): Compute it lazily.
(DECL_ASSEMBLER_NAME_SET_P): New macro.
(SET_DECL_ASSEMBLER_NAME): Likewise.
(COPY_DECL_ASSEMBLER_NAME): Likewise.
(set_decl_assembler_name): Declare.
(lang_set_decl_assembler_name): Likewise.
* tree.c (lang_set_decl_assembler_name): New variab.e
(set_decl_assembler_name): New function.
(init_obstacks): Set lang_set_decl_assembler_name.
(build_decl): Don't set DECL_ASSEMBLER_NAME.
* c-decl.c (duplicate_decls): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(builtin_function): Likewise.
(finish_decl): Likewise.
* dbxout.c (dbxout_type_methods): Likewise.
* ggc-common.c (ggc_mark_trees): Likewise.
* profile.c (output_func_start_profiler): Likewise.
* varasm.c (make_decl_rtl): Likewise.
* class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(add_method): Remove optimization involving comparison of
DECL_ASSEMBLER_NAME.
(build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(check_methods): Likewise.
(build_clone): Likewise.
(built_vtt): Likewise.
* cp-tree.h (DECL_NEEDED_P): Likewise.
* decl.c (pushtag): Likewise.
(duplicate_decls): Likewise.
(pushdecl): Likewise.
(builtin_function): Likewise.
(build_library_fn_1): Set DECL_LANGUAGE for library functions.
(build_cp_library_fn): Likewise.
(maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(make_rtl_for_nonlocal_decl): Likewise.
(cp_finish_decl): Likewise.
(grokfndecl): Likewise.
(grokvardecl): Likewise.
(grokdeclarator): Likewise.
(start_function): Likewise.
(cp_missing_return_ok_p): Likewise.
* decl2.c (grokclassfn): Likewise.
(check_classfn): Likewise.
(finish_static_data_member_decl): Likewise.
(grokfield): Likewise.
* error.c (GLOBAL_IORD_P): Remove.
(dump_global_iord): Improve output.
(dump_decl): Avoid using DECL_ASSEMBLER_NAME.
* except.c (nothrow_libfn_p): Summarily reject any function not in
namespace-scope.
* init.c (build_java_class_ref): Don't explicitly set
DECL_ASSEMBLER_NAME after calling mangle_decl.
* mangle.c (mangle_decl_string): Handle extern "C" functions.
(mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl.
* method.c (set_mangled_name_for_decl): Don't explicitly set
DECL_ASSEMBLER_NAME after calling mangle_decl.
(make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and
IDENTIFIER_GLOBAL_VALUE for the thunk.
* pt.c (set_mangled_name_for_template_decl): Remove.
(check_explicit_specialization): Don't use it.
(looup_template_class): Don't set DECL_ASSEMBLER_NAME.
(tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME.
* rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(tinfo_base_init): Likewise.
(create_real_tinfo_var): Likewise.
* search.c (looup_field_1): Likewise.
* semantics.c (finish_named_return_value): Likewise.
* tree.c (init_tree): Set lang_set_decl_assembler_name.
* com.c (builtin_function): Use SET_DECL_ASSEMBLER_NAME.
* class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME.
(layout_class): Likewise.
(layout_class_method): Likewise.
(emit_register_classes): Likewise.
* decl.c (builtin_function): Likewise.
(give_name_to_locals): Likewise.
From-SVN: r40642
2001-03-20 00:50:04 +01:00
|
|
|
|
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
|
2001-05-01 14:11:35 +02:00
|
|
|
|
make_decl_rtl (decl, NULL);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
pushdecl (decl);
|
1999-09-24 12:07:04 +02:00
|
|
|
|
DECL_BUILT_IN_CLASS (decl) = class;
|
|
|
|
|
DECL_FUNCTION_CODE (decl) = function_code;
|
|
|
|
|
|
1992-06-25 12:53:19 +02:00
|
|
|
|
/* Warn if a function in the namespace for users
|
|
|
|
|
is used without an occasion to consider it declared. */
|
|
|
|
|
if (name[0] != '_' || name[1] != '_')
|
|
|
|
|
C_DECL_ANTICIPATED (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-10-02 09:12:25 +02:00
|
|
|
|
/* Possibly apply some default attributes to this built-in function. */
|
|
|
|
|
decl_attributes (&decl, NULL_TREE, 0);
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return decl;
|
|
|
|
|
}
|
2001-10-02 09:12:25 +02:00
|
|
|
|
|
|
|
|
|
/* Apply default attributes to a function, if a system function with default
|
|
|
|
|
attributes. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
insert_default_attributes (decl)
|
|
|
|
|
tree decl;
|
|
|
|
|
{
|
|
|
|
|
if (!TREE_PUBLIC (decl))
|
|
|
|
|
return;
|
|
|
|
|
c_common_insert_default_attributes (decl);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Called when a declaration is seen that contains no names to declare.
|
|
|
|
|
If its type is a reference to a structure, union or enum inherited
|
|
|
|
|
from a containing scope, shadow that tag name for the current scope
|
|
|
|
|
with a forward reference.
|
|
|
|
|
If its type defines a new named structure or union
|
|
|
|
|
or defines an enum, it is valid but we need not do anything here.
|
|
|
|
|
Otherwise, it is an error. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
shadow_tag (declspecs)
|
|
|
|
|
tree declspecs;
|
1992-07-25 10:06:54 +02:00
|
|
|
|
{
|
|
|
|
|
shadow_tag_warned (declspecs, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
shadow_tag_warned (declspecs, warned)
|
|
|
|
|
tree declspecs;
|
|
|
|
|
int warned;
|
1993-04-24 01:27:20 +02:00
|
|
|
|
/* 1 => we have done a pedwarn. 2 => we have done a warning, but
|
|
|
|
|
no pedwarn. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
int found_tag = 0;
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree link;
|
1998-02-18 11:38:57 +01:00
|
|
|
|
tree specs, attrs;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
pending_invalid_xref = 0;
|
|
|
|
|
|
1998-02-18 11:38:57 +01:00
|
|
|
|
/* Remove the attributes from declspecs, since they will confuse the
|
|
|
|
|
following code. */
|
|
|
|
|
split_specs_attrs (declspecs, &specs, &attrs);
|
|
|
|
|
|
1998-06-15 15:22:59 +02:00
|
|
|
|
for (link = specs; link; link = TREE_CHAIN (link))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree value = TREE_VALUE (link);
|
|
|
|
|
enum tree_code code = TREE_CODE (value);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE)
|
|
|
|
|
/* Used to test also that TYPE_SIZE (value) != 0.
|
|
|
|
|
That caused warning for `struct foo;' at top level in the file. */
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree name = lookup_tag_reverse (value);
|
|
|
|
|
tree t;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
found_tag++;
|
|
|
|
|
|
|
|
|
|
if (name == 0)
|
|
|
|
|
{
|
1993-04-24 01:27:20 +02:00
|
|
|
|
if (warned != 1 && code != ENUMERAL_TYPE)
|
|
|
|
|
/* Empty unnamed enum OK */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
pedwarn ("unnamed struct/union that defines no instances");
|
|
|
|
|
warned = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
t = lookup_tag (code, name, current_binding_level, 1);
|
|
|
|
|
|
|
|
|
|
if (t == 0)
|
|
|
|
|
{
|
|
|
|
|
t = make_node (code);
|
|
|
|
|
pushtag (name, t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1995-05-20 13:04:26 +02:00
|
|
|
|
if (!warned && ! in_system_header)
|
1993-04-24 01:27:20 +02:00
|
|
|
|
{
|
|
|
|
|
warning ("useless keyword or type name in empty declaration");
|
|
|
|
|
warned = 2;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1993-04-24 01:27:20 +02:00
|
|
|
|
if (found_tag > 1)
|
|
|
|
|
error ("two types specified in one empty declaration");
|
|
|
|
|
|
|
|
|
|
if (warned != 1)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
if (found_tag == 0)
|
|
|
|
|
pedwarn ("empty declaration");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-25 13:12:47 +02:00
|
|
|
|
/* Construct an array declarator. EXPR is the expression inside [], or
|
|
|
|
|
NULL_TREE. QUALS are the type qualifiers inside the [] (to be applied
|
|
|
|
|
to the pointer to which a parameter array is converted). STATIC_P is
|
|
|
|
|
non-zero if "static" is inside the [], zero otherwise. VLA_UNSPEC_P
|
|
|
|
|
is non-zero is the array is [*], a VLA of unspecified length which is
|
|
|
|
|
nevertheless a complete type (not currently implemented by GCC),
|
|
|
|
|
zero otherwise. The declarator is constructed as an ARRAY_REF
|
|
|
|
|
(to be decoded by grokdeclarator), whose operand 0 is what's on the
|
|
|
|
|
left of the [] (filled by in set_array_declarator_type) and operand 1
|
|
|
|
|
is the expression inside; whose TREE_TYPE is the type qualifiers and
|
|
|
|
|
which has TREE_STATIC set if "static" is used. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
build_array_declarator (expr, quals, static_p, vla_unspec_p)
|
|
|
|
|
tree expr;
|
|
|
|
|
tree quals;
|
|
|
|
|
int static_p;
|
|
|
|
|
int vla_unspec_p;
|
|
|
|
|
{
|
|
|
|
|
tree decl;
|
|
|
|
|
decl = build_nt (ARRAY_REF, NULL_TREE, expr);
|
|
|
|
|
TREE_TYPE (decl) = quals;
|
|
|
|
|
TREE_STATIC (decl) = (static_p ? 1 : 0);
|
|
|
|
|
if (pedantic && !flag_isoc99)
|
|
|
|
|
{
|
|
|
|
|
if (static_p || quals != NULL_TREE)
|
|
|
|
|
pedwarn ("ISO C89 does not support `static' or type qualifiers in parameter array declarators");
|
|
|
|
|
if (vla_unspec_p)
|
|
|
|
|
pedwarn ("ISO C89 does not support `[*]' array declarators");
|
|
|
|
|
}
|
|
|
|
|
if (vla_unspec_p)
|
|
|
|
|
warning ("GCC does not yet properly implement `[*]' array declarators");
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set the type of an array declarator. DECL is the declarator, as
|
|
|
|
|
constructed by build_array_declarator; TYPE is what appears on the left
|
|
|
|
|
of the [] and goes in operand 0. ABSTRACT_P is non-zero if it is an
|
|
|
|
|
abstract declarator, zero otherwise; this is used to reject static and
|
|
|
|
|
type qualifiers in abstract declarators, where they are not in the
|
|
|
|
|
C99 grammar. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
set_array_declarator_type (decl, type, abstract_p)
|
|
|
|
|
tree decl;
|
|
|
|
|
tree type;
|
|
|
|
|
int abstract_p;
|
|
|
|
|
{
|
|
|
|
|
TREE_OPERAND (decl, 0) = type;
|
|
|
|
|
if (abstract_p && (TREE_TYPE (decl) != NULL_TREE || TREE_STATIC (decl)))
|
|
|
|
|
error ("static or type qualifiers in abstract declarator");
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Decode a "typename", such as "int **", returning a ..._TYPE node. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
groktypename (typename)
|
|
|
|
|
tree typename;
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (typename) != TREE_LIST)
|
|
|
|
|
return typename;
|
|
|
|
|
return grokdeclarator (TREE_VALUE (typename),
|
|
|
|
|
TREE_PURPOSE (typename),
|
|
|
|
|
TYPENAME, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a PARM_DECL node for a given pair of specs and declarator. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
groktypename_in_parm_context (typename)
|
|
|
|
|
tree typename;
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (typename) != TREE_LIST)
|
|
|
|
|
return typename;
|
|
|
|
|
return grokdeclarator (TREE_VALUE (typename),
|
|
|
|
|
TREE_PURPOSE (typename),
|
|
|
|
|
PARM, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Decode a declarator in an ordinary declaration or data definition.
|
|
|
|
|
This is called as soon as the type information and variable name
|
|
|
|
|
have been parsed, before parsing the initializer if any.
|
|
|
|
|
Here we create the ..._DECL node, fill in its type,
|
|
|
|
|
and put it on the list of decls for the current context.
|
|
|
|
|
The ..._DECL node is returned as the value.
|
|
|
|
|
|
|
|
|
|
Exception: for arrays where the length is not specified,
|
|
|
|
|
the type is left null, to be filled in by `finish_decl'.
|
|
|
|
|
|
|
|
|
|
Function definitions do not come here; they go to start_function
|
|
|
|
|
instead. However, external and forward declarations of functions
|
|
|
|
|
do go through here. Structure field declarations are done by
|
|
|
|
|
grokfield and not through here. */
|
|
|
|
|
|
|
|
|
|
tree
|
c-common.c (decl_attributes): Only take a single attributes parameter.
* c-common.c (decl_attributes): Only take a single attributes
parameter.
* c-common.h (decl_attributes): Update prototype.
* c-decl.c (start_decl, start_function): Only take a single
attributes parameter. Update calls to decl_attributes.
(finish_struct, finish_enum): Update calls to decl_attributes.
(push_parm_decl): Expect unified list of attributes. Update call
to decl_attributes.
* c-parse.in (fndef, initdcl, notype_initdcl, nested_function,
notype_nested_function, component_declarator,
component_notype_declarator, label): Update calls to
decl_attributes.
(absdcl_maybe_attribute, parm, firstparm, myparm): Unify attribute
lists that are passed to push_parm_decl.
* c-tree.h (start_function, start_decl): Update prototypes.
* config/sh/sh-protos.h, config/sh/sh.c
(sh_pragma_insert_attributes): Only take a single attributes
parameter.
* config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Likewise.
* doc/tm.texi (INSERT_ATTRIBUTES): Update.
* objc/objc-act.c (define_decl, generate_objc_symtab_decl,
build_module_descriptor, generate_static_references,
generate_strings, build_selector_translation_table,
generate_descriptor_table, generate_protocols,
generate_ivars_list, generate_dispatch_table,
generate_protocol_list, generate_category,
generate_shared_structures, really_start_method, add_objc_decls,
generate_classref_translation_entry): Update calls to start_decl
and start_function.
(build_tmp_function_decl, start_method_def): Unify attribute lists
that are passed to push_parm_decl.
cp:
* decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update
calls to decl_attributes.
testsuite:
* gcc.c-torture/compile/20010701-1.c,
g++.old-deja/g++.ext/attrib6.C: New tests.
From-SVN: r43850
2001-07-08 21:58:19 +02:00
|
|
|
|
start_decl (declarator, declspecs, initialized, attributes)
|
1993-01-07 23:31:22 +01:00
|
|
|
|
tree declarator, declspecs;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int initialized;
|
c-common.c (decl_attributes): Only take a single attributes parameter.
* c-common.c (decl_attributes): Only take a single attributes
parameter.
* c-common.h (decl_attributes): Update prototype.
* c-decl.c (start_decl, start_function): Only take a single
attributes parameter. Update calls to decl_attributes.
(finish_struct, finish_enum): Update calls to decl_attributes.
(push_parm_decl): Expect unified list of attributes. Update call
to decl_attributes.
* c-parse.in (fndef, initdcl, notype_initdcl, nested_function,
notype_nested_function, component_declarator,
component_notype_declarator, label): Update calls to
decl_attributes.
(absdcl_maybe_attribute, parm, firstparm, myparm): Unify attribute
lists that are passed to push_parm_decl.
* c-tree.h (start_function, start_decl): Update prototypes.
* config/sh/sh-protos.h, config/sh/sh.c
(sh_pragma_insert_attributes): Only take a single attributes
parameter.
* config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Likewise.
* doc/tm.texi (INSERT_ATTRIBUTES): Update.
* objc/objc-act.c (define_decl, generate_objc_symtab_decl,
build_module_descriptor, generate_static_references,
generate_strings, build_selector_translation_table,
generate_descriptor_table, generate_protocols,
generate_ivars_list, generate_dispatch_table,
generate_protocol_list, generate_category,
generate_shared_structures, really_start_method, add_objc_decls,
generate_classref_translation_entry): Update calls to start_decl
and start_function.
(build_tmp_function_decl, start_method_def): Unify attribute lists
that are passed to push_parm_decl.
cp:
* decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update
calls to decl_attributes.
testsuite:
* gcc.c-torture/compile/20010701-1.c,
g++.old-deja/g++.ext/attrib6.C: New tests.
From-SVN: r43850
2001-07-08 21:58:19 +02:00
|
|
|
|
tree attributes;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
c-common.c (decl_attributes): Take a pointer to the node to which attributes are to be attached...
* c-common.c (decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument.
* c-common.h (enum attribute_flags): New.
(decl_attributes): Update prototype.
* c-decl.c (start_decl, push_parm_decl, finish_struct,
finish_enum, start_function): Update calls to decl_attributes.
* c-parse.in (component_declarator, component_notype_declarator,
label): Update calls to decl_attributes.
cp:
* decl2.c (cplus_decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument. Update
call to decl_attributes.
(grokfield): Update call to decl_attributes.
* class.c (finish_struct): Update call to cplus_decl_attributes.
* cp-tree.h (cplus_decl_attributes): Update prototype.
* decl.c (start_decl, grokdeclarator, start_function): Update
calls to decl_attributes and cplus_decl_attributes.
* friend.c (do_friend): Update call to cplus_decl_attributes.
* parse.y (parse_bitfield): Update call to cplus_decl_attributes.
From-SVN: r43995
2001-07-13 22:40:43 +02:00
|
|
|
|
tree decl = grokdeclarator (declarator, declspecs,
|
|
|
|
|
NORMAL, initialized);
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree tem;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL
|
2000-08-24 22:09:27 +02:00
|
|
|
|
&& MAIN_NAME_P (DECL_NAME (decl)))
|
1997-01-19 21:04:35 +01:00
|
|
|
|
warning_with_decl (decl, "`%s' is usually a function");
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (initialized)
|
|
|
|
|
/* Is it valid for this decl to have an initializer at all?
|
|
|
|
|
If not, set INITIALIZED to zero, which will indirectly
|
|
|
|
|
tell `finish_decl' to ignore the initializer once it is parsed. */
|
|
|
|
|
switch (TREE_CODE (decl))
|
|
|
|
|
{
|
|
|
|
|
case TYPE_DECL:
|
|
|
|
|
/* typedef foo = bar means give foo the same type as bar.
|
|
|
|
|
We haven't parsed bar yet, so `finish_decl' will fix that up.
|
|
|
|
|
Any other case of an initialization in a TYPE_DECL is an error. */
|
|
|
|
|
if (pedantic || list_length (declspecs) > 1)
|
|
|
|
|
{
|
|
|
|
|
error ("typedef `%s' is initialized",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (decl)));
|
|
|
|
|
initialized = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FUNCTION_DECL:
|
|
|
|
|
error ("function `%s' is initialized like a variable",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (decl)));
|
|
|
|
|
initialized = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PARM_DECL:
|
|
|
|
|
/* DECL_INITIAL in a PARM_DECL is really DECL_ARG_TYPE. */
|
|
|
|
|
error ("parameter `%s' is initialized",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (decl)));
|
|
|
|
|
initialized = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
/* Don't allow initializations for incomplete types
|
|
|
|
|
except for arrays which might be completed by the initialization. */
|
2000-10-20 02:58:35 +02:00
|
|
|
|
|
|
|
|
|
/* This can happen if the array size is an undefined macro. We already
|
|
|
|
|
gave a warning, so we don't need another one. */
|
|
|
|
|
if (TREE_TYPE (decl) == error_mark_node)
|
|
|
|
|
initialized = 0;
|
|
|
|
|
else if (COMPLETE_TYPE_P (TREE_TYPE (decl)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* A complete type is ok if size is fixed. */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (TYPE_SIZE (TREE_TYPE (decl))) != INTEGER_CST
|
|
|
|
|
|| C_DECL_VARIABLE_SIZE (decl))
|
|
|
|
|
{
|
|
|
|
|
error ("variable-sized object may not be initialized");
|
|
|
|
|
initialized = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE)
|
|
|
|
|
{
|
|
|
|
|
error ("variable `%s' has initializer but incomplete type",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (decl)));
|
|
|
|
|
initialized = 0;
|
|
|
|
|
}
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
else if (!COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error ("elements of array `%s' have incomplete type",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (decl)));
|
|
|
|
|
initialized = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (initialized)
|
|
|
|
|
{
|
2000-08-11 00:01:22 +02:00
|
|
|
|
#if 0
|
|
|
|
|
/* Seems redundant with grokdeclarator. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (current_binding_level != global_binding_level
|
1992-07-12 04:56:45 +02:00
|
|
|
|
&& DECL_EXTERNAL (decl)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TREE_CODE (decl) != FUNCTION_DECL)
|
|
|
|
|
warning ("declaration of `%s' has `extern' and is initialized",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (decl)));
|
|
|
|
|
#endif
|
1992-07-12 04:56:45 +02:00
|
|
|
|
DECL_EXTERNAL (decl) = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (current_binding_level == global_binding_level)
|
|
|
|
|
TREE_STATIC (decl) = 1;
|
|
|
|
|
|
|
|
|
|
/* Tell `pushdecl' this is an initialized decl
|
|
|
|
|
even though we don't yet have the initializer expression.
|
|
|
|
|
Also tell `finish_decl' it may store the real initializer. */
|
|
|
|
|
DECL_INITIAL (decl) = error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If this is a function declaration, write a record describing it to the
|
|
|
|
|
prototypes file (if requested). */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (decl) == FUNCTION_DECL)
|
|
|
|
|
gen_aux_info_record (decl, 0, 0, TYPE_ARG_TYPES (TREE_TYPE (decl)) != 0);
|
|
|
|
|
|
1996-05-06 20:36:48 +02:00
|
|
|
|
/* ANSI specifies that a tentative definition which is not merged with
|
|
|
|
|
a non-tentative definition behaves exactly like a definition with an
|
|
|
|
|
initializer equal to zero. (Section 3.7.2)
|
|
|
|
|
-fno-common gives strict ANSI behavior. Usually you don't want it.
|
|
|
|
|
This matters only for variables with external linkage. */
|
1996-06-05 01:42:33 +02:00
|
|
|
|
if (! flag_no_common || ! TREE_PUBLIC (decl))
|
1996-05-06 20:36:48 +02:00
|
|
|
|
DECL_COMMON (decl) = 1;
|
1995-06-07 00:39:24 +02:00
|
|
|
|
|
1995-04-25 22:06:42 +02:00
|
|
|
|
/* Set attributes here so if duplicate decl, will have proper attributes. */
|
c-common.c (decl_attributes): Take a pointer to the node to which attributes are to be attached...
* c-common.c (decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument.
* c-common.h (enum attribute_flags): New.
(decl_attributes): Update prototype.
* c-decl.c (start_decl, push_parm_decl, finish_struct,
finish_enum, start_function): Update calls to decl_attributes.
* c-parse.in (component_declarator, component_notype_declarator,
label): Update calls to decl_attributes.
cp:
* decl2.c (cplus_decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument. Update
call to decl_attributes.
(grokfield): Update call to decl_attributes.
* class.c (finish_struct): Update call to cplus_decl_attributes.
* cp-tree.h (cplus_decl_attributes): Update prototype.
* decl.c (start_decl, grokdeclarator, start_function): Update
calls to decl_attributes and cplus_decl_attributes.
* friend.c (do_friend): Update call to cplus_decl_attributes.
* parse.y (parse_bitfield): Update call to cplus_decl_attributes.
From-SVN: r43995
2001-07-13 22:40:43 +02:00
|
|
|
|
decl_attributes (&decl, attributes, 0);
|
1995-04-25 22:06:42 +02:00
|
|
|
|
|
2001-10-18 20:29:02 +02:00
|
|
|
|
if (TREE_CODE (decl) == FUNCTION_DECL
|
|
|
|
|
&& DECL_DECLARED_INLINE_P (decl)
|
|
|
|
|
&& DECL_UNINLINABLE (decl)
|
|
|
|
|
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl)))
|
|
|
|
|
warning_with_decl (decl,
|
|
|
|
|
"inline function `%s' given attribute noinline");
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Add this decl to the current binding level.
|
|
|
|
|
TEM may equal DECL or it may be a previous decl of the same name. */
|
|
|
|
|
tem = pushdecl (decl);
|
|
|
|
|
|
|
|
|
|
/* For a local variable, define the RTL now. */
|
|
|
|
|
if (current_binding_level != global_binding_level
|
|
|
|
|
/* But not if this is a duplicate decl
|
|
|
|
|
and we preserved the rtl from the previous one
|
|
|
|
|
(which may or may not happen). */
|
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME...
* varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the
contents of the RTL, to determine the name of the object.
* tree.h (DECL_RTL): Allocate RTL lazily.
(SET_DECL_RTL): New macro.
(DECL_RTL_SET_P): Likewise.
(COPY_DECL_RTL): Likewise.
(DECL_RTL_IF_SET): Likewise.
* varasm.c (make_decl_rtl): Add assertions about the kind of
declaration we are processing.
* c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
(start_decl): Likewise.
(finish_decl): Likewise.
* c-semantics.c (emit_local_var): Likewise.
* calls.c (expand_call): Likewise.
* dbxout.c (dbxout_symbol): Likewise.
* emit-rtl.c (unshare_all_rtl): Likewise.
(unshare_all_decls): Likewise.
(reset_used_decls): Likewise.
* expr.c (store_constructor): Likewise.
(safe_from_p): Likewise.
(expand_expr): Likewise.
* function.c (put_var_into_stack): Likewise.
(instantiate_decls_1): Likewise.
(assign_parms): Likewise.
(expand_function_start): Likewise.
(expand_function_end): Likewise.
* ggc-common.c (gcc_mark_trees): Likewise.
* integrate.c (function_cannot_inline_p): Likewise.
(copy_decl_for_inlining): Likewise.
(expand_inline_function): Likewise.
(integrate_parm_decls): Likewise.
(integrate_decl_tree): Likewise.
* print-tree.c (print_node): Likewise.
* reg-stack.c (stack_result): Likewise.
* stmt.c (label_rtx): Likewise.
(expand_return): Likewise.
(expand_decl): Likewise.
(expand_decl_cleanup): Likewise.
(expand_anon_union_decl): Likewise.
* toplev.c (check_global_declarations): Likewise.
(rest_of_decl_compilation): Likewise.
* tree.c (simple_cst_equal): Likewise.
* objc/objc-act.c (generate_static_references): Likewise.
* class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* cp-tree.h (DECL_IN_MEMORY_P): Likewise.
* decl.c (duplicate_decls): Likewise.
(builtin_function): Likewise.
(build_library_fn): Likewise.
(build_cp_library_fn): Likewise.
(check_initializer): Likewise.
(cp_finish_decl): Likewise.
* decl2.c (grokfield): Likewise.
(grok_function_init): Remove #if 0'd code.
(finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* friend.c (do_friend): Likewise.
* init.c (get_temp_regvar): Likewise.
* method.c (make_thunk): Likewise.
* pt.c (tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Likewise.
* semantics.c (genrtl_named_return_value): Likewise.
(expand_body): Likewise.
(genrtl_finish_function): Likewise.
* tree.c (cp_tree_equal): Likewise.
* com.c (ffecom_member_phase_2): Use COPY_DECL_RTL,
DECL_RTL_SET_P, etc.
(duplicate_decls): Likewise.
(start_decl): Likewise.
* class.c (build_static_field_ref): Likewise.
(make_method_value): Likewise.
(get_dispatch_table): Likewise.
* decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
From-SVN: r40482
2001-03-15 03:51:03 +01:00
|
|
|
|
&& !DECL_RTL_SET_P (tem)
|
2000-09-17 09:38:23 +02:00
|
|
|
|
&& !DECL_CONTEXT (tem))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-10-20 02:58:35 +02:00
|
|
|
|
if (TREE_TYPE (tem) != error_mark_node
|
|
|
|
|
&& COMPLETE_TYPE_P (TREE_TYPE (tem)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
expand_decl (tem);
|
|
|
|
|
else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE
|
|
|
|
|
&& DECL_INITIAL (tem) != 0)
|
|
|
|
|
expand_decl (tem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return tem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Finish processing of a declaration;
|
|
|
|
|
install its initial value.
|
|
|
|
|
If the length of an array type is not known before,
|
|
|
|
|
it must be determined now, from the initial value, or it is an error. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
finish_decl (decl, init, asmspec_tree)
|
|
|
|
|
tree decl, init;
|
|
|
|
|
tree asmspec_tree;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree type = TREE_TYPE (decl);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int was_incomplete = (DECL_SIZE (decl) == 0);
|
stringpool.c: New file.
* stringpool.c: New file.
* ggc-common.c (ggc_mark_string_ptr, ggc_add_string_root): Delete.
(ggc_alloc_string): Now in stringpool.o.
* ggc-page.c, ggc-simple.c: Do not define or allocate empty_string.
* ggc.h: Delete prototype of ggc_add_string_root. #define
ggc_add_string_root and ggc_mark_string to nothing. Prototype
init_stringpool and stringpool_statistics.
(ggc_alloc_string): Returns a const char *.
* tree.c (hash_table, do_identifier_warnings): Delete.
(init_obstacks): Don't initialize the identifier hash table.
(get_identifier, maybe_get_identifier, start_identifier_warnings,
set_identifier_size): Now in stringpool.c.
* tree.h (struct tree_string): Constify pointer field.
(approx_sqrt): Prototype.
* Makefile.in (stringpool.o): Add rule, mention in OBJS.
* toplev.c (approx_sqrt): New function.
(compile_file): Call stringpool_statistics if mem_report is on.
(main): Call init_stringpool.
* builtins.c (c_strlen), c-decl.c (finish_decl), c-lex.c
(process_directive), c-typeck.c (constructor_asmspec, struct
initializer_stack, start_init), except.c (create_rethrow_ref),
stmt.c (digit_strings), toplev.c (decode_f_option), tree.c
(built_in_filename), varasm,c (in_named_name,
assemble_static_space, struct constant_descriptor, struct
deferred_string, struct pool_constant, force_const_mem),
i386.c (pic_label_name, global_offset_table_name), rs6000.c
(rs6000_emit_prologue, rs6000_emit_epilogue) : Constify a char *.
* c-common.c (combine_strings): Combine strings in scratch
buffer, then pass to build_string.
* optabs.c (init_libfuncs), profile.c (init_edge_profiler,
output_func_start_profiler), stmt.c (init_stmt), alpha.c
(alpha_need_linkage), arm.c (arm_encode_call_attribute),
i386.c (load_pic_register), ia64.c (ia64_encode_section_info),
rs6000.c (rs6000_encode_section_info): Create string in
scratch buffer, then pass to ggc_alloc_string.
* stmt.c (expand_asm_operands): If we must adjust the
constraint strings, do so by creating a new one, not by
modifying the old one in place. Constify some char *s.
* config/pa/pa.c (hppa_encode_label): Drop unnecessary second
argument. Create string in scratch buffer, then pass to
ggc_alloc_string.
* config/pa/pa-protos.h: Update prototype.
* config/pa/elf.h, config/pa/pa.h, config/pa/som.h:
hppa_encode_label takes only one argument.
* c-parse.in (if_prefix): Find the filename and line number at
$-2 and $-1 respectively.
* diagnostic.c (error_recursion): Add missing newline, use
fputs, translate string.
cp:
* lex.c (struct impl_files, internal_filename): Constify a char *.
java:
* jcf-parse.c (get_constant), parse.y (do_merge_string_cste):
Create string in scratch buffer, then pass to build_string.
From-SVN: r37514
2000-11-17 07:05:31 +01:00
|
|
|
|
const char *asmspec = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-10-10 13:33:39 +02:00
|
|
|
|
/* If a name was specified, get the string. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (asmspec_tree)
|
1994-04-25 22:47:30 +02:00
|
|
|
|
asmspec = TREE_STRING_POINTER (asmspec_tree);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* If `start_decl' didn't like having an initialization, ignore it now. */
|
|
|
|
|
if (init != 0 && DECL_INITIAL (decl) == 0)
|
|
|
|
|
init = 0;
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Don't crash if parm is initialized. */
|
|
|
|
|
if (TREE_CODE (decl) == PARM_DECL)
|
|
|
|
|
init = 0;
|
|
|
|
|
|
|
|
|
|
if (init)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (decl) != TYPE_DECL)
|
|
|
|
|
store_init_value (decl, init);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* typedef foo = bar; store the type of bar as the type of foo. */
|
|
|
|
|
TREE_TYPE (decl) = TREE_TYPE (init);
|
|
|
|
|
DECL_INITIAL (decl) = init = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Deduce size of array from initialization, if not already known */
|
|
|
|
|
if (TREE_CODE (type) == ARRAY_TYPE
|
|
|
|
|
&& TYPE_DOMAIN (type) == 0
|
|
|
|
|
&& TREE_CODE (decl) != TYPE_DECL)
|
|
|
|
|
{
|
|
|
|
|
int do_default
|
|
|
|
|
= (TREE_STATIC (decl)
|
|
|
|
|
/* Even if pedantic, an external linkage array
|
|
|
|
|
may have incomplete type at first. */
|
|
|
|
|
? pedantic && !TREE_PUBLIC (decl)
|
1992-07-12 04:56:45 +02:00
|
|
|
|
: !DECL_EXTERNAL (decl));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int failure
|
|
|
|
|
= complete_array_type (type, DECL_INITIAL (decl), do_default);
|
|
|
|
|
|
|
|
|
|
/* Get the completed type made by complete_array_type. */
|
|
|
|
|
type = TREE_TYPE (decl);
|
|
|
|
|
|
|
|
|
|
if (failure == 1)
|
|
|
|
|
error_with_decl (decl, "initializer fails to determine size of `%s'");
|
|
|
|
|
|
2000-09-20 21:35:10 +02:00
|
|
|
|
else if (failure == 2)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
if (do_default)
|
|
|
|
|
error_with_decl (decl, "array size missing in `%s'");
|
1993-03-22 08:04:18 +01:00
|
|
|
|
/* If a `static' var's size isn't known,
|
|
|
|
|
make it extern as well as static, so it does not get
|
|
|
|
|
allocated.
|
|
|
|
|
If it is not `static', then do not mark extern;
|
|
|
|
|
finish_incomplete_decl will give it a default size
|
|
|
|
|
and it will get allocated. */
|
|
|
|
|
else if (!pedantic && TREE_STATIC (decl) && ! TREE_PUBLIC (decl))
|
1992-07-12 04:56:45 +02:00
|
|
|
|
DECL_EXTERNAL (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1994-04-06 21:35:10 +02:00
|
|
|
|
/* TYPE_MAX_VALUE is always one less than the number of elements
|
|
|
|
|
in the array, because we start counting at zero. Therefore,
|
|
|
|
|
warn only if the value is less than zero. */
|
2000-09-20 21:35:10 +02:00
|
|
|
|
else if (pedantic && TYPE_DOMAIN (type) != 0
|
|
|
|
|
&& tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) < 0)
|
1994-03-14 11:08:06 +01:00
|
|
|
|
error_with_decl (decl, "zero or negative size array `%s'");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
layout_decl (decl, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (decl) == VAR_DECL)
|
|
|
|
|
{
|
2000-10-20 02:58:35 +02:00
|
|
|
|
if (DECL_SIZE (decl) == 0 && TREE_TYPE (decl) != error_mark_node
|
|
|
|
|
&& COMPLETE_TYPE_P (TREE_TYPE (decl)))
|
1993-05-26 06:22:32 +02:00
|
|
|
|
layout_decl (decl, 0);
|
|
|
|
|
|
1992-08-14 10:09:22 +02:00
|
|
|
|
if (DECL_SIZE (decl) == 0
|
2000-10-20 02:58:35 +02:00
|
|
|
|
/* Don't give an error if we already gave one earlier. */
|
|
|
|
|
&& TREE_TYPE (decl) != error_mark_node
|
1992-08-14 10:09:22 +02:00
|
|
|
|
&& (TREE_STATIC (decl)
|
|
|
|
|
?
|
|
|
|
|
/* A static variable with an incomplete type
|
1993-08-07 10:48:29 +02:00
|
|
|
|
is an error if it is initialized.
|
1993-10-08 05:59:33 +01:00
|
|
|
|
Also if it is not file scope.
|
1992-08-14 10:09:22 +02:00
|
|
|
|
Otherwise, let it through, but if it is not `extern'
|
|
|
|
|
then it may cause an error message later. */
|
1996-02-13 23:47:16 +01:00
|
|
|
|
(DECL_INITIAL (decl) != 0
|
2000-08-28 03:44:28 +02:00
|
|
|
|
|| DECL_CONTEXT (decl) != 0)
|
1992-08-14 10:09:22 +02:00
|
|
|
|
:
|
|
|
|
|
/* An automatic variable with an incomplete type
|
|
|
|
|
is an error. */
|
1992-08-14 10:34:32 +02:00
|
|
|
|
!DECL_EXTERNAL (decl)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error_with_decl (decl, "storage size of `%s' isn't known");
|
|
|
|
|
TREE_TYPE (decl) = error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
1992-07-12 04:56:45 +02:00
|
|
|
|
if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
|
1993-02-02 05:38:30 +01:00
|
|
|
|
&& DECL_SIZE (decl) != 0)
|
1993-02-03 00:35:04 +01:00
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
|
|
|
|
|
constant_expression_warning (DECL_SIZE (decl));
|
|
|
|
|
else
|
|
|
|
|
error_with_decl (decl, "storage size of `%s' isn't constant");
|
|
|
|
|
}
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
if (TREE_USED (type))
|
1997-11-02 22:19:36 +01:00
|
|
|
|
TREE_USED (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1994-04-16 22:38:20 +02:00
|
|
|
|
/* If this is a function and an assembler name is specified, it isn't
|
1994-04-25 22:47:30 +02:00
|
|
|
|
builtin any more. Also reset DECL_RTL so we can give it its new
|
|
|
|
|
name. */
|
1994-04-16 22:38:20 +02:00
|
|
|
|
if (TREE_CODE (decl) == FUNCTION_DECL && asmspec)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
{
|
|
|
|
|
DECL_BUILT_IN_CLASS (decl) = NOT_BUILT_IN;
|
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME...
* varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the
contents of the RTL, to determine the name of the object.
* tree.h (DECL_RTL): Allocate RTL lazily.
(SET_DECL_RTL): New macro.
(DECL_RTL_SET_P): Likewise.
(COPY_DECL_RTL): Likewise.
(DECL_RTL_IF_SET): Likewise.
* varasm.c (make_decl_rtl): Add assertions about the kind of
declaration we are processing.
* c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
(start_decl): Likewise.
(finish_decl): Likewise.
* c-semantics.c (emit_local_var): Likewise.
* calls.c (expand_call): Likewise.
* dbxout.c (dbxout_symbol): Likewise.
* emit-rtl.c (unshare_all_rtl): Likewise.
(unshare_all_decls): Likewise.
(reset_used_decls): Likewise.
* expr.c (store_constructor): Likewise.
(safe_from_p): Likewise.
(expand_expr): Likewise.
* function.c (put_var_into_stack): Likewise.
(instantiate_decls_1): Likewise.
(assign_parms): Likewise.
(expand_function_start): Likewise.
(expand_function_end): Likewise.
* ggc-common.c (gcc_mark_trees): Likewise.
* integrate.c (function_cannot_inline_p): Likewise.
(copy_decl_for_inlining): Likewise.
(expand_inline_function): Likewise.
(integrate_parm_decls): Likewise.
(integrate_decl_tree): Likewise.
* print-tree.c (print_node): Likewise.
* reg-stack.c (stack_result): Likewise.
* stmt.c (label_rtx): Likewise.
(expand_return): Likewise.
(expand_decl): Likewise.
(expand_decl_cleanup): Likewise.
(expand_anon_union_decl): Likewise.
* toplev.c (check_global_declarations): Likewise.
(rest_of_decl_compilation): Likewise.
* tree.c (simple_cst_equal): Likewise.
* objc/objc-act.c (generate_static_references): Likewise.
* class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* cp-tree.h (DECL_IN_MEMORY_P): Likewise.
* decl.c (duplicate_decls): Likewise.
(builtin_function): Likewise.
(build_library_fn): Likewise.
(build_cp_library_fn): Likewise.
(check_initializer): Likewise.
(cp_finish_decl): Likewise.
* decl2.c (grokfield): Likewise.
(grok_function_init): Remove #if 0'd code.
(finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* friend.c (do_friend): Likewise.
* init.c (get_temp_regvar): Likewise.
* method.c (make_thunk): Likewise.
* pt.c (tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Likewise.
* semantics.c (genrtl_named_return_value): Likewise.
(expand_body): Likewise.
(genrtl_finish_function): Likewise.
* tree.c (cp_tree_equal): Likewise.
* com.c (ffecom_member_phase_2): Use COPY_DECL_RTL,
DECL_RTL_SET_P, etc.
(duplicate_decls): Likewise.
(start_decl): Likewise.
* class.c (build_static_field_ref): Likewise.
(make_method_value): Likewise.
(get_dispatch_table): Likewise.
* decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
From-SVN: r40482
2001-03-15 03:51:03 +01:00
|
|
|
|
SET_DECL_RTL (decl, NULL_RTX);
|
Compute DECL_ASSEMBLER_NAME lazily.
* tree.h (DECL_ASSEMBLER_NAME): Compute it lazily.
(DECL_ASSEMBLER_NAME_SET_P): New macro.
(SET_DECL_ASSEMBLER_NAME): Likewise.
(COPY_DECL_ASSEMBLER_NAME): Likewise.
(set_decl_assembler_name): Declare.
(lang_set_decl_assembler_name): Likewise.
* tree.c (lang_set_decl_assembler_name): New variab.e
(set_decl_assembler_name): New function.
(init_obstacks): Set lang_set_decl_assembler_name.
(build_decl): Don't set DECL_ASSEMBLER_NAME.
* c-decl.c (duplicate_decls): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(builtin_function): Likewise.
(finish_decl): Likewise.
* dbxout.c (dbxout_type_methods): Likewise.
* ggc-common.c (ggc_mark_trees): Likewise.
* profile.c (output_func_start_profiler): Likewise.
* varasm.c (make_decl_rtl): Likewise.
* class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(add_method): Remove optimization involving comparison of
DECL_ASSEMBLER_NAME.
(build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(check_methods): Likewise.
(build_clone): Likewise.
(built_vtt): Likewise.
* cp-tree.h (DECL_NEEDED_P): Likewise.
* decl.c (pushtag): Likewise.
(duplicate_decls): Likewise.
(pushdecl): Likewise.
(builtin_function): Likewise.
(build_library_fn_1): Set DECL_LANGUAGE for library functions.
(build_cp_library_fn): Likewise.
(maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(make_rtl_for_nonlocal_decl): Likewise.
(cp_finish_decl): Likewise.
(grokfndecl): Likewise.
(grokvardecl): Likewise.
(grokdeclarator): Likewise.
(start_function): Likewise.
(cp_missing_return_ok_p): Likewise.
* decl2.c (grokclassfn): Likewise.
(check_classfn): Likewise.
(finish_static_data_member_decl): Likewise.
(grokfield): Likewise.
* error.c (GLOBAL_IORD_P): Remove.
(dump_global_iord): Improve output.
(dump_decl): Avoid using DECL_ASSEMBLER_NAME.
* except.c (nothrow_libfn_p): Summarily reject any function not in
namespace-scope.
* init.c (build_java_class_ref): Don't explicitly set
DECL_ASSEMBLER_NAME after calling mangle_decl.
* mangle.c (mangle_decl_string): Handle extern "C" functions.
(mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl.
* method.c (set_mangled_name_for_decl): Don't explicitly set
DECL_ASSEMBLER_NAME after calling mangle_decl.
(make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and
IDENTIFIER_GLOBAL_VALUE for the thunk.
* pt.c (set_mangled_name_for_template_decl): Remove.
(check_explicit_specialization): Don't use it.
(looup_template_class): Don't set DECL_ASSEMBLER_NAME.
(tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME.
* rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(tinfo_base_init): Likewise.
(create_real_tinfo_var): Likewise.
* search.c (looup_field_1): Likewise.
* semantics.c (finish_named_return_value): Likewise.
* tree.c (init_tree): Set lang_set_decl_assembler_name.
* com.c (builtin_function): Use SET_DECL_ASSEMBLER_NAME.
* class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME.
(layout_class): Likewise.
(layout_class_method): Likewise.
(emit_register_classes): Likewise.
* decl.c (builtin_function): Likewise.
(give_name_to_locals): Likewise.
From-SVN: r40642
2001-03-20 00:50:04 +01:00
|
|
|
|
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec));
|
2000-08-11 00:01:22 +02:00
|
|
|
|
}
|
1994-04-16 22:38:20 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Output the assembler code and/or RTL code for variables and functions,
|
|
|
|
|
unless the type is an undefined structure or union.
|
|
|
|
|
If not, it will get done when the type is completed. */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
|
|
|
|
|
{
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
|
|
|
|
maybe_objc_check_decl (decl);
|
2000-09-17 09:38:23 +02:00
|
|
|
|
|
|
|
|
|
if (!DECL_CONTEXT (decl))
|
2001-02-26 12:11:38 +01:00
|
|
|
|
{
|
|
|
|
|
if (DECL_INITIAL (decl) == NULL_TREE
|
|
|
|
|
|| DECL_INITIAL (decl) == error_mark_node)
|
|
|
|
|
/* Don't output anything
|
|
|
|
|
when a tentative file-scope definition is seen.
|
|
|
|
|
But at end of compilation, do output code for them. */
|
|
|
|
|
DECL_DEFER_OUTPUT (decl) = 1;
|
|
|
|
|
rest_of_decl_compilation (decl, asmspec,
|
|
|
|
|
(DECL_CONTEXT (decl) == 0
|
|
|
|
|
|| TREE_ASM_WRITTEN (decl)), 0);
|
|
|
|
|
}
|
2000-09-17 09:38:23 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2001-05-21 20:36:57 +02:00
|
|
|
|
/* This is a local variable. If there is an ASMSPEC, the
|
|
|
|
|
user has requested that we handle it specially. */
|
2000-09-17 09:38:23 +02:00
|
|
|
|
if (asmspec)
|
2000-11-26 01:40:46 +01:00
|
|
|
|
{
|
2001-05-21 20:36:57 +02:00
|
|
|
|
/* In conjunction with an ASMSPEC, the `register'
|
|
|
|
|
keyword indicates that we should place the variable
|
|
|
|
|
in a particular register. */
|
|
|
|
|
if (DECL_REGISTER (decl))
|
|
|
|
|
DECL_C_HARD_REGISTER (decl) = 1;
|
|
|
|
|
|
|
|
|
|
/* If this is not a static variable, issue a warning.
|
|
|
|
|
It doesn't make any sense to give an ASMSPEC for an
|
|
|
|
|
ordinary, non-register local variable. Historically,
|
|
|
|
|
GCC has accepted -- but ignored -- the ASMSPEC in
|
|
|
|
|
this case. */
|
|
|
|
|
if (TREE_CODE (decl) == VAR_DECL
|
|
|
|
|
&& !DECL_REGISTER (decl)
|
|
|
|
|
&& !TREE_STATIC (decl))
|
|
|
|
|
warning_with_decl (decl,
|
|
|
|
|
"ignoring asm-specifier for non-static local variable `%s'");
|
|
|
|
|
else
|
|
|
|
|
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec));
|
2000-11-26 01:40:46 +01:00
|
|
|
|
}
|
2001-05-21 20:36:57 +02:00
|
|
|
|
|
2001-10-24 16:46:44 +02:00
|
|
|
|
if (TREE_CODE (decl) != FUNCTION_DECL)
|
|
|
|
|
add_decl_stmt (decl);
|
2000-09-17 09:38:23 +02:00
|
|
|
|
}
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
|
1994-11-29 00:03:16 +01:00
|
|
|
|
if (DECL_CONTEXT (decl) != 0)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* Recompute the RTL of a local array now
|
|
|
|
|
if it used to be an incomplete type. */
|
|
|
|
|
if (was_incomplete
|
1992-07-12 04:56:45 +02:00
|
|
|
|
&& ! TREE_STATIC (decl) && ! DECL_EXTERNAL (decl))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* If we used it already as memory, it must stay in memory. */
|
|
|
|
|
TREE_ADDRESSABLE (decl) = TREE_USED (decl);
|
|
|
|
|
/* If it's still incomplete now, no init will save it. */
|
|
|
|
|
if (DECL_SIZE (decl) == 0)
|
|
|
|
|
DECL_INITIAL (decl) = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (decl) == TYPE_DECL)
|
|
|
|
|
{
|
|
|
|
|
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
|
|
|
|
maybe_objc_check_decl (decl);
|
2001-05-01 14:11:35 +02:00
|
|
|
|
rest_of_decl_compilation (decl, NULL, DECL_CONTEXT (decl) == 0, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* At the end of a declaration, throw away any variable type sizes
|
|
|
|
|
of types defined inside that declaration. There is no use
|
|
|
|
|
computing them in the following function definition. */
|
|
|
|
|
if (current_binding_level == global_binding_level)
|
|
|
|
|
get_pending_sizes ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If DECL has a cleanup, build and return that cleanup here.
|
|
|
|
|
This is a callback called by expand_expr. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
maybe_build_cleanup (decl)
|
Warning fixes:
* Makefile.in (c-lang.o): Depend on c-tree.h, c-lex.h and toplev.h.
(c-lex.o): Depend on output.h.
(c-common.o): Likewise.
(stmt.o): Likewise.
(calls.o): Likewise.
(integrate.o): Depend on toplev.h.
(regclass.o): Depend on output.h.
(final.o): Depend on reload.h.
* c-common.c: Include output.h.
(check_format_info): Remove unused variable `integral_format'.
* c-decl.c (print_lang_decl): Mark parameters `file', `node' and
`indent' with ATTRIBUTE_UNUSED.
(print_lang_type): Likewise.
(maybe_build_cleanup): Likewise for parameter `decl'.
(copy_lang_decl): Likewise for parameter `node'.
* c-lang.c: Include c-tree.h, c-lex.h and toplev.h.
(lang_print_xnode): Mark parameters `file', `node' and `indent'
with ATTRIBUTE_UNUSED.
(lookup_interface): Likewise for parameter `arg'.
(is_class_name): Likewise.
(maybe_objc_check_decl): Likewise for parameter `decl'.
(maybe_objc_comptypes): Likewise for parameters `lhs', `rhs' and
`reflexive'.
(maybe_objc_method_name): Likewise for parameter `decl'.
(build_objc_string): Likewise for parameters `len' and `str'.
* c-lex.c: Include output.h.
* c-lex.h (position_after_white_space): Correct typo in prototype.
* c-tree.h (finish_file, c_expand_start_cond, c_expand_start_else,
c_expand_end_cond, init_iterators): Add prototypes.
* caller-save.c (set_reg_live): Mark parameters `reg' and `setter'
with ATTRIBUTE_UNUSED.
* calls.c: Include output.h.
* cccp.c (pipe_closed): Mark parameter `signo' with
ATTRIBUTE_UNUSED.
* combine.c: Move inclusion of expr.h to after insn-config.h.
* iris6.h (ASM_IDENTIFY_GCC, ASM_IDENTIFY_LANGUAGE): Don't define
as empty, rather define as ((void)0).
* sparc.c (sparc_check_64): Add braces around ambiguous `else'.
Add parentheses around assignment used as truth value.
* cplus-dem.c (squangle_mop_up): Change return type to void.
(internal_cplus_demangle): Remove unused parameter `options'.
All callers changed.
(cplus_demangle_opname): Remove function wide variable `int i' and
replace with `size_t i' at each location where it is used.
(cplus_demangle_opname): change type of `i' from int to size_t.
* cppexp.c (right_shift): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
* cpphash.c (cpp_lookup): Likewise.
(cpp_hash_cleanup): Likewise.
* cpplib.c (parse_name): Add a prototype and make it static.
(null_underflow): Mark parameter `pfile' with ATTRIBUTE_UNUSED.
(null_cleanup): Likewise for parameters `pbuf' and `pfile'.
(macro_cleanup): Likewise for parameter `pfile'.
(file_cleanup): Likewise.
* cpplib.h (cpp_reader_init, cpp_options_init, cpp_start_read,
cpp_read_check_assertion, skip_rest_of_line): Add prototypes.
* crtstuff.c (force_to_data, __CTOR_LIST__, force_to_data,
__DTOR_END__, __FRAME_END__): Mark with ATTRIBUTE_UNUSED.
* cse.c (cse_check_loop_start): Mark parameter `set' with
ATTRIBUTE_UNUSED.
* dbxout.c (flag_minimal_debug, have_used_extensions,
source_label_number): Move inside macro wrapper check against
defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO).
* dwarf2out.c (gen_entry_point_die): Hide prototype and definition.
* except.h (doing_eh): Provide prototype.
* expr.c: Move inclusion of expr.h to after insn-config.h.
* final.c: Include reload.h.
(shorten_branches): Cast the first argument of bzero to char *.
* fix-header.c (cpp_print_containing_files): Mark parameter
`pfile' with ATTRIBUTE_UNUSED.
(cpp_fatal): Likewise.
* flow.c (find_basic_blocks_1): Cast the first argument of bzero
to char *.
* genattrtab.c (make_length_attrs): Change the type of variable
`i' from int to size_t.
(zero_fn): Mark parameter `exp' with ATTRIBUTE_UNUSED.
(one_fn): Likewise.
* genextract.c (main): When generating insn-extract.c, mark
variable `junk' with ATTRIBUTE_UNUSED.
* gengenrtl.c (gencode): When generating genrtl.c, cast the first
argument of bzero to char*.
* integrate.c: Include toplev.h.
* libgcc2.c: Wrap `struct exception_table' and
`find_exception_handler' in macro DWARF2_UNWIND_INFO.
* objc/Make-lang.in (objc-act.o): Depend on toplev.h.
* objc/objc-act.c: Include toplev.h.
(lang_print_xnode): Mark parameters `file', `node' and `indent'
with ATTRIBUTE_UNUSED.
(finish_protocol): Likewise for parameter `protocol'.
* output.h (declare_weak): Add prototype.
(decode_reg_name): Don't wrap with TREE_CODE macro.
(assemble_alias): Add prototype.
* regclass.c: Include output.h.
* reload.h (reloads_conflict): Add prototype.
* rtl.h (print_rtl_single, mark_elimiation, reg_class_subset_p,
output_func_start_profiler): Add prototypes.
* rtlanal.c (reg_set_p_1): Mark parameters `x' and `pat' with
ATTRIBUTE_UNUSED.
* scan-decls.c: Include scan.h.
* scan.h (recognized_function, recognized_extern): Add prototypes.
* stmt.c: Include output.h.
* toplev.c (error_for_asm, warning_for_asm): Remove prototypes.
(output_lang_identify): Hide prototype and definition.
(float_signal): Mark parameter `signo' with ATTRIBUTE_UNUSED.
(pipe_closed): Likewise.
* toplev.h (count_error, strip_off_ending, error_for_asm,
warning_for_asm): Add prototypes.
From-SVN: r19712
1998-05-13 14:40:39 +02:00
|
|
|
|
tree decl ATTRIBUTE_UNUSED;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* There are no cleanups in C. */
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a parsed parameter declaration,
|
|
|
|
|
decode it into a PARM_DECL and push that on the current binding level.
|
|
|
|
|
Also, for the sake of forward parm decls,
|
|
|
|
|
record the given order of parms in `parm_order'. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
push_parm_decl (parm)
|
|
|
|
|
tree parm;
|
|
|
|
|
{
|
1994-03-25 19:55:59 +01:00
|
|
|
|
tree decl;
|
1992-03-23 03:07:53 +01:00
|
|
|
|
int old_immediate_size_expand = immediate_size_expand;
|
|
|
|
|
/* Don't try computing parm sizes now -- wait till fn is called. */
|
|
|
|
|
immediate_size_expand = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1995-05-12 13:09:47 +02:00
|
|
|
|
decl = grokdeclarator (TREE_VALUE (TREE_PURPOSE (parm)),
|
|
|
|
|
TREE_PURPOSE (TREE_PURPOSE (parm)), PARM, 0);
|
c-common.c (decl_attributes): Take a pointer to the node to which attributes are to be attached...
* c-common.c (decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument.
* c-common.h (enum attribute_flags): New.
(decl_attributes): Update prototype.
* c-decl.c (start_decl, push_parm_decl, finish_struct,
finish_enum, start_function): Update calls to decl_attributes.
* c-parse.in (component_declarator, component_notype_declarator,
label): Update calls to decl_attributes.
cp:
* decl2.c (cplus_decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument. Update
call to decl_attributes.
(grokfield): Update call to decl_attributes.
* class.c (finish_struct): Update call to cplus_decl_attributes.
* cp-tree.h (cplus_decl_attributes): Update prototype.
* decl.c (start_decl, grokdeclarator, start_function): Update
calls to decl_attributes and cplus_decl_attributes.
* friend.c (do_friend): Update call to cplus_decl_attributes.
* parse.y (parse_bitfield): Update call to cplus_decl_attributes.
From-SVN: r43995
2001-07-13 22:40:43 +02:00
|
|
|
|
decl_attributes (&decl, TREE_VALUE (parm), 0);
|
1993-04-24 01:18:52 +02:00
|
|
|
|
|
|
|
|
|
#if 0
|
1992-05-18 07:09:24 +02:00
|
|
|
|
if (DECL_NAME (decl))
|
|
|
|
|
{
|
1994-03-25 19:55:59 +01:00
|
|
|
|
tree olddecl;
|
1992-05-18 07:09:24 +02:00
|
|
|
|
olddecl = lookup_name (DECL_NAME (decl));
|
|
|
|
|
if (pedantic && olddecl != 0 && TREE_CODE (olddecl) == TYPE_DECL)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
pedwarn_with_decl (decl,
|
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
capital from diagnostics.
* c-lex.c (cb_file_change): Similarly.
* c-parse.in : Similarly.
* cfgrtl.c (verify_flow_info): Similarly.
* collect2.c: Similarly.
* cppfiles.c (find_include_file): Similarly.
* cppinit.c (cpp_handle_option): Similarly.
* cpplex.c (cpp_spell_token): Similarly.
* cppmain.c (do_preprocessing): Similarly.
* gcc.c (translate_options, process_command, do_spec1,
main, pfatal_execute): Similarly.
* genattr.c (main): Similarly.
* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
write_test_expr, main): Similarly.
* gencodes.c (main): Similarly.
* genconfig.c (main): Similarly.
* genconstants.c (main): Similarly.
* genemit.c (main): Similarly.
* genextract.c (main): Similarly.
* genflags.c (main): Similarly.
* genopinit.c (main): Similarly.
* genoutput.c (process_template, main): Similarly.
* genpeep.c (main): Similarly.
* genrecog.c (main): Similarly.
* gensupport.c (is_predicable, identify_predicable_attribute,
alter_predicate_for_insn, init_md_reader_args, main): Similarly.
* ggc-page.c (alloc_anon): Similarly.
* mips-tfile.c (add_string, add_procedure, add_file, read_line,
parse_begin, parse_bend, parse_def, parse_end, parse_file,
parse_stabs_common, parse_stabs, write_varray, write_object,
read_seek, copy_object, main, error): Similarly.
* profile.c (compute_branch_probabilities): Similarly.
* reg-stack.c (check_asm_stack_operands): Similarly.
* reload.c (find_reloads): Similarly.
* reload1.c (spill_failure, failed_reload): Similarly.
* rtl-error.c (_fatal_insn_not_found): Similarly.
* toplev.c (read_integral_parameter, crash_signal,
decode_f_option, set_target_switch, parse_options_and_default_flags)
: Similarly.
* tradcif.y (parse_number, yylex): Similarly.
* tradcpp.c (main, fancy_abort): Similarly.
* tree.c (tree_check_failed): Similarly.
* varray.c (varray_check_failed): Similarly.
* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
* call.c (build_java_interface_fn_ref): Similarly.
* except.c (is_admissible_throw_operand): Similarly.
* init.c (build_java_class_ref): Similarly.
* xref.c (open_xref_file): Similarly.
objc:
* objc-act.c (get_object_ref, lookup_and_install_protocols,
build_objc_string_object, objc_declare_alias, build_ivar_chain,
finish_message_expr, build_protocol_expr, is_public,
start_class): Similarly.
testsuite:
* objc.dg/alias.m: Update.
* objc.dg/class-1.m: Update.
* objc.dg/const-str-1.m: Update.
* objc.dg/fwd-proto-1.m: Update.
* objc.dg/id-1.m: Update.
* objc.dg/super-class-1.m: Update.
From-SVN: r47518
2001-12-02 01:04:36 +01:00
|
|
|
|
"ISO C forbids parameter `%s' shadowing typedef");
|
1992-05-18 07:09:24 +02:00
|
|
|
|
}
|
1993-04-24 01:18:52 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
decl = pushdecl (decl);
|
|
|
|
|
|
1992-03-23 03:07:53 +01:00
|
|
|
|
immediate_size_expand = old_immediate_size_expand;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
current_binding_level->parm_order
|
|
|
|
|
= tree_cons (NULL_TREE, decl, current_binding_level->parm_order);
|
|
|
|
|
|
|
|
|
|
/* Add this decl to the current binding level. */
|
|
|
|
|
finish_decl (decl, NULL_TREE, NULL_TREE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clear the given order of parms in `parm_order'.
|
|
|
|
|
Used at start of parm list,
|
|
|
|
|
and also at semicolon terminating forward decls. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
clear_parm_order ()
|
|
|
|
|
{
|
|
|
|
|
current_binding_level->parm_order = NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make TYPE a complete type based on INITIAL_VALUE.
|
1992-03-23 03:07:53 +01:00
|
|
|
|
Return 0 if successful, 1 if INITIAL_VALUE can't be deciphered,
|
1992-02-13 23:21:26 +01:00
|
|
|
|
2 if there was no information (in which case assume 1 if DO_DEFAULT). */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
complete_array_type (type, initial_value, do_default)
|
|
|
|
|
tree type;
|
|
|
|
|
tree initial_value;
|
|
|
|
|
int do_default;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree maxindex = NULL_TREE;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int value = 0;
|
|
|
|
|
|
|
|
|
|
if (initial_value)
|
|
|
|
|
{
|
|
|
|
|
/* Note MAXINDEX is really the maximum index,
|
|
|
|
|
one less than the size. */
|
|
|
|
|
if (TREE_CODE (initial_value) == STRING_CST)
|
|
|
|
|
{
|
|
|
|
|
int eltsize
|
|
|
|
|
= int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value)));
|
1993-10-08 02:49:18 +01:00
|
|
|
|
maxindex = build_int_2 ((TREE_STRING_LENGTH (initial_value)
|
|
|
|
|
/ eltsize) - 1, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (initial_value) == CONSTRUCTOR)
|
|
|
|
|
{
|
1993-09-13 22:17:48 +02:00
|
|
|
|
tree elts = CONSTRUCTOR_ELTS (initial_value);
|
builtins.c (c_strlen): Use size_diffop and return ssizetype value.
* builtins.c (c_strlen): Use size_diffop and return ssizetype value.
(expand_builtin_strcpy): Pass correct type to size_binop.
(expand_builtin_strcmp): Likewise.
Clean up conditional structure.
* c-decl.c (init_decl_processing): Don't call set_sizetype twice.
(complete_array_type): Don't use size_binop for MAXINDEX.
* c-typeck.c (c_sizeof): Use size_one_node and TYPE_SIZE_UNIT.
(c_sizeof_nowarn, c_size_in_bytes): Likewise.
(c_alignof): Use size_one_node.
(build_unary_op): Pass arg of proper type to size_binop.
(really_start_incremental_init, push_init_level): Use sizetype for
constructor{,_bit,_unfilled}_index.
(pop_init_label, output_init_element): Likewise.
(output_pending_init_elements, process_init_element): Likewise.
* calls.c (compute_argument_block_size): Field VAR is ssizetype.
* expr.c (store_expr): Use size_int.
(store_constructor): Use proper types for size_binop args.
(get_inner_reference, expand_expr, case ARRAY_REF): Likewise.
(expand_expr_unaligned): Likewise.
(string_contant): Return object of sizetype.
* expr.h (SUB_PARM_SIZE): Call size_diffop and pass proper types.
(ARGS_SIZE_RTX): Call ARGS_SIZE_TREE.
(ARGS_SIZE_TREE): Pass proper types to size_binop.
* fold-const.c (int_const_binop): Refine when size_int is called.
(fold_convert): Likewise.
(size_int_wide): Rework to take KIND as arg, only take low order
bits, handle new sizetype_tab datatype, and chain entries in
size_table.
(size_int_type_wide): New function.
(size_binop): Validate types of arguments.
(ssize_binop): Deleted.
(size_diffop): New function.
(extract_muldiv): Only fold division into multiplication for sizetypes.
* function.c (assign_parms): Use size_diffop and make sure
VAR field is of ssizetype; also pass proper type to size_binop.
(locate_and_pad_parm, pad_to_arg_alignment): Likewise.
(round_down): Deleted from here.
* store-layout.c (sizetype_tab): Now an array.
(sizetype_set, early_root_list): New variables.
(variable_size): Use size_one_node.
(round_up): Pass proper type to size_binop.
(round_down): Moved to here and corrected as above.
(layout_record): Pass proper arg types to size_binop.
(layout_type): Likewise.
If sizetype_set is zero, record the type just laid out.
(make_unsigned_type): Don't call set_sizetype;
(make_signed_type): Likewise; also, call fixup_signed_type.
(initialize_sizetypes): New function.
(set_sizetype): Make copy of types, set TYPE_IS_SIZETYPE, and
set name of bitsizetype to "bit_size_type".
Fix up type of sizes of all types made before call.
* tm.texi (ROUND_TYPE_SIZE_UNIT): New macro.
* tree.c (fix_sizetype): Deleted.
(build_common_tree_nodes): Call initialize_sizetypes.
(build_common_tree_nodes_2): Don't call fix_sizetype.
* tree.h (TYPE_IS_SIZETYPE): New macro.
(initialize_sizetype): New declaration.
(enum size_type_kind): New type.
(struct sizetype_tab): Deleted.
(sizetype_tab): Now array; adjust sizetype macros.
(size_diffop, size_int_type_wide): New functions.
(size_int_wide): Change number of args and type; access macros changed.
(ssize_int, sbitsize_int): New macros.
* config/i960/i960.h (ROUND_TYPE_SIZE): Use size_int.
(ROUND_TYPE_SIZE_UNIT): New macro.
* ch/actions.c (chill_convert_for_assignment): Don't use size_binop
for things that aren't sizes.
(expand_varying_length_assignment): Likewise.
* ch/convert.c (digest_array_tuple, convert): Likewise.
* ch/typeck.c (build_chill_slice, smash_dummy_type): Likewise.
(build_chill_slice_with_range): Likewise.
(build_chill_slice_with_length): Likewise.
(build_array_from_set): Adjust types for size_binop.
* ch/expr.c (build_concat_expr, build_chill_repetition_op): Likewise.
(build_chill_sizeof): Use TYPE_SIZE_UNIT.
* ch/tree.c (build_string_type): Pass proper type to size_binop.
* cp/class.c (dfs_build_vtable_offset_vtbl_entries): Don't use
size_binop on things that are not sizes; ssize_binop deleted.
Call size_diffop when appropriate.
(dfs_build_vcall_offset_vtbl_entries): Likewise.
(build_primary_vtable, build_secondary_vtable): Likewise.
(dfs_set_offset_for_unshared_vbases, dfs_modify_vtables): Likewise.
Variable I is HOST_WIDE_INT.
(get_vfield_offset): Pass proper types to size_binop.
(size_extra_vtbl_entries, layout_virtual_bases): Likewise.
(finish_struct_1): Likewise.
(skip_rtti_stuff): Arg N is now pointer to signed.
(layout_class_type): Use size_zero_node.
* cp/cp-tree.h (skip_rtti_stuff): Arg N is pointer to signed.
* cp/cvt.c (cp_convert_to_pointer): Pass proper types to size_binop.
* cp/decl.c (complete_arry_type): Pass proper types to size_binop.
(xref_basetypes): BINFO_OFFSET is sizetype.
* cp/error.c (dump_expr): Don't use size_binop non-sizes.
* cp/expr.c (cplus_expand_constant): Pass proper types to size_binop.
* cp/init.c (construct_virtual_bases): Fix type error.
(build_vec_delete_1): Pass proper type to size_binop and don't
fold result.
* cp/lex.c (cp_make_lang_type): BINFO_OFFSET is sizetype.
* cp/rtti.c (get_base_offset): Pass proper type to size_binop.
* cp/search.c (dfs_find_vbases): Fix type error.
(expand_upcast_fixups): Arg to skip_rtti_stuff is pointer to signed.
(dfs_get_vbase_types): BINFO_OFFSET is sizetype.
* cp/tree.c (debug_binfo): Variable N is signed.
Use HOST_WIDE_INT_PRINT_DEC.
* cp/typeck.c (comptypes): sizetype is same as equivalent integer type.
(c_sizeof, c_sizeof_nowarn, expr_sizeof): Use TYPE_SIZE_UNIT,
size_one_node and size_zero_node.
(c_alignof): Use size_one_node.
(build_component_addr): Pass proper types to size_binop.
(expand_ptrmemfunc_cst): Don't use size_binop on non-sizes.
* f/com.c (ffecom_arrayref_): Convert args to size_binop to proper
type.
(ffecom_tree_canonize_ptr_): Don't use size_binop for non-sizes.
(ffecom_tree_canonize_ref_): Likewise.
(type_for_mode): Handle TImode.
* f/ste.c (ffeste_io_dofio_, ffeste_io_douio_): Use TYPE_SIZE_UNIT.
(ffeste_io_ciclist_): Likewise.
* java/expr.c (build_java_ret): Pass proper type to size_binop.
From-SVN: r32225
2000-02-27 22:39:40 +01:00
|
|
|
|
maxindex = build_int_2 (-1, -1);
|
1993-09-13 22:17:48 +02:00
|
|
|
|
for (; elts; elts = TREE_CHAIN (elts))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_PURPOSE (elts))
|
|
|
|
|
maxindex = TREE_PURPOSE (elts);
|
|
|
|
|
else
|
builtins.c (c_strlen): Use size_diffop and return ssizetype value.
* builtins.c (c_strlen): Use size_diffop and return ssizetype value.
(expand_builtin_strcpy): Pass correct type to size_binop.
(expand_builtin_strcmp): Likewise.
Clean up conditional structure.
* c-decl.c (init_decl_processing): Don't call set_sizetype twice.
(complete_array_type): Don't use size_binop for MAXINDEX.
* c-typeck.c (c_sizeof): Use size_one_node and TYPE_SIZE_UNIT.
(c_sizeof_nowarn, c_size_in_bytes): Likewise.
(c_alignof): Use size_one_node.
(build_unary_op): Pass arg of proper type to size_binop.
(really_start_incremental_init, push_init_level): Use sizetype for
constructor{,_bit,_unfilled}_index.
(pop_init_label, output_init_element): Likewise.
(output_pending_init_elements, process_init_element): Likewise.
* calls.c (compute_argument_block_size): Field VAR is ssizetype.
* expr.c (store_expr): Use size_int.
(store_constructor): Use proper types for size_binop args.
(get_inner_reference, expand_expr, case ARRAY_REF): Likewise.
(expand_expr_unaligned): Likewise.
(string_contant): Return object of sizetype.
* expr.h (SUB_PARM_SIZE): Call size_diffop and pass proper types.
(ARGS_SIZE_RTX): Call ARGS_SIZE_TREE.
(ARGS_SIZE_TREE): Pass proper types to size_binop.
* fold-const.c (int_const_binop): Refine when size_int is called.
(fold_convert): Likewise.
(size_int_wide): Rework to take KIND as arg, only take low order
bits, handle new sizetype_tab datatype, and chain entries in
size_table.
(size_int_type_wide): New function.
(size_binop): Validate types of arguments.
(ssize_binop): Deleted.
(size_diffop): New function.
(extract_muldiv): Only fold division into multiplication for sizetypes.
* function.c (assign_parms): Use size_diffop and make sure
VAR field is of ssizetype; also pass proper type to size_binop.
(locate_and_pad_parm, pad_to_arg_alignment): Likewise.
(round_down): Deleted from here.
* store-layout.c (sizetype_tab): Now an array.
(sizetype_set, early_root_list): New variables.
(variable_size): Use size_one_node.
(round_up): Pass proper type to size_binop.
(round_down): Moved to here and corrected as above.
(layout_record): Pass proper arg types to size_binop.
(layout_type): Likewise.
If sizetype_set is zero, record the type just laid out.
(make_unsigned_type): Don't call set_sizetype;
(make_signed_type): Likewise; also, call fixup_signed_type.
(initialize_sizetypes): New function.
(set_sizetype): Make copy of types, set TYPE_IS_SIZETYPE, and
set name of bitsizetype to "bit_size_type".
Fix up type of sizes of all types made before call.
* tm.texi (ROUND_TYPE_SIZE_UNIT): New macro.
* tree.c (fix_sizetype): Deleted.
(build_common_tree_nodes): Call initialize_sizetypes.
(build_common_tree_nodes_2): Don't call fix_sizetype.
* tree.h (TYPE_IS_SIZETYPE): New macro.
(initialize_sizetype): New declaration.
(enum size_type_kind): New type.
(struct sizetype_tab): Deleted.
(sizetype_tab): Now array; adjust sizetype macros.
(size_diffop, size_int_type_wide): New functions.
(size_int_wide): Change number of args and type; access macros changed.
(ssize_int, sbitsize_int): New macros.
* config/i960/i960.h (ROUND_TYPE_SIZE): Use size_int.
(ROUND_TYPE_SIZE_UNIT): New macro.
* ch/actions.c (chill_convert_for_assignment): Don't use size_binop
for things that aren't sizes.
(expand_varying_length_assignment): Likewise.
* ch/convert.c (digest_array_tuple, convert): Likewise.
* ch/typeck.c (build_chill_slice, smash_dummy_type): Likewise.
(build_chill_slice_with_range): Likewise.
(build_chill_slice_with_length): Likewise.
(build_array_from_set): Adjust types for size_binop.
* ch/expr.c (build_concat_expr, build_chill_repetition_op): Likewise.
(build_chill_sizeof): Use TYPE_SIZE_UNIT.
* ch/tree.c (build_string_type): Pass proper type to size_binop.
* cp/class.c (dfs_build_vtable_offset_vtbl_entries): Don't use
size_binop on things that are not sizes; ssize_binop deleted.
Call size_diffop when appropriate.
(dfs_build_vcall_offset_vtbl_entries): Likewise.
(build_primary_vtable, build_secondary_vtable): Likewise.
(dfs_set_offset_for_unshared_vbases, dfs_modify_vtables): Likewise.
Variable I is HOST_WIDE_INT.
(get_vfield_offset): Pass proper types to size_binop.
(size_extra_vtbl_entries, layout_virtual_bases): Likewise.
(finish_struct_1): Likewise.
(skip_rtti_stuff): Arg N is now pointer to signed.
(layout_class_type): Use size_zero_node.
* cp/cp-tree.h (skip_rtti_stuff): Arg N is pointer to signed.
* cp/cvt.c (cp_convert_to_pointer): Pass proper types to size_binop.
* cp/decl.c (complete_arry_type): Pass proper types to size_binop.
(xref_basetypes): BINFO_OFFSET is sizetype.
* cp/error.c (dump_expr): Don't use size_binop non-sizes.
* cp/expr.c (cplus_expand_constant): Pass proper types to size_binop.
* cp/init.c (construct_virtual_bases): Fix type error.
(build_vec_delete_1): Pass proper type to size_binop and don't
fold result.
* cp/lex.c (cp_make_lang_type): BINFO_OFFSET is sizetype.
* cp/rtti.c (get_base_offset): Pass proper type to size_binop.
* cp/search.c (dfs_find_vbases): Fix type error.
(expand_upcast_fixups): Arg to skip_rtti_stuff is pointer to signed.
(dfs_get_vbase_types): BINFO_OFFSET is sizetype.
* cp/tree.c (debug_binfo): Variable N is signed.
Use HOST_WIDE_INT_PRINT_DEC.
* cp/typeck.c (comptypes): sizetype is same as equivalent integer type.
(c_sizeof, c_sizeof_nowarn, expr_sizeof): Use TYPE_SIZE_UNIT,
size_one_node and size_zero_node.
(c_alignof): Use size_one_node.
(build_component_addr): Pass proper types to size_binop.
(expand_ptrmemfunc_cst): Don't use size_binop on non-sizes.
* f/com.c (ffecom_arrayref_): Convert args to size_binop to proper
type.
(ffecom_tree_canonize_ptr_): Don't use size_binop for non-sizes.
(ffecom_tree_canonize_ref_): Likewise.
(type_for_mode): Handle TImode.
* f/ste.c (ffeste_io_dofio_, ffeste_io_douio_): Use TYPE_SIZE_UNIT.
(ffeste_io_ciclist_): Likewise.
* java/expr.c (build_java_ret): Pass proper type to size_binop.
From-SVN: r32225
2000-02-27 22:39:40 +01:00
|
|
|
|
maxindex = fold (build (PLUS_EXPR, integer_type_node,
|
|
|
|
|
maxindex, integer_one_node));
|
1993-09-13 22:17:48 +02:00
|
|
|
|
}
|
|
|
|
|
maxindex = copy_node (maxindex);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Make an error message unless that happened already. */
|
|
|
|
|
if (initial_value != error_mark_node)
|
|
|
|
|
value = 1;
|
|
|
|
|
|
|
|
|
|
/* Prevent further error messages. */
|
1993-03-22 08:04:18 +01:00
|
|
|
|
maxindex = build_int_2 (0, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!maxindex)
|
|
|
|
|
{
|
|
|
|
|
if (do_default)
|
1993-03-22 08:04:18 +01:00
|
|
|
|
maxindex = build_int_2 (0, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
value = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (maxindex)
|
|
|
|
|
{
|
|
|
|
|
TYPE_DOMAIN (type) = build_index_type (maxindex);
|
|
|
|
|
if (!TREE_TYPE (maxindex))
|
|
|
|
|
TREE_TYPE (maxindex) = TYPE_DOMAIN (type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Lay out the type now that we can get the real answer. */
|
|
|
|
|
|
|
|
|
|
layout_type (type);
|
|
|
|
|
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given declspecs and a declarator,
|
|
|
|
|
determine the name and type of the object declared
|
|
|
|
|
and construct a ..._DECL node for it.
|
|
|
|
|
(In one case we can return a ..._TYPE node instead.
|
|
|
|
|
For invalid input we sometimes return 0.)
|
|
|
|
|
|
|
|
|
|
DECLSPECS is a chain of tree_list nodes whose value fields
|
|
|
|
|
are the storage classes and type specifiers.
|
|
|
|
|
|
|
|
|
|
DECL_CONTEXT says which syntactic context this declaration is in:
|
|
|
|
|
NORMAL for most contexts. Make a VAR_DECL or FUNCTION_DECL or TYPE_DECL.
|
|
|
|
|
FUNCDEF for a function definition. Like NORMAL but a few different
|
|
|
|
|
error messages in each case. Return value may be zero meaning
|
|
|
|
|
this definition is too screwy to try to parse.
|
|
|
|
|
PARM for a parameter declaration (either within a function prototype
|
|
|
|
|
or before a function body). Make a PARM_DECL, or return void_type_node.
|
|
|
|
|
TYPENAME if for a typename (in a cast or sizeof).
|
|
|
|
|
Don't make a DECL node; just return the ..._TYPE node.
|
|
|
|
|
FIELD for a struct or union field; make a FIELD_DECL.
|
|
|
|
|
BITFIELD for a field with specified width.
|
|
|
|
|
INITIALIZED is 1 if the decl has an initializer.
|
|
|
|
|
|
|
|
|
|
In the TYPENAME case, DECLARATOR is really an absolute declarator.
|
|
|
|
|
It may also be so in the PARM case, for a prototype where the
|
|
|
|
|
argument type is specified but not the name.
|
|
|
|
|
|
|
|
|
|
This function is where the complicated C meanings of `static'
|
1992-03-23 03:07:53 +01:00
|
|
|
|
and `extern' are interpreted. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
grokdeclarator (declarator, declspecs, decl_context, initialized)
|
|
|
|
|
tree declspecs;
|
|
|
|
|
tree declarator;
|
|
|
|
|
enum decl_context decl_context;
|
|
|
|
|
int initialized;
|
|
|
|
|
{
|
|
|
|
|
int specbits = 0;
|
|
|
|
|
tree spec;
|
|
|
|
|
tree type = NULL_TREE;
|
|
|
|
|
int longlong = 0;
|
|
|
|
|
int constp;
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
int restrictp;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int volatilep;
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
int type_quals = TYPE_UNQUALIFIED;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int inlinep;
|
|
|
|
|
int explicit_int = 0;
|
|
|
|
|
int explicit_char = 0;
|
1993-03-04 20:42:57 +01:00
|
|
|
|
int defaulted_int = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
tree typedef_decl = 0;
|
bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.h (bitmap_print): Likewise.
* c-decl.c (builtin_function, grokdeclarator, grokfield): Likewise.
* c-lang.c (build_objc_string): Likewise.
* c-lex.c (yyerror, extend_token_buffer): Likewise. Don't include
limits.h or ctype.h. Remove unused variable `p'.
* c-lex.h (yyerror): Qualify a char* with the `const' keyword.
* c-pragma.c (handle_pragma_token): Likewise.
* c-pragma.h (handle_pragma_token): Likewise.
* c-tree.h (build_objc_string, builtin_function, grokfield,
build_indirect_ref, lvalue_or_else, readonly_warning, error_init,
pedwarn_init): Likewise.
* c-typeck.c (convert_for_assignment, warn_for_assignment,
push_string, warning_init, incomplete_type_error,
build_indirect_ref, lvalue_or_else, readonly_warning,
build_c_cast, spelling, push_member_name, print_spelling,
error_init, pedwarn_init, start_init): Likewise.
* objc/objc-act.c (build_objc_string): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* tree.h (lvalue_or_else, print_node, print_node_brief): Likewise.
From-SVN: r25296
1999-02-18 21:38:48 +01:00
|
|
|
|
const char *name;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
tree typedef_type = 0;
|
|
|
|
|
int funcdef_flag = 0;
|
|
|
|
|
enum tree_code innermost_code = ERROR_MARK;
|
|
|
|
|
int bitfield = 0;
|
1992-03-23 03:07:53 +01:00
|
|
|
|
int size_varies = 0;
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
tree decl_attr = NULL_TREE;
|
2001-05-25 13:12:47 +02:00
|
|
|
|
tree array_ptr_quals = NULL_TREE;
|
|
|
|
|
int array_parm_static = 0;
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
tree returned_attrs = NULL_TREE;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (decl_context == BITFIELD)
|
|
|
|
|
bitfield = 1, decl_context = FIELD;
|
|
|
|
|
|
|
|
|
|
if (decl_context == FUNCDEF)
|
|
|
|
|
funcdef_flag = 1, decl_context = NORMAL;
|
|
|
|
|
|
|
|
|
|
/* Look inside a declarator for the name being declared
|
|
|
|
|
and get it as a string, for an error message. */
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree decl = declarator;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
name = 0;
|
|
|
|
|
|
|
|
|
|
while (decl)
|
|
|
|
|
switch (TREE_CODE (decl))
|
|
|
|
|
{
|
|
|
|
|
case ARRAY_REF:
|
|
|
|
|
case INDIRECT_REF:
|
|
|
|
|
case CALL_EXPR:
|
|
|
|
|
innermost_code = TREE_CODE (decl);
|
|
|
|
|
decl = TREE_OPERAND (decl, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
case TREE_LIST:
|
|
|
|
|
decl = TREE_VALUE (decl);
|
|
|
|
|
break;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
case IDENTIFIER_NODE:
|
|
|
|
|
name = IDENTIFIER_POINTER (decl);
|
|
|
|
|
decl = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
if (name == 0)
|
|
|
|
|
name = "type name";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A function definition's declarator must have the form of
|
|
|
|
|
a function declarator. */
|
|
|
|
|
|
|
|
|
|
if (funcdef_flag && innermost_code != CALL_EXPR)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Anything declared one level down from the top level
|
|
|
|
|
must be one of the parameters of a function
|
|
|
|
|
(because the body is at least two levels down). */
|
|
|
|
|
|
|
|
|
|
/* If this looks like a function definition, make it one,
|
|
|
|
|
even if it occurs where parms are expected.
|
|
|
|
|
Then store_parm_decls will reject it and not use it as a parm. */
|
|
|
|
|
if (decl_context == NORMAL && !funcdef_flag
|
1995-05-12 01:26:45 +02:00
|
|
|
|
&& current_binding_level->parm_flag)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
decl_context = PARM;
|
|
|
|
|
|
|
|
|
|
/* Look through the decl specs and record which ones appear.
|
|
|
|
|
Some typespecs are defined as built-in typenames.
|
|
|
|
|
Others, the ones that are modifiers of other types,
|
|
|
|
|
are represented by bits in SPECBITS: set the bits for
|
|
|
|
|
the modifiers that appear. Storage class keywords are also in SPECBITS.
|
|
|
|
|
|
|
|
|
|
If there is a typedef name or a type, store the type in TYPE.
|
|
|
|
|
This includes builtin typedefs such as `int'.
|
|
|
|
|
|
|
|
|
|
Set EXPLICIT_INT or EXPLICIT_CHAR if the type is `int' or `char'
|
|
|
|
|
and did not come from a user typedef.
|
|
|
|
|
|
|
|
|
|
Set LONGLONG if `long' is mentioned twice. */
|
|
|
|
|
|
|
|
|
|
for (spec = declspecs; spec; spec = TREE_CHAIN (spec))
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree id = TREE_VALUE (spec);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (id == ridpointers[(int) RID_INT])
|
|
|
|
|
explicit_int = 1;
|
|
|
|
|
if (id == ridpointers[(int) RID_CHAR])
|
|
|
|
|
explicit_char = 1;
|
|
|
|
|
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
if (TREE_CODE (id) == IDENTIFIER_NODE && C_IS_RESERVED_WORD (id))
|
|
|
|
|
{
|
|
|
|
|
enum rid i = C_RID_CODE (id);
|
2001-03-02 22:41:37 +01:00
|
|
|
|
if ((int) i <= (int) RID_LAST_MODIFIER)
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
{
|
2001-03-02 22:41:37 +01:00
|
|
|
|
if (i == RID_LONG && (specbits & (1 << (int) i)))
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
{
|
|
|
|
|
if (longlong)
|
|
|
|
|
error ("`long long long' is too long for GCC");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (pedantic && !flag_isoc99 && ! in_system_header
|
|
|
|
|
&& warn_long_long)
|
|
|
|
|
pedwarn ("ISO C89 does not support `long long'");
|
|
|
|
|
longlong = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-03-02 22:41:37 +01:00
|
|
|
|
else if (specbits & (1 << (int) i))
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
|
2001-03-02 22:41:37 +01:00
|
|
|
|
specbits |= 1 << (int) i;
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
goto found;
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (type)
|
|
|
|
|
error ("two or more data types in declaration of `%s'", name);
|
|
|
|
|
/* Actual typedefs come to us as TYPE_DECL nodes. */
|
|
|
|
|
else if (TREE_CODE (id) == TYPE_DECL)
|
|
|
|
|
{
|
|
|
|
|
type = TREE_TYPE (id);
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
decl_attr = DECL_ATTRIBUTES (id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
typedef_decl = id;
|
|
|
|
|
}
|
|
|
|
|
/* Built-in types come as identifiers. */
|
|
|
|
|
else if (TREE_CODE (id) == IDENTIFIER_NODE)
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree t = lookup_name (id);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (TREE_TYPE (t) == error_mark_node)
|
|
|
|
|
;
|
|
|
|
|
else if (!t || TREE_CODE (t) != TYPE_DECL)
|
|
|
|
|
error ("`%s' fails to be a typedef or built in type",
|
|
|
|
|
IDENTIFIER_POINTER (id));
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
type = TREE_TYPE (t);
|
|
|
|
|
typedef_decl = t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (id) != ERROR_MARK)
|
|
|
|
|
type = id;
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
found:
|
|
|
|
|
;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef_type = type;
|
|
|
|
|
if (type)
|
1992-03-23 03:07:53 +01:00
|
|
|
|
size_varies = C_TYPE_VARIABLE_SIZE (type);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1993-03-04 20:42:57 +01:00
|
|
|
|
/* No type at all: default to `int', and set DEFAULTED_INT
|
1992-02-13 23:21:26 +01:00
|
|
|
|
because it was not a user-defined typedef. */
|
|
|
|
|
|
|
|
|
|
if (type == 0)
|
|
|
|
|
{
|
1998-05-06 01:18:02 +02:00
|
|
|
|
if ((! (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
|
|
|
|
|
| (1 << (int) RID_SIGNED)
|
2000-09-17 21:39:56 +02:00
|
|
|
|
| (1 << (int) RID_UNSIGNED)
|
|
|
|
|
| (1 << (int) RID_COMPLEX))))
|
1998-07-01 04:00:35 +02:00
|
|
|
|
/* Don't warn about typedef foo = bar. */
|
|
|
|
|
&& ! (specbits & (1 << (int) RID_TYPEDEF) && initialized)
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
&& ! in_system_header)
|
1996-11-12 20:17:33 +01:00
|
|
|
|
{
|
2000-01-29 20:00:43 +01:00
|
|
|
|
/* Issue a warning if this is an ISO C 99 program or if -Wreturn-type
|
1998-12-01 22:05:17 +01:00
|
|
|
|
and this is a function, or if -Wimplicit; prefer the former
|
|
|
|
|
warning since it is more explicit. */
|
2001-02-12 18:31:42 +01:00
|
|
|
|
if ((warn_implicit_int || warn_return_type || flag_isoc99)
|
|
|
|
|
&& funcdef_flag)
|
1996-11-12 20:17:33 +01:00
|
|
|
|
warn_about_return_type = 1;
|
2000-01-29 20:00:43 +01:00
|
|
|
|
else if (warn_implicit_int || flag_isoc99)
|
2000-08-11 00:01:22 +02:00
|
|
|
|
pedwarn_c99 ("type defaults to `int' in declaration of `%s'",
|
|
|
|
|
name);
|
1996-11-12 20:17:33 +01:00
|
|
|
|
}
|
|
|
|
|
|
1993-03-04 20:42:57 +01:00
|
|
|
|
defaulted_int = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
type = integer_type_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now process the modifiers that were specified
|
|
|
|
|
and check for invalid combinations. */
|
|
|
|
|
|
|
|
|
|
/* Long double is a special combination. */
|
|
|
|
|
|
1997-08-11 17:56:58 +02:00
|
|
|
|
if ((specbits & 1 << (int) RID_LONG) && ! longlong
|
1992-07-15 20:34:18 +02:00
|
|
|
|
&& TYPE_MAIN_VARIANT (type) == double_type_node)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-08-11 00:01:22 +02:00
|
|
|
|
specbits &= ~(1 << (int) RID_LONG);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
type = long_double_type_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check all other uses of type modifiers. */
|
|
|
|
|
|
|
|
|
|
if (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
|
|
|
|
|
| (1 << (int) RID_UNSIGNED) | (1 << (int) RID_SIGNED)))
|
|
|
|
|
{
|
|
|
|
|
int ok = 0;
|
|
|
|
|
|
1997-08-11 17:56:58 +02:00
|
|
|
|
if ((specbits & 1 << (int) RID_LONG)
|
|
|
|
|
&& (specbits & 1 << (int) RID_SHORT))
|
|
|
|
|
error ("both long and short specified for `%s'", name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if (((specbits & 1 << (int) RID_LONG)
|
|
|
|
|
|| (specbits & 1 << (int) RID_SHORT))
|
|
|
|
|
&& explicit_char)
|
|
|
|
|
error ("long or short specified with char for `%s'", name);
|
|
|
|
|
else if (((specbits & 1 << (int) RID_LONG)
|
|
|
|
|
|| (specbits & 1 << (int) RID_SHORT))
|
|
|
|
|
&& TREE_CODE (type) == REAL_TYPE)
|
1997-08-11 17:56:58 +02:00
|
|
|
|
{
|
|
|
|
|
static int already = 0;
|
|
|
|
|
|
|
|
|
|
error ("long or short specified with floating type for `%s'", name);
|
|
|
|
|
if (! already && ! pedantic)
|
|
|
|
|
{
|
|
|
|
|
error ("the only valid combination is `long double'");
|
|
|
|
|
already = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else if ((specbits & 1 << (int) RID_SIGNED)
|
|
|
|
|
&& (specbits & 1 << (int) RID_UNSIGNED))
|
1997-08-11 17:56:58 +02:00
|
|
|
|
error ("both signed and unsigned specified for `%s'", name);
|
|
|
|
|
else if (TREE_CODE (type) != INTEGER_TYPE)
|
|
|
|
|
error ("long, short, signed or unsigned invalid for `%s'", name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ok = 1;
|
1993-03-04 20:42:57 +01:00
|
|
|
|
if (!explicit_int && !defaulted_int && !explicit_char && pedantic)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
pedwarn ("long, short, signed or unsigned used invalidly for `%s'",
|
|
|
|
|
name);
|
|
|
|
|
if (flag_pedantic_errors)
|
|
|
|
|
ok = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Discard the type modifiers if they are invalid. */
|
|
|
|
|
if (! ok)
|
|
|
|
|
{
|
|
|
|
|
specbits &= ~((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
|
|
|
|
|
| (1 << (int) RID_UNSIGNED) | (1 << (int) RID_SIGNED));
|
|
|
|
|
longlong = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1993-12-25 13:52:49 +01:00
|
|
|
|
if ((specbits & (1 << (int) RID_COMPLEX))
|
|
|
|
|
&& TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE)
|
|
|
|
|
{
|
|
|
|
|
error ("complex invalid for `%s'", name);
|
2000-08-11 00:01:22 +02:00
|
|
|
|
specbits &= ~(1 << (int) RID_COMPLEX);
|
1993-12-25 13:52:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Decide whether an integer type is signed or not.
|
|
|
|
|
Optionally treat bitfields as signed by default. */
|
|
|
|
|
if (specbits & 1 << (int) RID_UNSIGNED
|
|
|
|
|
/* Traditionally, all bitfields are unsigned. */
|
1992-10-06 01:23:17 +01:00
|
|
|
|
|| (bitfield && flag_traditional
|
|
|
|
|
&& (! explicit_flag_signed_bitfields || !flag_signed_bitfields))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|| (bitfield && ! flag_signed_bitfields
|
1993-03-04 20:42:57 +01:00
|
|
|
|
&& (explicit_int || defaulted_int || explicit_char
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* A typedef for plain `int' without `signed'
|
|
|
|
|
can be controlled just like plain `int'. */
|
|
|
|
|
|| ! (typedef_decl != 0
|
|
|
|
|
&& C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
|
|
|
|
|
&& TREE_CODE (type) != ENUMERAL_TYPE
|
|
|
|
|
&& !(specbits & 1 << (int) RID_SIGNED)))
|
|
|
|
|
{
|
|
|
|
|
if (longlong)
|
|
|
|
|
type = long_long_unsigned_type_node;
|
|
|
|
|
else if (specbits & 1 << (int) RID_LONG)
|
|
|
|
|
type = long_unsigned_type_node;
|
|
|
|
|
else if (specbits & 1 << (int) RID_SHORT)
|
|
|
|
|
type = short_unsigned_type_node;
|
|
|
|
|
else if (type == char_type_node)
|
|
|
|
|
type = unsigned_char_type_node;
|
|
|
|
|
else if (typedef_decl)
|
|
|
|
|
type = unsigned_type (type);
|
|
|
|
|
else
|
|
|
|
|
type = unsigned_type_node;
|
|
|
|
|
}
|
|
|
|
|
else if ((specbits & 1 << (int) RID_SIGNED)
|
|
|
|
|
&& type == char_type_node)
|
|
|
|
|
type = signed_char_type_node;
|
|
|
|
|
else if (longlong)
|
|
|
|
|
type = long_long_integer_type_node;
|
|
|
|
|
else if (specbits & 1 << (int) RID_LONG)
|
|
|
|
|
type = long_integer_type_node;
|
|
|
|
|
else if (specbits & 1 << (int) RID_SHORT)
|
|
|
|
|
type = short_integer_type_node;
|
1993-12-25 13:52:49 +01:00
|
|
|
|
|
|
|
|
|
if (specbits & 1 << (int) RID_COMPLEX)
|
1993-03-04 20:42:57 +01:00
|
|
|
|
{
|
2000-09-17 21:39:56 +02:00
|
|
|
|
if (pedantic && !flag_isoc99)
|
|
|
|
|
pedwarn ("ISO C89 does not support complex types");
|
1993-12-25 13:52:49 +01:00
|
|
|
|
/* If we just have "complex", it is equivalent to
|
|
|
|
|
"complex double", but if any modifiers at all are specified it is
|
|
|
|
|
the complex form of TYPE. E.g, "complex short" is
|
|
|
|
|
"complex short int". */
|
|
|
|
|
|
|
|
|
|
if (defaulted_int && ! longlong
|
|
|
|
|
&& ! (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
|
|
|
|
|
| (1 << (int) RID_SIGNED)
|
|
|
|
|
| (1 << (int) RID_UNSIGNED))))
|
2000-09-17 21:39:56 +02:00
|
|
|
|
{
|
|
|
|
|
if (pedantic)
|
|
|
|
|
pedwarn ("ISO C does not support plain `complex' meaning `double complex'");
|
|
|
|
|
type = complex_double_type_node;
|
|
|
|
|
}
|
1993-03-04 20:42:57 +01:00
|
|
|
|
else if (type == integer_type_node)
|
2000-09-17 21:39:56 +02:00
|
|
|
|
{
|
|
|
|
|
if (pedantic)
|
|
|
|
|
pedwarn ("ISO C does not support complex integer types");
|
|
|
|
|
type = complex_integer_type_node;
|
|
|
|
|
}
|
1993-03-04 20:42:57 +01:00
|
|
|
|
else if (type == float_type_node)
|
|
|
|
|
type = complex_float_type_node;
|
|
|
|
|
else if (type == double_type_node)
|
|
|
|
|
type = complex_double_type_node;
|
|
|
|
|
else if (type == long_double_type_node)
|
|
|
|
|
type = complex_long_double_type_node;
|
|
|
|
|
else
|
2000-09-17 21:39:56 +02:00
|
|
|
|
{
|
|
|
|
|
if (pedantic)
|
|
|
|
|
pedwarn ("ISO C does not support complex integer types");
|
|
|
|
|
type = build_complex_type (type);
|
|
|
|
|
}
|
1993-03-04 20:42:57 +01:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
/* Figure out the type qualifiers for the declaration. There are
|
|
|
|
|
two ways a declaration can become qualified. One is something
|
|
|
|
|
like `const int i' where the `const' is explicit. Another is
|
|
|
|
|
something like `typedef const int CI; CI i' where the type of the
|
|
|
|
|
declaration contains the `const'. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
constp = !! (specbits & 1 << (int) RID_CONST) + TYPE_READONLY (type);
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
restrictp = !! (specbits & 1 << (int) RID_RESTRICT) + TYPE_RESTRICT (type);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
volatilep = !! (specbits & 1 << (int) RID_VOLATILE) + TYPE_VOLATILE (type);
|
|
|
|
|
inlinep = !! (specbits & (1 << (int) RID_INLINE));
|
2000-06-26 18:42:23 +02:00
|
|
|
|
if (constp > 1 && ! flag_isoc99)
|
1992-05-18 07:09:24 +02:00
|
|
|
|
pedwarn ("duplicate `const'");
|
2000-06-26 18:42:23 +02:00
|
|
|
|
if (restrictp > 1 && ! flag_isoc99)
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
pedwarn ("duplicate `restrict'");
|
2000-06-26 18:42:23 +02:00
|
|
|
|
if (volatilep > 1 && ! flag_isoc99)
|
1992-05-18 07:09:24 +02:00
|
|
|
|
pedwarn ("duplicate `volatile'");
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (! flag_gen_aux_info && (TYPE_QUALS (type)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
type = TYPE_MAIN_VARIANT (type);
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
|
|
|
|
|
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
|
|
|
|
|
| (volatilep ? TYPE_QUAL_VOLATILE : 0));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Warn if two storage classes are given. Default to `auto'. */
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
int nclasses = 0;
|
|
|
|
|
|
|
|
|
|
if (specbits & 1 << (int) RID_AUTO) nclasses++;
|
|
|
|
|
if (specbits & 1 << (int) RID_STATIC) nclasses++;
|
|
|
|
|
if (specbits & 1 << (int) RID_EXTERN) nclasses++;
|
|
|
|
|
if (specbits & 1 << (int) RID_REGISTER) nclasses++;
|
|
|
|
|
if (specbits & 1 << (int) RID_TYPEDEF) nclasses++;
|
|
|
|
|
|
|
|
|
|
/* Warn about storage classes that are invalid for certain
|
|
|
|
|
kinds of declarations (parameters, typenames, etc.). */
|
|
|
|
|
|
|
|
|
|
if (nclasses > 1)
|
|
|
|
|
error ("multiple storage classes in declaration of `%s'", name);
|
|
|
|
|
else if (funcdef_flag
|
|
|
|
|
&& (specbits
|
|
|
|
|
& ((1 << (int) RID_REGISTER)
|
|
|
|
|
| (1 << (int) RID_AUTO)
|
|
|
|
|
| (1 << (int) RID_TYPEDEF))))
|
|
|
|
|
{
|
|
|
|
|
if (specbits & 1 << (int) RID_AUTO
|
|
|
|
|
&& (pedantic || current_binding_level == global_binding_level))
|
|
|
|
|
pedwarn ("function definition declared `auto'");
|
|
|
|
|
if (specbits & 1 << (int) RID_REGISTER)
|
|
|
|
|
error ("function definition declared `register'");
|
|
|
|
|
if (specbits & 1 << (int) RID_TYPEDEF)
|
|
|
|
|
error ("function definition declared `typedef'");
|
2000-08-11 00:01:22 +02:00
|
|
|
|
specbits &= ~((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER)
|
|
|
|
|
| (1 << (int) RID_AUTO));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else if (decl_context != NORMAL && nclasses > 0)
|
|
|
|
|
{
|
|
|
|
|
if (decl_context == PARM && specbits & 1 << (int) RID_REGISTER)
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
c-common.c (check_format_info): Don't call a variadic function with a non-literal format string.
* c-common.c (check_format_info): Don't call a variadic function
with a non-literal format string.
* c-decl.c (grokdeclarator, start_struct, finish_struct): Likewise.
* c-typeck.c (build_component_ref, build_unary_op, lvalue_or_else,
pedantic_lvalue_warning, error_init, pedwarn_init, warning_init):
Likewise.
* cccp.c (check_macro_name, do_xifdef, vwarning_with_line):
Likewise.
* collect2.c (collect_wait): Likewise.
* dbxout.c (dbxout_type): Likewise.
* gcc.c (do_spec_1): Likewise.
* genemit.c (gen_insn, gen_expand): Likewise.
* genrecog.c (write_switch, write_subroutine): Likewise.
* mips-tfile.c (catch_signal, botch): Likewise.
* print-rtl.c (print_rtx): Likewise.
* toplev.c (default_print_error_function, report_error_function,
_fatal_insn): Likewise.
From-SVN: r30666
1999-11-25 17:58:32 +01:00
|
|
|
|
switch (decl_context)
|
|
|
|
|
{
|
|
|
|
|
case FIELD:
|
2000-08-11 00:01:22 +02:00
|
|
|
|
error ("storage class specified for structure field `%s'",
|
|
|
|
|
name);
|
c-common.c (check_format_info): Don't call a variadic function with a non-literal format string.
* c-common.c (check_format_info): Don't call a variadic function
with a non-literal format string.
* c-decl.c (grokdeclarator, start_struct, finish_struct): Likewise.
* c-typeck.c (build_component_ref, build_unary_op, lvalue_or_else,
pedantic_lvalue_warning, error_init, pedwarn_init, warning_init):
Likewise.
* cccp.c (check_macro_name, do_xifdef, vwarning_with_line):
Likewise.
* collect2.c (collect_wait): Likewise.
* dbxout.c (dbxout_type): Likewise.
* gcc.c (do_spec_1): Likewise.
* genemit.c (gen_insn, gen_expand): Likewise.
* genrecog.c (write_switch, write_subroutine): Likewise.
* mips-tfile.c (catch_signal, botch): Likewise.
* print-rtl.c (print_rtx): Likewise.
* toplev.c (default_print_error_function, report_error_function,
_fatal_insn): Likewise.
From-SVN: r30666
1999-11-25 17:58:32 +01:00
|
|
|
|
break;
|
|
|
|
|
case PARM:
|
|
|
|
|
error ("storage class specified for parameter `%s'", name);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
error ("storage class specified for typename");
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-08-11 00:01:22 +02:00
|
|
|
|
specbits &= ~((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER)
|
|
|
|
|
| (1 << (int) RID_AUTO) | (1 << (int) RID_STATIC)
|
|
|
|
|
| (1 << (int) RID_EXTERN));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (specbits & 1 << (int) RID_EXTERN && initialized && ! funcdef_flag)
|
|
|
|
|
{
|
|
|
|
|
/* `extern' with initialization is invalid if not at top level. */
|
|
|
|
|
if (current_binding_level == global_binding_level)
|
|
|
|
|
warning ("`%s' initialized and declared `extern'", name);
|
|
|
|
|
else
|
|
|
|
|
error ("`%s' has both `extern' and initializer", name);
|
|
|
|
|
}
|
|
|
|
|
else if (specbits & 1 << (int) RID_EXTERN && funcdef_flag
|
|
|
|
|
&& current_binding_level != global_binding_level)
|
|
|
|
|
error ("nested function `%s' declared `extern'", name);
|
|
|
|
|
else if (current_binding_level == global_binding_level
|
|
|
|
|
&& specbits & (1 << (int) RID_AUTO))
|
|
|
|
|
error ("top-level declaration of `%s' specifies `auto'", name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now figure out the structure of the declarator proper.
|
|
|
|
|
Descend through it, creating more complex types, until we reach
|
|
|
|
|
the declared identifier (or NULL_TREE, in an absolute declarator). */
|
|
|
|
|
|
|
|
|
|
while (declarator && TREE_CODE (declarator) != IDENTIFIER_NODE)
|
|
|
|
|
{
|
|
|
|
|
if (type == error_mark_node)
|
|
|
|
|
{
|
|
|
|
|
declarator = TREE_OPERAND (declarator, 0);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Each level of DECLARATOR is either an ARRAY_REF (for ...[..]),
|
|
|
|
|
an INDIRECT_REF (for *...),
|
|
|
|
|
a CALL_EXPR (for ...(...)),
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
a TREE_LIST (for nested attributes),
|
1992-02-13 23:21:26 +01:00
|
|
|
|
an identifier (for the name being declared)
|
|
|
|
|
or a null pointer (for the place in an absolute declarator
|
|
|
|
|
where the name was omitted).
|
|
|
|
|
For the last two cases, we have just exited the loop.
|
|
|
|
|
|
|
|
|
|
At this point, TYPE is the type of elements of an array,
|
|
|
|
|
or for a function to return, or for a pointer to point to.
|
|
|
|
|
After this sequence of ifs, TYPE is the type of the
|
|
|
|
|
array or function or pointer, and DECLARATOR has had its
|
|
|
|
|
outermost layer removed. */
|
|
|
|
|
|
2001-05-25 13:12:47 +02:00
|
|
|
|
if (array_ptr_quals != NULL_TREE || array_parm_static)
|
|
|
|
|
{
|
|
|
|
|
/* Only the innermost declarator (making a parameter be of
|
|
|
|
|
array type which is converted to pointer type)
|
|
|
|
|
may have static or type qualifiers. */
|
|
|
|
|
error ("static or type qualifiers in non-parameter array declarator");
|
|
|
|
|
array_ptr_quals = NULL_TREE;
|
|
|
|
|
array_parm_static = 0;
|
|
|
|
|
}
|
|
|
|
|
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
if (TREE_CODE (declarator) == TREE_LIST)
|
|
|
|
|
{
|
|
|
|
|
/* We encode a declarator with embedded attributes using
|
|
|
|
|
a TREE_LIST. */
|
|
|
|
|
tree attrs = TREE_PURPOSE (declarator);
|
|
|
|
|
tree inner_decl;
|
|
|
|
|
int attr_flags = 0;
|
|
|
|
|
declarator = TREE_VALUE (declarator);
|
|
|
|
|
inner_decl = declarator;
|
|
|
|
|
while (inner_decl != NULL_TREE
|
|
|
|
|
&& TREE_CODE (inner_decl) == TREE_LIST)
|
|
|
|
|
inner_decl = TREE_VALUE (inner_decl);
|
|
|
|
|
if (inner_decl == NULL_TREE
|
|
|
|
|
|| TREE_CODE (inner_decl) == IDENTIFIER_NODE)
|
|
|
|
|
attr_flags |= (int) ATTR_FLAG_DECL_NEXT;
|
|
|
|
|
if (TREE_CODE (inner_decl) == CALL_EXPR)
|
|
|
|
|
attr_flags |= (int) ATTR_FLAG_FUNCTION_NEXT;
|
|
|
|
|
if (TREE_CODE (inner_decl) == ARRAY_REF)
|
|
|
|
|
attr_flags |= (int) ATTR_FLAG_ARRAY_NEXT;
|
|
|
|
|
returned_attrs = decl_attributes (&type,
|
|
|
|
|
chainon (returned_attrs, attrs),
|
|
|
|
|
attr_flags);
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (declarator) == ARRAY_REF)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree itype = NULL_TREE;
|
|
|
|
|
tree size = TREE_OPERAND (declarator, 1);
|
1994-03-19 12:29:25 +01:00
|
|
|
|
/* The index is a signed object `sizetype' bits wide. */
|
|
|
|
|
tree index_type = signed_type (sizetype);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-05-25 13:12:47 +02:00
|
|
|
|
array_ptr_quals = TREE_TYPE (declarator);
|
|
|
|
|
array_parm_static = TREE_STATIC (declarator);
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
declarator = TREE_OPERAND (declarator, 0);
|
|
|
|
|
|
|
|
|
|
/* Check for some types that there cannot be arrays of. */
|
|
|
|
|
|
2000-06-05 15:16:14 +02:00
|
|
|
|
if (VOID_TYPE_P (type))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error ("declaration of `%s' as array of voids", name);
|
|
|
|
|
type = error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (type) == FUNCTION_TYPE)
|
|
|
|
|
{
|
|
|
|
|
error ("declaration of `%s' as array of functions", name);
|
|
|
|
|
type = error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (size == error_mark_node)
|
|
|
|
|
type = error_mark_node;
|
|
|
|
|
|
|
|
|
|
if (type == error_mark_node)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* If size was specified, set ITYPE to a range-type for that size.
|
|
|
|
|
Otherwise, ITYPE remains null. finish_decl may figure it out
|
|
|
|
|
from an initial value. */
|
|
|
|
|
|
|
|
|
|
if (size)
|
|
|
|
|
{
|
|
|
|
|
/* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
|
1992-07-10 03:50:35 +02:00
|
|
|
|
STRIP_TYPE_NOPS (size);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-06-12 14:15:46 +02:00
|
|
|
|
if (! INTEGRAL_TYPE_P (TREE_TYPE (size)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error ("size of array `%s' has non-integer type", name);
|
|
|
|
|
size = integer_one_node;
|
|
|
|
|
}
|
1994-03-14 14:47:18 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (pedantic && integer_zerop (size))
|
c-common.c (combine_strings, [...]): Refer to ISO C or ISO C89 instead of ANSI C.
* c-common.c (combine_strings, check_format_info): Refer to ISO C
or ISO C89 instead of ANSI C.
* c-decl.c (grokdeclarator, xref_tag, finish_struct,
build_enumerator, do_case): Likewise.
* c-lex.c (parse_float, yylex): Likewise.
* c-parse.in: Likewise.
* c-typeck.c (common_type, build_array_ref, build_binary_op,
build_unary_op, pedantic_lvalue_warning, build_conditional_expr,
build_c_cast, convert_for_assignment, set_init_index,
set_init_label, c_expand_start_case): Likewise.
* toplev.c (documented_lang_options, display_help): Likewise.
From-SVN: r35576
2000-08-09 01:19:11 +02:00
|
|
|
|
pedwarn ("ISO C forbids zero-size array `%s'", name);
|
1994-03-14 14:47:18 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (TREE_CODE (size) == INTEGER_CST)
|
|
|
|
|
{
|
1993-02-02 05:38:30 +01:00
|
|
|
|
constant_expression_warning (size);
|
1994-03-14 14:47:18 +01:00
|
|
|
|
if (tree_int_cst_sgn (size) < 0)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error ("size of array `%s' is negative", name);
|
|
|
|
|
size = integer_one_node;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1994-03-14 14:47:18 +01:00
|
|
|
|
/* Make sure the array size remains visibly nonconstant
|
|
|
|
|
even if it is (eg) a const variable with known value. */
|
|
|
|
|
size_varies = 1;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (pedantic)
|
1993-03-16 05:53:55 +01:00
|
|
|
|
{
|
|
|
|
|
if (TREE_CONSTANT (size))
|
2000-08-11 00:01:22 +02:00
|
|
|
|
pedwarn ("ISO C89 forbids array `%s' whose size can't be evaluated",
|
|
|
|
|
name);
|
1993-03-16 05:53:55 +01:00
|
|
|
|
else
|
2000-08-11 00:01:22 +02:00
|
|
|
|
pedwarn ("ISO C89 forbids variable-size array `%s'",
|
|
|
|
|
name);
|
1993-03-16 05:53:55 +01:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
1994-03-14 14:47:18 +01:00
|
|
|
|
|
2000-11-19 09:36:18 +01:00
|
|
|
|
if (integer_zerop (size))
|
1997-11-02 22:19:36 +01:00
|
|
|
|
{
|
2000-11-19 09:36:18 +01:00
|
|
|
|
/* A zero-length array cannot be represented with an
|
|
|
|
|
unsigned index type, which is what we'll get with
|
2000-11-20 00:40:37 +01:00
|
|
|
|
build_index_type. Create an open-ended range instead. */
|
|
|
|
|
itype = build_range_type (sizetype, size, NULL_TREE);
|
1997-11-02 22:19:36 +01:00
|
|
|
|
}
|
2000-11-19 09:36:18 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Compute the maximum valid index, that is, size - 1.
|
|
|
|
|
Do the calculation in index_type, so that if it is
|
|
|
|
|
a variable the computations will be done in the
|
|
|
|
|
proper mode. */
|
|
|
|
|
itype = fold (build (MINUS_EXPR, index_type,
|
|
|
|
|
convert (index_type, size),
|
|
|
|
|
convert (index_type, size_one_node)));
|
|
|
|
|
|
|
|
|
|
/* If that overflowed, the array is too big.
|
|
|
|
|
??? While a size of INT_MAX+1 technically shouldn't
|
|
|
|
|
cause an overflow (because we subtract 1), the overflow
|
|
|
|
|
is recorded during the conversion to index_type, before
|
|
|
|
|
the subtraction. Handling this case seems like an
|
|
|
|
|
unnecessary complication. */
|
|
|
|
|
if (TREE_OVERFLOW (itype))
|
|
|
|
|
{
|
|
|
|
|
error ("size of array `%s' is too large", name);
|
|
|
|
|
type = error_mark_node;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
2000-11-19 09:36:18 +01:00
|
|
|
|
if (size_varies)
|
|
|
|
|
itype = variable_size (itype);
|
|
|
|
|
itype = build_index_type (itype);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
2000-11-20 00:40:37 +01:00
|
|
|
|
else if (decl_context == FIELD)
|
|
|
|
|
{
|
|
|
|
|
/* ??? Need to check somewhere that this is a structure
|
2001-01-02 08:00:49 +01:00
|
|
|
|
and not a union, that this field is last, and that
|
2000-11-20 00:40:37 +01:00
|
|
|
|
this structure has at least one other named member. */
|
|
|
|
|
|
|
|
|
|
if (pedantic && !flag_isoc99 && !in_system_header)
|
|
|
|
|
pedwarn ("ISO C89 does not support flexible array members");
|
|
|
|
|
|
|
|
|
|
/* ISO C99 Flexible array members are effectively identical
|
|
|
|
|
to GCC's zero-length array extension. */
|
|
|
|
|
itype = build_range_type (sizetype, size_zero_node, NULL_TREE);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-12-01 20:21:44 +01:00
|
|
|
|
/* If pedantic, complain about arrays of incomplete types. */
|
|
|
|
|
|
|
|
|
|
if (pedantic && !COMPLETE_TYPE_P (type))
|
|
|
|
|
pedwarn ("array type has incomplete element type");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
#if 0
|
|
|
|
|
/* We shouldn't have a function type here at all!
|
|
|
|
|
Functions aren't allowed as array elements. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
|
|
|
|
&& (constp || volatilep))
|
2001-12-03 20:15:19 +01:00
|
|
|
|
pedwarn ("ISO C forbids const or volatile function types");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#endif
|
1993-05-04 02:10:51 +02:00
|
|
|
|
|
|
|
|
|
/* Build the array type itself, then merge any constancy or
|
|
|
|
|
volatility into the target type. We must do it in this order
|
|
|
|
|
to ensure that the TYPE_MAIN_VARIANT field of the array type
|
|
|
|
|
is set correctly. */
|
|
|
|
|
|
|
|
|
|
type = build_array_type (type, itype);
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (type_quals)
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1992-03-23 03:07:53 +01:00
|
|
|
|
if (size_varies)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
C_TYPE_VARIABLE_SIZE (type) = 1;
|
2001-01-04 02:14:16 +01:00
|
|
|
|
|
|
|
|
|
/* The GCC extension for zero-length arrays differs from
|
|
|
|
|
ISO flexible array members in that sizeof yields zero. */
|
|
|
|
|
if (size && integer_zerop (size))
|
|
|
|
|
{
|
|
|
|
|
layout_type (type);
|
|
|
|
|
TYPE_SIZE (type) = bitsize_zero_node;
|
|
|
|
|
TYPE_SIZE_UNIT (type) = size_zero_node;
|
|
|
|
|
}
|
2001-05-25 13:12:47 +02:00
|
|
|
|
if (decl_context != PARM
|
|
|
|
|
&& (array_ptr_quals != NULL_TREE || array_parm_static))
|
|
|
|
|
{
|
|
|
|
|
error ("static or type qualifiers in non-parameter array declarator");
|
|
|
|
|
array_ptr_quals = NULL_TREE;
|
|
|
|
|
array_parm_static = 0;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (declarator) == CALL_EXPR)
|
|
|
|
|
{
|
|
|
|
|
tree arg_types;
|
|
|
|
|
|
|
|
|
|
/* Declaring a function type.
|
|
|
|
|
Make sure we have a valid type for the function to return. */
|
|
|
|
|
if (type == error_mark_node)
|
|
|
|
|
continue;
|
|
|
|
|
|
1992-03-23 03:07:53 +01:00
|
|
|
|
size_varies = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Warn about some types functions can't return. */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (type) == FUNCTION_TYPE)
|
|
|
|
|
{
|
|
|
|
|
error ("`%s' declared as function returning a function", name);
|
|
|
|
|
type = integer_type_node;
|
|
|
|
|
}
|
|
|
|
|
if (TREE_CODE (type) == ARRAY_TYPE)
|
|
|
|
|
{
|
|
|
|
|
error ("`%s' declared as function returning an array", name);
|
|
|
|
|
type = integer_type_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef TRADITIONAL_RETURN_FLOAT
|
|
|
|
|
/* Traditionally, declaring return type float means double. */
|
|
|
|
|
|
1992-07-15 20:34:18 +02:00
|
|
|
|
if (flag_traditional && TYPE_MAIN_VARIANT (type) == float_type_node)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
type = double_type_node;
|
|
|
|
|
#endif /* TRADITIONAL_RETURN_FLOAT */
|
|
|
|
|
|
|
|
|
|
/* Construct the function type and go to the next
|
|
|
|
|
inner layer of declarator. */
|
|
|
|
|
|
|
|
|
|
arg_types = grokparms (TREE_OPERAND (declarator, 1),
|
|
|
|
|
funcdef_flag
|
|
|
|
|
/* Say it's a definition
|
|
|
|
|
only for the CALL_EXPR
|
|
|
|
|
closest to the identifier. */
|
|
|
|
|
&& TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE);
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
/* Type qualifiers before the return type of the function
|
|
|
|
|
qualify the return type, not the function type. */
|
|
|
|
|
if (type_quals)
|
2000-10-25 19:45:44 +02:00
|
|
|
|
{
|
|
|
|
|
/* Type qualifiers on a function return type are normally
|
|
|
|
|
permitted by the standard but have no effect, so give a
|
|
|
|
|
warning at -W. Qualifiers on a void return type have
|
|
|
|
|
meaning as a GNU extension, and are banned on function
|
|
|
|
|
definitions in ISO C. FIXME: strictly we shouldn't
|
|
|
|
|
pedwarn for qualified void return types except on function
|
|
|
|
|
definitions, but not doing so could lead to the undesirable
|
|
|
|
|
state of a "volatile void" function return type not being
|
|
|
|
|
warned about, and a use of the function being compiled
|
|
|
|
|
with GNU semantics, with no diagnostics under -pedantic. */
|
|
|
|
|
if (VOID_TYPE_P (type) && pedantic && !in_system_header)
|
|
|
|
|
pedwarn ("ISO C forbids qualified void function return type");
|
|
|
|
|
else if (extra_warnings
|
|
|
|
|
&& !(VOID_TYPE_P (type)
|
|
|
|
|
&& type_quals == TYPE_QUAL_VOLATILE))
|
|
|
|
|
warning ("type qualifiers ignored on function return type");
|
|
|
|
|
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
|
|
|
|
}
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
type_quals = TYPE_UNQUALIFIED;
|
1993-08-06 03:11:37 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
type = build_function_type (type, arg_types);
|
|
|
|
|
declarator = TREE_OPERAND (declarator, 0);
|
|
|
|
|
|
|
|
|
|
/* Set the TYPE_CONTEXTs for each tagged type which is local to
|
|
|
|
|
the formal parameter list of this FUNCTION_TYPE to point to
|
|
|
|
|
the FUNCTION_TYPE node itself. */
|
|
|
|
|
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree link;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1998-01-26 19:13:41 +01:00
|
|
|
|
for (link = last_function_parm_tags;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
link;
|
|
|
|
|
link = TREE_CHAIN (link))
|
|
|
|
|
TYPE_CONTEXT (TREE_VALUE (link)) = type;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (declarator) == INDIRECT_REF)
|
|
|
|
|
{
|
|
|
|
|
/* Merge any constancy or volatility into the target type
|
|
|
|
|
for the pointer. */
|
|
|
|
|
|
|
|
|
|
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
&& type_quals)
|
c-common.c (combine_strings, [...]): Refer to ISO C or ISO C89 instead of ANSI C.
* c-common.c (combine_strings, check_format_info): Refer to ISO C
or ISO C89 instead of ANSI C.
* c-decl.c (grokdeclarator, xref_tag, finish_struct,
build_enumerator, do_case): Likewise.
* c-lex.c (parse_float, yylex): Likewise.
* c-parse.in: Likewise.
* c-typeck.c (common_type, build_array_ref, build_binary_op,
build_unary_op, pedantic_lvalue_warning, build_conditional_expr,
build_c_cast, convert_for_assignment, set_init_index,
set_init_label, c_expand_start_case): Likewise.
* toplev.c (documented_lang_options, display_help): Likewise.
From-SVN: r35576
2000-08-09 01:19:11 +02:00
|
|
|
|
pedwarn ("ISO C forbids qualified function types");
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (type_quals)
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
|
|
|
|
type_quals = TYPE_UNQUALIFIED;
|
1992-03-23 03:07:53 +01:00
|
|
|
|
size_varies = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
type = build_pointer_type (type);
|
|
|
|
|
|
|
|
|
|
/* Process a list of type modifier keywords
|
|
|
|
|
(such as const or volatile) that were given inside the `*'. */
|
|
|
|
|
|
|
|
|
|
if (TREE_TYPE (declarator))
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree typemodlist;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int erred = 0;
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
|
|
|
|
|
constp = 0;
|
|
|
|
|
volatilep = 0;
|
|
|
|
|
restrictp = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
for (typemodlist = TREE_TYPE (declarator); typemodlist;
|
|
|
|
|
typemodlist = TREE_CHAIN (typemodlist))
|
|
|
|
|
{
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
tree qualifier = TREE_VALUE (typemodlist);
|
|
|
|
|
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
if (C_IS_RESERVED_WORD (qualifier))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
if (C_RID_CODE (qualifier) == RID_CONST)
|
|
|
|
|
constp++;
|
|
|
|
|
else if (C_RID_CODE (qualifier) == RID_VOLATILE)
|
|
|
|
|
volatilep++;
|
|
|
|
|
else if (C_RID_CODE (qualifier) == RID_RESTRICT)
|
|
|
|
|
restrictp++;
|
|
|
|
|
else
|
|
|
|
|
erred++;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
else
|
|
|
|
|
erred++;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
|
|
|
|
|
if (erred)
|
|
|
|
|
error ("invalid type modifier within pointer declarator");
|
2000-06-26 18:42:23 +02:00
|
|
|
|
if (constp > 1 && ! flag_isoc99)
|
1992-07-06 00:22:43 +02:00
|
|
|
|
pedwarn ("duplicate `const'");
|
2000-06-26 18:42:23 +02:00
|
|
|
|
if (volatilep > 1 && ! flag_isoc99)
|
1992-07-06 00:22:43 +02:00
|
|
|
|
pedwarn ("duplicate `volatile'");
|
2000-06-26 18:42:23 +02:00
|
|
|
|
if (restrictp > 1 && ! flag_isoc99)
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
pedwarn ("duplicate `restrict'");
|
|
|
|
|
|
|
|
|
|
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
|
|
|
|
|
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
|
|
|
|
|
| (volatilep ? TYPE_QUAL_VOLATILE : 0));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declarator = TREE_OPERAND (declarator, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now TYPE has the actual type. */
|
|
|
|
|
|
1997-11-02 22:19:36 +01:00
|
|
|
|
/* Did array size calculations overflow? */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (type) == ARRAY_TYPE
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
&& COMPLETE_TYPE_P (type)
|
1997-11-02 22:19:36 +01:00
|
|
|
|
&& TREE_OVERFLOW (TYPE_SIZE (type)))
|
2000-12-29 09:03:56 +01:00
|
|
|
|
{
|
|
|
|
|
error ("size of array `%s' is too large", name);
|
ChangeLog.2, [...]: Fix spelling errors and typos.
* ChangeLog.2, ChangeLog.3, ChangeLog.4, FSFChangeLog.10,
FSFChangeLog.11, c-common.c, c-common.def, c-common.h, c-decl.c,
c-dump.c, c-typeck.c, except.c, sdbout.c, simplify-rtx.c,
timevar.h, tree.h, varasm.c: Fix spelling errors and typos.
From-SVN: r46621
2001-10-30 00:01:45 +01:00
|
|
|
|
/* If we proceed with the array type as it is, we'll eventually
|
2000-12-29 09:03:56 +01:00
|
|
|
|
crash in tree_low_cst(). */
|
|
|
|
|
type = error_mark_node;
|
|
|
|
|
}
|
1997-11-02 22:19:36 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* If this is declaring a typedef name, return a TYPE_DECL. */
|
|
|
|
|
|
|
|
|
|
if (specbits & (1 << (int) RID_TYPEDEF))
|
|
|
|
|
{
|
|
|
|
|
tree decl;
|
|
|
|
|
/* Note that the grammar rejects storage classes
|
|
|
|
|
in typenames, fields or parameters */
|
|
|
|
|
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
&& type_quals)
|
c-common.c (combine_strings, [...]): Refer to ISO C or ISO C89 instead of ANSI C.
* c-common.c (combine_strings, check_format_info): Refer to ISO C
or ISO C89 instead of ANSI C.
* c-decl.c (grokdeclarator, xref_tag, finish_struct,
build_enumerator, do_case): Likewise.
* c-lex.c (parse_float, yylex): Likewise.
* c-parse.in: Likewise.
* c-typeck.c (common_type, build_array_ref, build_binary_op,
build_unary_op, pedantic_lvalue_warning, build_conditional_expr,
build_c_cast, convert_for_assignment, set_init_index,
set_init_label, c_expand_start_case): Likewise.
* toplev.c (documented_lang_options, display_help): Likewise.
From-SVN: r35576
2000-08-09 01:19:11 +02:00
|
|
|
|
pedwarn ("ISO C forbids qualified function types");
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (type_quals)
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
decl = build_decl (TYPE_DECL, declarator, type);
|
|
|
|
|
if ((specbits & (1 << (int) RID_SIGNED))
|
|
|
|
|
|| (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
|
|
|
|
|
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
decl_attributes (&decl, returned_attrs, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Detect the case of an array type of unspecified size
|
|
|
|
|
which came, as such, direct from a typedef name.
|
|
|
|
|
We must copy the type, so that each identifier gets
|
|
|
|
|
a distinct type, so that each identifier's size can be
|
|
|
|
|
controlled separately by its own initializer. */
|
|
|
|
|
|
|
|
|
|
if (type != 0 && typedef_type != 0
|
2000-09-17 16:37:55 +02:00
|
|
|
|
&& TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0
|
|
|
|
|
&& TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (typedef_type))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
type = build_array_type (TREE_TYPE (type), 0);
|
1992-03-23 03:07:53 +01:00
|
|
|
|
if (size_varies)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
C_TYPE_VARIABLE_SIZE (type) = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If this is a type name (such as, in a cast or sizeof),
|
|
|
|
|
compute the type and return it now. */
|
|
|
|
|
|
|
|
|
|
if (decl_context == TYPENAME)
|
|
|
|
|
{
|
|
|
|
|
/* Note that the grammar rejects storage classes
|
|
|
|
|
in typenames, fields or parameters */
|
|
|
|
|
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
&& type_quals)
|
c-common.c (combine_strings, [...]): Refer to ISO C or ISO C89 instead of ANSI C.
* c-common.c (combine_strings, check_format_info): Refer to ISO C
or ISO C89 instead of ANSI C.
* c-decl.c (grokdeclarator, xref_tag, finish_struct,
build_enumerator, do_case): Likewise.
* c-lex.c (parse_float, yylex): Likewise.
* c-parse.in: Likewise.
* c-typeck.c (common_type, build_array_ref, build_binary_op,
build_unary_op, pedantic_lvalue_warning, build_conditional_expr,
build_c_cast, convert_for_assignment, set_init_index,
set_init_label, c_expand_start_case): Likewise.
* toplev.c (documented_lang_options, display_help): Likewise.
From-SVN: r35576
2000-08-09 01:19:11 +02:00
|
|
|
|
pedwarn ("ISO C forbids const or volatile function types");
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (type_quals)
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
decl_attributes (&type, returned_attrs, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
1993-08-06 03:11:37 +02:00
|
|
|
|
/* Aside from typedefs and type names (handle above),
|
|
|
|
|
`void' at top level (not within pointer)
|
|
|
|
|
is allowed only in public variables.
|
1992-02-13 23:21:26 +01:00
|
|
|
|
We don't complain about parms either, but that is because
|
|
|
|
|
a better error message can be made later. */
|
|
|
|
|
|
2000-06-05 15:16:14 +02:00
|
|
|
|
if (VOID_TYPE_P (type) && decl_context != PARM
|
1993-08-06 03:11:37 +02:00
|
|
|
|
&& ! ((decl_context != FIELD && TREE_CODE (type) != FUNCTION_TYPE)
|
|
|
|
|
&& ((specbits & (1 << (int) RID_EXTERN))
|
|
|
|
|
|| (current_binding_level == global_binding_level
|
|
|
|
|
&& !(specbits
|
|
|
|
|
& ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER)))))))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1995-02-11 21:16:04 +01:00
|
|
|
|
error ("variable or field `%s' declared void", name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
type = integer_type_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now create the decl, which may be a VAR_DECL, a PARM_DECL
|
|
|
|
|
or a FUNCTION_DECL, depending on DECL_CONTEXT and TYPE. */
|
|
|
|
|
|
|
|
|
|
{
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
tree decl;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (decl_context == PARM)
|
|
|
|
|
{
|
2001-06-09 00:33:46 +02:00
|
|
|
|
tree type_as_written;
|
1999-09-08 06:51:16 +02:00
|
|
|
|
tree promoted_type;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* A parameter declared as an array of T is really a pointer to T.
|
|
|
|
|
One declared as a function is really a pointer to a function. */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (type) == ARRAY_TYPE)
|
|
|
|
|
{
|
|
|
|
|
/* Transfer const-ness of array into that of type pointed to. */
|
1993-09-06 00:35:15 +02:00
|
|
|
|
type = TREE_TYPE (type);
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (type_quals)
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
1993-09-06 00:35:15 +02:00
|
|
|
|
type = build_pointer_type (type);
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
type_quals = TYPE_UNQUALIFIED;
|
2001-05-25 13:12:47 +02:00
|
|
|
|
if (array_ptr_quals)
|
|
|
|
|
{
|
|
|
|
|
tree new_ptr_quals, new_ptr_attrs;
|
|
|
|
|
int erred = 0;
|
|
|
|
|
split_specs_attrs (array_ptr_quals, &new_ptr_quals, &new_ptr_attrs);
|
|
|
|
|
/* We don't yet implement attributes in this context. */
|
|
|
|
|
if (new_ptr_attrs != NULL_TREE)
|
|
|
|
|
warning ("attributes in parameter array declarator ignored");
|
|
|
|
|
|
|
|
|
|
constp = 0;
|
|
|
|
|
volatilep = 0;
|
|
|
|
|
restrictp = 0;
|
|
|
|
|
for (; new_ptr_quals; new_ptr_quals = TREE_CHAIN (new_ptr_quals))
|
|
|
|
|
{
|
|
|
|
|
tree qualifier = TREE_VALUE (new_ptr_quals);
|
|
|
|
|
|
|
|
|
|
if (C_IS_RESERVED_WORD (qualifier))
|
|
|
|
|
{
|
|
|
|
|
if (C_RID_CODE (qualifier) == RID_CONST)
|
|
|
|
|
constp++;
|
|
|
|
|
else if (C_RID_CODE (qualifier) == RID_VOLATILE)
|
|
|
|
|
volatilep++;
|
|
|
|
|
else if (C_RID_CODE (qualifier) == RID_RESTRICT)
|
|
|
|
|
restrictp++;
|
|
|
|
|
else
|
|
|
|
|
erred++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
erred++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (erred)
|
|
|
|
|
error ("invalid type modifier within array declarator");
|
|
|
|
|
|
|
|
|
|
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
|
|
|
|
|
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
|
|
|
|
|
| (volatilep ? TYPE_QUAL_VOLATILE : 0));
|
|
|
|
|
}
|
1992-03-23 03:07:53 +01:00
|
|
|
|
size_varies = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (type) == FUNCTION_TYPE)
|
|
|
|
|
{
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (pedantic && type_quals)
|
c-common.c (combine_strings, [...]): Refer to ISO C or ISO C89 instead of ANSI C.
* c-common.c (combine_strings, check_format_info): Refer to ISO C
or ISO C89 instead of ANSI C.
* c-decl.c (grokdeclarator, xref_tag, finish_struct,
build_enumerator, do_case): Likewise.
* c-lex.c (parse_float, yylex): Likewise.
* c-parse.in: Likewise.
* c-typeck.c (common_type, build_array_ref, build_binary_op,
build_unary_op, pedantic_lvalue_warning, build_conditional_expr,
build_c_cast, convert_for_assignment, set_init_index,
set_init_label, c_expand_start_case): Likewise.
* toplev.c (documented_lang_options, display_help): Likewise.
From-SVN: r35576
2000-08-09 01:19:11 +02:00
|
|
|
|
pedwarn ("ISO C forbids qualified function types");
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (type_quals)
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
1993-09-06 00:35:15 +02:00
|
|
|
|
type = build_pointer_type (type);
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
type_quals = TYPE_UNQUALIFIED;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
2001-06-09 00:33:46 +02:00
|
|
|
|
else if (type_quals)
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
|
|
|
|
|
|
|
|
|
type_as_written = type;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
decl = build_decl (PARM_DECL, declarator, type);
|
1992-03-23 03:07:53 +01:00
|
|
|
|
if (size_varies)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
C_DECL_VARIABLE_SIZE (decl) = 1;
|
|
|
|
|
|
|
|
|
|
/* Compute the type actually passed in the parmlist,
|
|
|
|
|
for the case where there is no prototype.
|
|
|
|
|
(For example, shorts and chars are passed as ints.)
|
|
|
|
|
When there is a prototype, this is overridden later. */
|
|
|
|
|
|
1999-09-08 06:51:16 +02:00
|
|
|
|
if (type == error_mark_node)
|
|
|
|
|
promoted_type = type;
|
|
|
|
|
else
|
1992-05-15 04:18:01 +02:00
|
|
|
|
{
|
1999-09-08 06:51:16 +02:00
|
|
|
|
promoted_type = simple_type_promotes_to (type);
|
|
|
|
|
if (! promoted_type)
|
|
|
|
|
promoted_type = type;
|
1992-05-15 04:18:01 +02:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1999-09-08 06:51:16 +02:00
|
|
|
|
DECL_ARG_TYPE (decl) = promoted_type;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
DECL_ARG_TYPE_AS_WRITTEN (decl) = type_as_written;
|
|
|
|
|
}
|
|
|
|
|
else if (decl_context == FIELD)
|
|
|
|
|
{
|
|
|
|
|
/* Structure field. It may not be a function. */
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (type) == FUNCTION_TYPE)
|
|
|
|
|
{
|
1995-02-11 21:16:04 +01:00
|
|
|
|
error ("field `%s' declared as a function", name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
type = build_pointer_type (type);
|
|
|
|
|
}
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
else if (TREE_CODE (type) != ERROR_MARK
|
|
|
|
|
&& !COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (type))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1995-02-11 21:16:04 +01:00
|
|
|
|
error ("field `%s' has incomplete type", name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
type = error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
/* Move type qualifiers down to element of an array. */
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (TREE_CODE (type) == ARRAY_TYPE && type_quals)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
type = build_array_type (c_build_qualified_type (TREE_TYPE (type),
|
|
|
|
|
type_quals),
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TYPE_DOMAIN (type));
|
2000-08-11 00:01:22 +02:00
|
|
|
|
#if 0
|
|
|
|
|
/* Leave the field const or volatile as well. */
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
type_quals = TYPE_UNQUALIFIED;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
decl = build_decl (FIELD_DECL, declarator, type);
|
2000-06-03 03:57:46 +02:00
|
|
|
|
DECL_NONADDRESSABLE_P (decl) = bitfield;
|
|
|
|
|
|
1992-03-23 03:07:53 +01:00
|
|
|
|
if (size_varies)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
C_DECL_VARIABLE_SIZE (decl) = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (type) == FUNCTION_TYPE)
|
|
|
|
|
{
|
1992-09-16 02:54:45 +02:00
|
|
|
|
/* Every function declaration is "external"
|
|
|
|
|
except for those which are inside a function body
|
|
|
|
|
in which `auto' is used.
|
|
|
|
|
That is a case not specified by ANSI C,
|
|
|
|
|
and we use it for forward declarations for nested functions. */
|
|
|
|
|
int extern_ref = (!(specbits & (1 << (int) RID_AUTO))
|
|
|
|
|
|| current_binding_level == global_binding_level);
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (specbits & (1 << (int) RID_AUTO)
|
|
|
|
|
&& (pedantic || current_binding_level == global_binding_level))
|
1995-02-11 21:16:04 +01:00
|
|
|
|
pedwarn ("invalid storage class for function `%s'", name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (specbits & (1 << (int) RID_REGISTER))
|
1995-02-11 21:16:04 +01:00
|
|
|
|
error ("invalid storage class for function `%s'", name);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Function declaration not at top level.
|
|
|
|
|
Storage classes other than `extern' are not allowed
|
|
|
|
|
and `extern' makes no difference. */
|
|
|
|
|
if (current_binding_level != global_binding_level
|
|
|
|
|
&& (specbits & ((1 << (int) RID_STATIC) | (1 << (int) RID_INLINE)))
|
|
|
|
|
&& pedantic)
|
1995-02-11 21:16:04 +01:00
|
|
|
|
pedwarn ("invalid storage class for function `%s'", name);
|
1992-09-16 02:54:45 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
decl = build_decl (FUNCTION_DECL, declarator, type);
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
decl = build_decl_attribute_variant (decl, decl_attr);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-10-08 18:37:06 +02:00
|
|
|
|
DECL_LANG_SPECIFIC (decl) = (struct lang_decl *)
|
|
|
|
|
ggc_alloc_cleared (sizeof (struct lang_decl));
|
|
|
|
|
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (pedantic && type_quals && ! DECL_IN_SYSTEM_HEADER (decl))
|
c-common.c (combine_strings, [...]): Refer to ISO C or ISO C89 instead of ANSI C.
* c-common.c (combine_strings, check_format_info): Refer to ISO C
or ISO C89 instead of ANSI C.
* c-decl.c (grokdeclarator, xref_tag, finish_struct,
build_enumerator, do_case): Likewise.
* c-lex.c (parse_float, yylex): Likewise.
* c-parse.in: Likewise.
* c-typeck.c (common_type, build_array_ref, build_binary_op,
build_unary_op, pedantic_lvalue_warning, build_conditional_expr,
build_c_cast, convert_for_assignment, set_init_index,
set_init_label, c_expand_start_case): Likewise.
* toplev.c (documented_lang_options, display_help): Likewise.
From-SVN: r35576
2000-08-09 01:19:11 +02:00
|
|
|
|
pedwarn ("ISO C forbids qualified function types");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
/* GNU C interprets a `volatile void' return type to indicate
|
|
|
|
|
that the function does not return. */
|
|
|
|
|
if ((type_quals & TYPE_QUAL_VOLATILE)
|
2000-06-05 15:16:14 +02:00
|
|
|
|
&& !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
|
1994-02-01 17:21:23 +01:00
|
|
|
|
warning ("`noreturn' function returns non-void value");
|
1993-08-06 03:11:37 +02:00
|
|
|
|
|
1992-09-16 02:54:45 +02:00
|
|
|
|
if (extern_ref)
|
1992-07-12 04:56:45 +02:00
|
|
|
|
DECL_EXTERNAL (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Record absence of global scope for `static' or `auto'. */
|
|
|
|
|
TREE_PUBLIC (decl)
|
|
|
|
|
= !(specbits & ((1 << (int) RID_STATIC) | (1 << (int) RID_AUTO)));
|
1995-02-11 21:16:04 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Record presence of `inline', if it is reasonable. */
|
2001-10-08 18:37:06 +02:00
|
|
|
|
if (MAIN_NAME_P (declarator))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-10-08 18:37:06 +02:00
|
|
|
|
if (inlinep)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning ("cannot inline function `main'");
|
2001-10-08 18:37:06 +02:00
|
|
|
|
}
|
|
|
|
|
else if (inlinep)
|
|
|
|
|
{
|
|
|
|
|
/* Assume that otherwise the function can be inlined. */
|
|
|
|
|
DECL_INLINE (decl) = 1;
|
|
|
|
|
DECL_DECLARED_INLINE_P (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (specbits & (1 << (int) RID_EXTERN))
|
|
|
|
|
current_extern_inline = 1;
|
|
|
|
|
}
|
2001-10-08 18:37:06 +02:00
|
|
|
|
/* If -finline-functions, assume it can be inlined. This does
|
|
|
|
|
two things: let the function be deferred until it is actually
|
|
|
|
|
needed, and let dwarf2 know that the function is inlinable. */
|
|
|
|
|
else if (flag_inline_trees == 2)
|
|
|
|
|
{
|
|
|
|
|
DECL_INLINE (decl) = 1;
|
|
|
|
|
DECL_DECLARED_INLINE_P (decl) = 0;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* It's a variable. */
|
1992-09-16 02:54:45 +02:00
|
|
|
|
/* An uninitialized decl with `extern' is a reference. */
|
|
|
|
|
int extern_ref = !initialized && (specbits & (1 << (int) RID_EXTERN));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Move type qualifiers down to element of an array. */
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
if (TREE_CODE (type) == ARRAY_TYPE && type_quals)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-12-08 02:10:40 +01:00
|
|
|
|
int saved_align = TYPE_ALIGN(type);
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
type = build_array_type (c_build_qualified_type (TREE_TYPE (type),
|
|
|
|
|
type_quals),
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TYPE_DOMAIN (type));
|
2000-12-08 02:10:40 +01:00
|
|
|
|
TYPE_ALIGN (type) = saved_align;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#if 0 /* Leave the variable const or volatile as well. */
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
type_quals = TYPE_UNQUALIFIED;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#endif
|
|
|
|
|
}
|
2001-06-09 00:33:46 +02:00
|
|
|
|
else if (type_quals)
|
|
|
|
|
type = c_build_qualified_type (type, type_quals);
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
decl = build_decl (VAR_DECL, declarator, type);
|
1992-03-23 03:07:53 +01:00
|
|
|
|
if (size_varies)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
C_DECL_VARIABLE_SIZE (decl) = 1;
|
|
|
|
|
|
|
|
|
|
if (inlinep)
|
|
|
|
|
pedwarn_with_decl (decl, "variable `%s' declared `inline'");
|
|
|
|
|
|
1992-09-16 02:54:45 +02:00
|
|
|
|
DECL_EXTERNAL (decl) = extern_ref;
|
1992-07-01 23:40:06 +02:00
|
|
|
|
/* At top level, the presence of a `static' or `register' storage
|
|
|
|
|
class specifier, or the absence of all storage class specifiers
|
|
|
|
|
makes this declaration a definition (perhaps tentative). Also,
|
|
|
|
|
the absence of both `static' and `register' makes it public. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (current_binding_level == global_binding_level)
|
|
|
|
|
{
|
1992-07-01 23:40:06 +02:00
|
|
|
|
TREE_PUBLIC (decl)
|
|
|
|
|
= !(specbits
|
|
|
|
|
& ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER)));
|
1992-07-12 04:56:45 +02:00
|
|
|
|
TREE_STATIC (decl) = ! DECL_EXTERNAL (decl);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
/* Not at top level, only `static' makes a static definition. */
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TREE_STATIC (decl) = (specbits & (1 << (int) RID_STATIC)) != 0;
|
1992-07-12 04:56:45 +02:00
|
|
|
|
TREE_PUBLIC (decl) = DECL_EXTERNAL (decl);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record `register' declaration for warnings on &
|
|
|
|
|
and in case doing stupid register allocation. */
|
|
|
|
|
|
|
|
|
|
if (specbits & (1 << (int) RID_REGISTER))
|
1992-07-12 04:56:45 +02:00
|
|
|
|
DECL_REGISTER (decl) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Record constancy and volatility. */
|
invoke.texi: Document -flang-isoc9x.
* invoke.texi: Document -flang-isoc9x.
* Makefile.in (OBJS): Add splay-tree.o.
(c-common.o): Depend on rtl.h.
(splay-tree.o): List dependencies and provide build rule.
* rtl.h (record_alias_subset): New function.
* alias.c: Include splay-tree.h.
(alias_set_entry): New type.
(CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove.
(DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p.
(mems_in_disjoin_alias_sets_p): New function.
(alias_set_compare): Likewise.
(insert_subset_children): Likewise.
(get_alias_set_entry): Likewise.
* tree.h (TYPE_RESTRICT): New macro.
(TYPE_UNQUALIFIED): New manifest constant.
(TYPE_QUAL_CONST): Likewise
(TYPE_QUAL_VOLATILE): Likewise.
(TYPE_QUAL_RESTRICT): Likewise.
(tree_type): Add restrict_flag. Reduce count of free bits.
(DECL_POINTER_ALIAS_SET): New macro.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(tree_decl): Add pointer_alias_set.
(build_qualified_type): New function.
(build_type_variant): Define in terms of build_qualified_type.
* tree.c (set_type_quals): New function.
(make_node): Initializae DECL_POINTER_ALIAS_SET.
(build_type_attribute_variant): Use build_qualified_type and
set_type_quals.
(build_type_variant): Rename, and modify, to become...
(build_qualified_type): New function.
(build_complex_type): Use set_type_quals.
* c-tree.h (C_TYPE_OBJECT_P): New macro.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(c_apply_type_quals_to_decl): New function.
(c_build_qualified_type): New function.
(c_build_type_variant): Define in terms of c_build_qualified_type.
(flag_isoc9x): Declare.
* c-typeck.c (qualify_type): Use c_build_qualified_type.
(common_type): Change to use TYPE_QUALS.
(comptypes): Likewise.
(convert_for_assignment): Likewise.
* c-aux-info.c (gen_type): Likewise. Deal with `restrict'.
* c-decl.c (flag_isoc9x): Define.
(c_decode_option): Handle -flang-isoc9x.
(grokdeclarator): Update to handle restrict. Use TYPE_QUALS,
c_build_qualified_type, etc. Use c_apply_type_quals_to_decl.
* c-lex.c (init_lex): Deal with restrict.
(init_lex): Don't treat restrict as a reserved word in
-traditional mode, or without -flang-isoc9x.
* c-lex.h (rid): Add RID_RESTRICT.
* c-parse.gperf (restrict, __restrict, __restrict__): Make
equivalent to RID_RESTRICT.
* c-parse.in (TYPE_QUAL): Update comment.
* c-common.c: Include rtl.h.
(c_find_base_decl): New function.
(c_build_type_variant): Rename, and modify, to become ...
(c_build_qualified_type): New function.
(c_apply_type_quals_to_decl): Likewise.
(c_get_alias_set): For INDIRECT_REFs, check to see if we can find
a particular alias set for the reference.
* toplev.c (documented_lang_options): Add -flang-isoc9x.
From-SVN: r23212
1998-10-21 11:53:40 +02:00
|
|
|
|
c_apply_type_quals_to_decl (type_quals, decl);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* If a type has volatile components, it should be stored in memory.
|
|
|
|
|
Otherwise, the fact that those components are volatile
|
|
|
|
|
will be ignored, and would even crash the compiler. */
|
|
|
|
|
if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (decl)))
|
|
|
|
|
mark_addressable (decl);
|
|
|
|
|
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
decl_attributes (&decl, returned_attrs, 0);
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Decode the parameter-list info for a function type or function definition.
|
|
|
|
|
The argument is the value returned by `get_parm_info' (or made in parse.y
|
|
|
|
|
if there is an identifier list instead of a parameter decl list).
|
|
|
|
|
These two functions are separate because when a function returns
|
|
|
|
|
or receives functions then each is called multiple times but the order
|
|
|
|
|
of calls is different. The last call to `grokparms' is always the one
|
|
|
|
|
that contains the formal parameter names of a function definition.
|
|
|
|
|
|
|
|
|
|
Store in `last_function_parms' a chain of the decls of parms.
|
|
|
|
|
Also store in `last_function_parm_tags' a chain of the struct, union,
|
|
|
|
|
and enum tags declared among the parms.
|
|
|
|
|
|
|
|
|
|
Return a list of arg types to use in the FUNCTION_TYPE for this function.
|
|
|
|
|
|
|
|
|
|
FUNCDEF_FLAG is nonzero for a function definition, 0 for
|
|
|
|
|
a mere declaration. A nonempty identifier-list gets an error message
|
|
|
|
|
when FUNCDEF_FLAG is zero. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
grokparms (parms_info, funcdef_flag)
|
|
|
|
|
tree parms_info;
|
|
|
|
|
int funcdef_flag;
|
|
|
|
|
{
|
|
|
|
|
tree first_parm = TREE_CHAIN (parms_info);
|
|
|
|
|
|
|
|
|
|
last_function_parms = TREE_PURPOSE (parms_info);
|
|
|
|
|
last_function_parm_tags = TREE_VALUE (parms_info);
|
|
|
|
|
|
1992-07-31 08:14:04 +02:00
|
|
|
|
if (warn_strict_prototypes && first_parm == 0 && !funcdef_flag
|
|
|
|
|
&& !in_system_header)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning ("function declaration isn't a prototype");
|
|
|
|
|
|
|
|
|
|
if (first_parm != 0
|
|
|
|
|
&& TREE_CODE (TREE_VALUE (first_parm)) == IDENTIFIER_NODE)
|
|
|
|
|
{
|
|
|
|
|
if (! funcdef_flag)
|
|
|
|
|
pedwarn ("parameter names (without types) in function declaration");
|
|
|
|
|
|
|
|
|
|
last_function_parms = first_parm;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree parm;
|
|
|
|
|
tree typelt;
|
|
|
|
|
/* We no longer test FUNCDEF_FLAG.
|
|
|
|
|
If the arg types are incomplete in a declaration,
|
|
|
|
|
they must include undefined tags.
|
|
|
|
|
These tags can never be defined in the scope of the declaration,
|
|
|
|
|
so the types can never be completed,
|
|
|
|
|
and no call can be compiled successfully. */
|
|
|
|
|
#if 0
|
|
|
|
|
/* In a fcn definition, arg types must be complete. */
|
|
|
|
|
if (funcdef_flag)
|
|
|
|
|
#endif
|
|
|
|
|
for (parm = last_function_parms, typelt = first_parm;
|
|
|
|
|
parm;
|
|
|
|
|
parm = TREE_CHAIN (parm))
|
|
|
|
|
/* Skip over any enumeration constants declared here. */
|
|
|
|
|
if (TREE_CODE (parm) == PARM_DECL)
|
|
|
|
|
{
|
|
|
|
|
/* Barf if the parameter itself has an incomplete type. */
|
|
|
|
|
tree type = TREE_VALUE (typelt);
|
2000-12-01 20:21:44 +01:00
|
|
|
|
if (type == error_mark_node)
|
|
|
|
|
continue;
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (type))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
if (funcdef_flag && DECL_NAME (parm) != 0)
|
|
|
|
|
error ("parameter `%s' has incomplete type",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (parm)));
|
|
|
|
|
else
|
|
|
|
|
warning ("parameter has incomplete type");
|
|
|
|
|
if (funcdef_flag)
|
|
|
|
|
{
|
|
|
|
|
TREE_VALUE (typelt) = error_mark_node;
|
|
|
|
|
TREE_TYPE (parm) = error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-11 00:01:22 +02:00
|
|
|
|
#if 0
|
|
|
|
|
/* This has been replaced by parm_tags_warning, which
|
|
|
|
|
uses a more accurate criterion for what to warn
|
|
|
|
|
about. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Now warn if is a pointer to an incomplete type. */
|
|
|
|
|
while (TREE_CODE (type) == POINTER_TYPE
|
|
|
|
|
|| TREE_CODE (type) == REFERENCE_TYPE)
|
|
|
|
|
type = TREE_TYPE (type);
|
|
|
|
|
type = TYPE_MAIN_VARIANT (type);
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (type))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
if (DECL_NAME (parm) != 0)
|
|
|
|
|
warning ("parameter `%s' points to incomplete type",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (parm)));
|
|
|
|
|
else
|
|
|
|
|
warning ("parameter points to incomplete type");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
typelt = TREE_CHAIN (typelt);
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
return first_parm;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a tree_list node with info on a parameter list just parsed.
|
|
|
|
|
The TREE_PURPOSE is a chain of decls of those parms.
|
|
|
|
|
The TREE_VALUE is a list of structure, union and enum tags defined.
|
|
|
|
|
The TREE_CHAIN is a list of argument types to go in the FUNCTION_TYPE.
|
|
|
|
|
This tree_list node is later fed to `grokparms'.
|
|
|
|
|
|
|
|
|
|
VOID_AT_END nonzero means append `void' to the end of the type-list.
|
|
|
|
|
Zero means the parmlist ended with an ellipsis so don't append `void'. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
get_parm_info (void_at_end)
|
|
|
|
|
int void_at_end;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree decl, t;
|
|
|
|
|
tree types = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int erred = 0;
|
|
|
|
|
tree tags = gettags ();
|
|
|
|
|
tree parms = getdecls ();
|
|
|
|
|
tree new_parms = 0;
|
|
|
|
|
tree order = current_binding_level->parm_order;
|
|
|
|
|
|
2000-07-31 15:11:39 +02:00
|
|
|
|
/* Just `void' (and no ellipsis) is special. There are really no parms.
|
|
|
|
|
But if the `void' is qualified (by `const' or `volatile') or has a
|
|
|
|
|
storage class specifier (`register'), then the behavior is undefined;
|
|
|
|
|
by not counting it as the special case of `void' we will cause an
|
2000-08-11 00:01:22 +02:00
|
|
|
|
error later. Typedefs for `void' are OK (see DR#157). */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (void_at_end && parms != 0
|
|
|
|
|
&& TREE_CHAIN (parms) == 0
|
2000-06-05 15:16:14 +02:00
|
|
|
|
&& VOID_TYPE_P (TREE_TYPE (parms))
|
2000-07-31 15:11:39 +02:00
|
|
|
|
&& ! TREE_THIS_VOLATILE (parms)
|
|
|
|
|
&& ! TREE_READONLY (parms)
|
|
|
|
|
&& ! DECL_REGISTER (parms)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& DECL_NAME (parms) == 0)
|
|
|
|
|
{
|
|
|
|
|
parms = NULL_TREE;
|
|
|
|
|
storedecls (NULL_TREE);
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
return tree_cons (NULL_TREE, NULL_TREE,
|
|
|
|
|
tree_cons (NULL_TREE, void_type_node, NULL_TREE));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-17 04:05:56 +02:00
|
|
|
|
/* Extract enumerator values and other non-parms declared with the parms.
|
|
|
|
|
Likewise any forward parm decls that didn't have real parm decls. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
for (decl = parms; decl;)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
tree next = TREE_CHAIN (decl);
|
|
|
|
|
|
1992-06-04 23:30:48 +02:00
|
|
|
|
if (TREE_CODE (decl) != PARM_DECL)
|
1992-04-17 04:05:56 +02:00
|
|
|
|
{
|
|
|
|
|
TREE_CHAIN (decl) = new_parms;
|
|
|
|
|
new_parms = decl;
|
|
|
|
|
}
|
1992-06-04 23:30:48 +02:00
|
|
|
|
else if (TREE_ASM_WRITTEN (decl))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-08-11 00:01:22 +02:00
|
|
|
|
error_with_decl (decl,
|
|
|
|
|
"parameter `%s' has just a forward declaration");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TREE_CHAIN (decl) = new_parms;
|
|
|
|
|
new_parms = decl;
|
|
|
|
|
}
|
|
|
|
|
decl = next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Put the parm decls back in the order they were in in the parm list. */
|
|
|
|
|
for (t = order; t; t = TREE_CHAIN (t))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CHAIN (t))
|
|
|
|
|
TREE_CHAIN (TREE_VALUE (t)) = TREE_VALUE (TREE_CHAIN (t));
|
|
|
|
|
else
|
|
|
|
|
TREE_CHAIN (TREE_VALUE (t)) = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new_parms = chainon (order ? nreverse (TREE_VALUE (order)) : 0,
|
|
|
|
|
new_parms);
|
|
|
|
|
|
|
|
|
|
/* Store the parmlist in the binding level since the old one
|
|
|
|
|
is no longer a valid list. (We have changed the chain pointers.) */
|
|
|
|
|
storedecls (new_parms);
|
|
|
|
|
|
|
|
|
|
for (decl = new_parms; decl; decl = TREE_CHAIN (decl))
|
|
|
|
|
/* There may also be declarations for enumerators if an enumeration
|
|
|
|
|
type is declared among the parms. Ignore them here. */
|
|
|
|
|
if (TREE_CODE (decl) == PARM_DECL)
|
|
|
|
|
{
|
|
|
|
|
/* Since there is a prototype,
|
|
|
|
|
args are passed in their declared types. */
|
|
|
|
|
tree type = TREE_TYPE (decl);
|
|
|
|
|
DECL_ARG_TYPE (decl) = type;
|
1999-08-03 01:17:06 +02:00
|
|
|
|
if (PROMOTE_PROTOTYPES
|
2001-06-04 22:26:16 +02:00
|
|
|
|
&& INTEGRAL_TYPE_P (type)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
|
|
|
|
|
DECL_ARG_TYPE (decl) = integer_type_node;
|
|
|
|
|
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
types = tree_cons (NULL_TREE, TREE_TYPE (decl), types);
|
2000-06-05 15:16:14 +02:00
|
|
|
|
if (VOID_TYPE_P (TREE_VALUE (types)) && ! erred
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& DECL_NAME (decl) == 0)
|
|
|
|
|
{
|
|
|
|
|
error ("`void' in parameter list must be the entire list");
|
|
|
|
|
erred = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (void_at_end)
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
return tree_cons (new_parms, tags,
|
|
|
|
|
nreverse (tree_cons (NULL_TREE, void_type_node, types)));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
return tree_cons (new_parms, tags, nreverse (types));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* At end of parameter list, warn about any struct, union or enum tags
|
|
|
|
|
defined within. Do so because these types cannot ever become complete. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
parmlist_tags_warning ()
|
|
|
|
|
{
|
|
|
|
|
tree elt;
|
|
|
|
|
static int already;
|
|
|
|
|
|
|
|
|
|
for (elt = current_binding_level->tags; elt; elt = TREE_CHAIN (elt))
|
|
|
|
|
{
|
|
|
|
|
enum tree_code code = TREE_CODE (TREE_VALUE (elt));
|
1992-04-18 19:24:48 +02:00
|
|
|
|
/* An anonymous union parm type is meaningful as a GNU extension.
|
|
|
|
|
So don't warn for that. */
|
1997-08-03 01:06:27 +02:00
|
|
|
|
if (code == UNION_TYPE && TREE_PURPOSE (elt) == 0 && !pedantic)
|
1992-04-18 19:24:48 +02:00
|
|
|
|
continue;
|
1992-03-08 23:08:20 +01:00
|
|
|
|
if (TREE_PURPOSE (elt) != 0)
|
2001-10-30 13:14:28 +01:00
|
|
|
|
{
|
|
|
|
|
if (code == RECORD_TYPE)
|
|
|
|
|
warning ("`struct %s' declared inside parameter list",
|
|
|
|
|
IDENTIFIER_POINTER (TREE_PURPOSE (elt)));
|
|
|
|
|
else if (code == UNION_TYPE)
|
|
|
|
|
warning ("`union %s' declared inside parameter list",
|
|
|
|
|
IDENTIFIER_POINTER (TREE_PURPOSE (elt)));
|
|
|
|
|
else
|
|
|
|
|
warning ("`enum %s' declared inside parameter list",
|
|
|
|
|
IDENTIFIER_POINTER (TREE_PURPOSE (elt)));
|
|
|
|
|
}
|
1992-03-08 23:08:20 +01:00
|
|
|
|
else
|
2000-08-11 00:01:22 +02:00
|
|
|
|
{
|
acinclude.m4: Fix spelling error of "separate" as "seperate".
config:
* acinclude.m4: Fix spelling error of "separate" as "seperate".
gcc:
* ChangeLog.2, c-decl.c, config/i386/i386.md, doc/gcc.texi, gcc.c,
genmultilib, toplev.c: Fix spelling errors of "separate" as
"seperate", and corresponding spelling errors of related words.
gcc/ada:
* 5oosinte.adb: Fix spelling error of "separate" as "seperate".
gcc/testsuite:
* gcc.c-torture/unsorted/unsorted.exp, lib/file-format.exp: Fix
spelling errors of "separate" as "seperate".
libffi:
* src/x86/ffi.c: Fix spelling error of "separate" as "seperate".
libjava:
* defineclass.cc, java/awt/image/ColorModel.java,
java/awt/image/SampleModel.java, java/lang/Package.java,
java/security/cert/X509Extension.java: Fix spelling errors of
"separate" as "seperate", and corresponding spelling errors of
related words.
libstdc++-v3:
* docs/html/22_locale/locale.html, docs/html/faq/index.html: Fix
spelling errors of "separate" as "seperate", and corresponding
spelling errors of related words.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r46063
2001-10-07 20:02:46 +02:00
|
|
|
|
/* For translation these need to be separate warnings */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
if (code == RECORD_TYPE)
|
2000-06-29 01:46:27 +02:00
|
|
|
|
warning ("anonymous struct declared inside parameter list");
|
|
|
|
|
else if (code == UNION_TYPE)
|
|
|
|
|
warning ("anonymous union declared inside parameter list");
|
2000-08-11 00:01:22 +02:00
|
|
|
|
else
|
2000-06-29 01:46:27 +02:00
|
|
|
|
warning ("anonymous enum declared inside parameter list");
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (! already)
|
|
|
|
|
{
|
2001-12-01 19:42:49 +01:00
|
|
|
|
warning ("its scope is only this definition or declaration, which is probably not what you want");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
already = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the struct, enum or union (CODE says which) with tag NAME.
|
|
|
|
|
Define the tag as a forward-reference if it is not defined. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
xref_tag (code, name)
|
|
|
|
|
enum tree_code code;
|
|
|
|
|
tree name;
|
|
|
|
|
{
|
|
|
|
|
/* If a cross reference is requested, look up the type
|
|
|
|
|
already defined for this tag and return it. */
|
|
|
|
|
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree ref = lookup_tag (code, name, current_binding_level, 0);
|
2001-06-11 13:50:29 +02:00
|
|
|
|
/* If this is the right type of tag, return what we found.
|
|
|
|
|
(This reference will be shadowed by shadow_tag later if appropriate.)
|
|
|
|
|
If this is the wrong type of tag, do not return it. If it was the
|
|
|
|
|
wrong type in the same binding level, we will have had an error
|
|
|
|
|
message already; if in a different binding level and declaring
|
|
|
|
|
a name, pending_xref_error will give an error message; but if in a
|
|
|
|
|
different binding level and not declaring a name, this tag should
|
|
|
|
|
shadow the previous declaration of a different type of tag, and
|
|
|
|
|
this would not work properly if we return the reference found.
|
|
|
|
|
(For example, with "struct foo" in an outer scope, "union foo;"
|
|
|
|
|
must shadow that tag with a new one of union type.) */
|
|
|
|
|
if (ref && TREE_CODE (ref) == code)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return ref;
|
|
|
|
|
|
|
|
|
|
/* If no such tag is yet defined, create a forward-reference node
|
|
|
|
|
and record it as the "definition".
|
|
|
|
|
When a real declaration of this type is found,
|
|
|
|
|
the forward-reference will be altered into a real type. */
|
|
|
|
|
|
|
|
|
|
ref = make_node (code);
|
|
|
|
|
if (code == ENUMERAL_TYPE)
|
|
|
|
|
{
|
|
|
|
|
/* Give the type a default layout like unsigned int
|
|
|
|
|
to avoid crashing if it does not get defined. */
|
|
|
|
|
TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node);
|
|
|
|
|
TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node);
|
2000-06-14 07:30:09 +02:00
|
|
|
|
TYPE_USER_ALIGN (ref) = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TREE_UNSIGNED (ref) = 1;
|
|
|
|
|
TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node);
|
|
|
|
|
TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node);
|
|
|
|
|
TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pushtag (name, ref);
|
|
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make sure that the tag NAME is defined *in the current binding level*
|
|
|
|
|
at least as a forward reference.
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
CODE says which kind of tag NAME ought to be. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
start_struct (code, name)
|
|
|
|
|
enum tree_code code;
|
|
|
|
|
tree name;
|
|
|
|
|
{
|
|
|
|
|
/* If there is already a tag defined at this binding level
|
|
|
|
|
(as a forward reference), just return it. */
|
|
|
|
|
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree ref = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (name != 0)
|
|
|
|
|
ref = lookup_tag (code, name, current_binding_level, 1);
|
|
|
|
|
if (ref && TREE_CODE (ref) == code)
|
|
|
|
|
{
|
|
|
|
|
C_TYPE_BEING_DEFINED (ref) = 1;
|
1997-10-16 23:45:24 +02:00
|
|
|
|
TYPE_PACKED (ref) = flag_pack_struct;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (TYPE_FIELDS (ref))
|
2001-10-30 13:14:28 +01:00
|
|
|
|
{
|
|
|
|
|
if (code == UNION_TYPE)
|
|
|
|
|
error ("redefinition of `union %s'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
else
|
|
|
|
|
error ("redefinition of `struct %s'",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Otherwise create a forward-reference just so the tag is in scope. */
|
|
|
|
|
|
|
|
|
|
ref = make_node (code);
|
|
|
|
|
pushtag (name, ref);
|
|
|
|
|
C_TYPE_BEING_DEFINED (ref) = 1;
|
1996-06-03 13:57:03 +02:00
|
|
|
|
TYPE_PACKED (ref) = flag_pack_struct;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return ref;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Process the specs, declarator (NULL if omitted) and width (NULL if omitted)
|
|
|
|
|
of a structure component, returning a FIELD_DECL node.
|
|
|
|
|
WIDTH is non-NULL for bit fields only, and is an INTEGER_CST node.
|
|
|
|
|
|
|
|
|
|
This is done during the parsing of the struct declaration.
|
|
|
|
|
The FIELD_DECL nodes are chained together and the lot of them
|
|
|
|
|
are ultimately passed to `build_struct' to make the RECORD_TYPE node. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
grokfield (filename, line, declarator, declspecs, width)
|
bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
* bitmap.h (bitmap_print): Likewise.
* c-decl.c (builtin_function, grokdeclarator, grokfield): Likewise.
* c-lang.c (build_objc_string): Likewise.
* c-lex.c (yyerror, extend_token_buffer): Likewise. Don't include
limits.h or ctype.h. Remove unused variable `p'.
* c-lex.h (yyerror): Qualify a char* with the `const' keyword.
* c-pragma.c (handle_pragma_token): Likewise.
* c-pragma.h (handle_pragma_token): Likewise.
* c-tree.h (build_objc_string, builtin_function, grokfield,
build_indirect_ref, lvalue_or_else, readonly_warning, error_init,
pedwarn_init): Likewise.
* c-typeck.c (convert_for_assignment, warn_for_assignment,
push_string, warning_init, incomplete_type_error,
build_indirect_ref, lvalue_or_else, readonly_warning,
build_c_cast, spelling, push_member_name, print_spelling,
error_init, pedwarn_init, start_init): Likewise.
* objc/objc-act.c (build_objc_string): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* tree.h (lvalue_or_else, print_node, print_node_brief): Likewise.
From-SVN: r25296
1999-02-18 21:38:48 +01:00
|
|
|
|
const char *filename ATTRIBUTE_UNUSED;
|
|
|
|
|
int line ATTRIBUTE_UNUSED;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
tree declarator, declspecs, width;
|
|
|
|
|
{
|
|
|
|
|
tree value;
|
|
|
|
|
|
2001-10-08 21:44:53 +02:00
|
|
|
|
if (declarator == NULL_TREE && width == NULL_TREE)
|
|
|
|
|
{
|
|
|
|
|
/* This is an unnamed decl. We only support unnamed
|
|
|
|
|
structs/unions, so check for other things and refuse them. */
|
|
|
|
|
if (TREE_CODE (TREE_VALUE (declspecs)) != RECORD_TYPE
|
|
|
|
|
&& TREE_CODE (TREE_VALUE (declspecs)) != UNION_TYPE)
|
|
|
|
|
{
|
|
|
|
|
error ("unnamed fields of type other than struct or union are not allowed");
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
value = grokdeclarator (declarator, declspecs, width ? BITFIELD : FIELD, 0);
|
|
|
|
|
|
1992-07-07 00:35:53 +02:00
|
|
|
|
finish_decl (value, NULL_TREE, NULL_TREE);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
DECL_INITIAL (value) = width;
|
|
|
|
|
|
1993-04-10 01:10:58 +02:00
|
|
|
|
maybe_objc_check_decl (value);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fill in the fields of a RECORD_TYPE or UNION_TYPE node, T.
|
1992-10-06 01:23:17 +01:00
|
|
|
|
FIELDLIST is a chain of FIELD_DECL nodes for the fields.
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
ATTRIBUTES are attributes to be applied to the structure. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
tree
|
1995-04-26 23:24:01 +02:00
|
|
|
|
finish_struct (t, fieldlist, attributes)
|
|
|
|
|
tree t;
|
|
|
|
|
tree fieldlist;
|
|
|
|
|
tree attributes;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree x;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
int toplevel = global_binding_level == current_binding_level;
|
2001-01-05 06:58:23 +01:00
|
|
|
|
int saw_named_field;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* If this type was previously laid out as a forward reference,
|
|
|
|
|
make sure we lay it out again. */
|
|
|
|
|
|
|
|
|
|
TYPE_SIZE (t) = 0;
|
|
|
|
|
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
decl_attributes (&t, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE);
|
1995-04-26 23:24:01 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Nameless union parm types are useful as GCC extension. */
|
|
|
|
|
if (! (TREE_CODE (t) == UNION_TYPE && TYPE_NAME (t) == 0) && !pedantic)
|
|
|
|
|
/* Otherwise, warn about any struct or union def. in parmlist. */
|
|
|
|
|
if (in_parm_level_p ())
|
|
|
|
|
{
|
|
|
|
|
if (pedantic)
|
c-common.c (check_format_info): Don't call a variadic function with a non-literal format string.
* c-common.c (check_format_info): Don't call a variadic function
with a non-literal format string.
* c-decl.c (grokdeclarator, start_struct, finish_struct): Likewise.
* c-typeck.c (build_component_ref, build_unary_op, lvalue_or_else,
pedantic_lvalue_warning, error_init, pedwarn_init, warning_init):
Likewise.
* cccp.c (check_macro_name, do_xifdef, vwarning_with_line):
Likewise.
* collect2.c (collect_wait): Likewise.
* dbxout.c (dbxout_type): Likewise.
* gcc.c (do_spec_1): Likewise.
* genemit.c (gen_insn, gen_expand): Likewise.
* genrecog.c (write_switch, write_subroutine): Likewise.
* mips-tfile.c (catch_signal, botch): Likewise.
* print-rtl.c (print_rtx): Likewise.
* toplev.c (default_print_error_function, report_error_function,
_fatal_insn): Likewise.
From-SVN: r30666
1999-11-25 17:58:32 +01:00
|
|
|
|
pedwarn ("%s defined inside parms",
|
2000-06-29 01:46:27 +02:00
|
|
|
|
TREE_CODE (t) == UNION_TYPE ? _("union") : _("structure"));
|
1993-01-25 19:53:25 +01:00
|
|
|
|
else if (! flag_traditional)
|
c-common.c (check_format_info): Don't call a variadic function with a non-literal format string.
* c-common.c (check_format_info): Don't call a variadic function
with a non-literal format string.
* c-decl.c (grokdeclarator, start_struct, finish_struct): Likewise.
* c-typeck.c (build_component_ref, build_unary_op, lvalue_or_else,
pedantic_lvalue_warning, error_init, pedwarn_init, warning_init):
Likewise.
* cccp.c (check_macro_name, do_xifdef, vwarning_with_line):
Likewise.
* collect2.c (collect_wait): Likewise.
* dbxout.c (dbxout_type): Likewise.
* gcc.c (do_spec_1): Likewise.
* genemit.c (gen_insn, gen_expand): Likewise.
* genrecog.c (write_switch, write_subroutine): Likewise.
* mips-tfile.c (catch_signal, botch): Likewise.
* print-rtl.c (print_rtx): Likewise.
* toplev.c (default_print_error_function, report_error_function,
_fatal_insn): Likewise.
From-SVN: r30666
1999-11-25 17:58:32 +01:00
|
|
|
|
warning ("%s defined inside parms",
|
2000-06-29 01:46:27 +02:00
|
|
|
|
TREE_CODE (t) == UNION_TYPE ? _("union") : _("structure"));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1996-08-11 23:46:05 +02:00
|
|
|
|
if (pedantic)
|
|
|
|
|
{
|
|
|
|
|
for (x = fieldlist; x; x = TREE_CHAIN (x))
|
|
|
|
|
if (DECL_NAME (x) != 0)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (x == 0)
|
2000-06-29 01:46:27 +02:00
|
|
|
|
pedwarn ("%s has no %s",
|
|
|
|
|
TREE_CODE (t) == UNION_TYPE ? _("union") : _("struct"),
|
|
|
|
|
fieldlist ? _("named members") : _("members"));
|
1996-08-11 23:46:05 +02:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Install struct as DECL_CONTEXT of each field decl.
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
Also process specified field sizes,m which is found in the DECL_INITIAL.
|
1992-02-13 23:21:26 +01:00
|
|
|
|
Store 0 there, except for ": 0" fields (so we can find them
|
|
|
|
|
and delete them, below). */
|
|
|
|
|
|
2001-01-05 06:58:23 +01:00
|
|
|
|
saw_named_field = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
for (x = fieldlist; x; x = TREE_CHAIN (x))
|
|
|
|
|
{
|
|
|
|
|
DECL_CONTEXT (x) = t;
|
1995-05-12 00:43:43 +02:00
|
|
|
|
DECL_PACKED (x) |= TYPE_PACKED (t);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* If any field is const, the structure type is pseudo-const. */
|
|
|
|
|
if (TREE_READONLY (x))
|
|
|
|
|
C_TYPE_FIELDS_READONLY (t) = 1;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* A field that is pseudo-const makes the structure likewise. */
|
|
|
|
|
tree t1 = TREE_TYPE (x);
|
|
|
|
|
while (TREE_CODE (t1) == ARRAY_TYPE)
|
|
|
|
|
t1 = TREE_TYPE (t1);
|
|
|
|
|
if ((TREE_CODE (t1) == RECORD_TYPE || TREE_CODE (t1) == UNION_TYPE)
|
|
|
|
|
&& C_TYPE_FIELDS_READONLY (t1))
|
|
|
|
|
C_TYPE_FIELDS_READONLY (t) = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Any field that is volatile means variables of this type must be
|
|
|
|
|
treated in some ways as volatile. */
|
|
|
|
|
if (TREE_THIS_VOLATILE (x))
|
|
|
|
|
C_TYPE_FIELDS_VOLATILE (t) = 1;
|
|
|
|
|
|
|
|
|
|
/* Any field of nominal variable size implies structure is too. */
|
|
|
|
|
if (C_DECL_VARIABLE_SIZE (x))
|
|
|
|
|
C_TYPE_VARIABLE_SIZE (t) = 1;
|
|
|
|
|
|
1992-07-15 20:39:52 +02:00
|
|
|
|
/* Detect invalid nested redefinition. */
|
|
|
|
|
if (TREE_TYPE (x) == t)
|
|
|
|
|
error ("nested redefinition of `%s'",
|
|
|
|
|
IDENTIFIER_POINTER (TYPE_NAME (t)));
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Detect invalid bit-field size. */
|
1992-07-09 01:31:23 +02:00
|
|
|
|
if (DECL_INITIAL (x))
|
|
|
|
|
STRIP_NOPS (DECL_INITIAL (x));
|
1993-02-02 05:38:30 +01:00
|
|
|
|
if (DECL_INITIAL (x))
|
1993-02-03 00:35:04 +01:00
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (DECL_INITIAL (x)) == INTEGER_CST)
|
|
|
|
|
constant_expression_warning (DECL_INITIAL (x));
|
|
|
|
|
else
|
|
|
|
|
{
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
error_with_decl (x,
|
|
|
|
|
"bit-field `%s' width not an integer constant");
|
1993-02-03 00:35:04 +01:00
|
|
|
|
DECL_INITIAL (x) = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Detect invalid bit-field type. */
|
|
|
|
|
if (DECL_INITIAL (x)
|
|
|
|
|
&& TREE_CODE (TREE_TYPE (x)) != INTEGER_TYPE
|
2000-11-13 15:14:44 +01:00
|
|
|
|
&& TREE_CODE (TREE_TYPE (x)) != BOOLEAN_TYPE
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE)
|
|
|
|
|
{
|
|
|
|
|
error_with_decl (x, "bit-field `%s' has invalid type");
|
|
|
|
|
DECL_INITIAL (x) = NULL;
|
|
|
|
|
}
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (DECL_INITIAL (x) && pedantic
|
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_TYPE (x)) != integer_type_node
|
1993-08-06 03:11:37 +02:00
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_TYPE (x)) != unsigned_type_node
|
2000-11-13 15:14:44 +01:00
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_TYPE (x)) != c_bool_type_node
|
1993-08-06 03:11:37 +02:00
|
|
|
|
/* Accept an enum that's equivalent to int or unsigned int. */
|
|
|
|
|
&& !(TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
|
|
|
|
|
&& (TYPE_PRECISION (TREE_TYPE (x))
|
|
|
|
|
== TYPE_PRECISION (integer_type_node))))
|
c-common.c (combine_strings, [...]): Refer to ISO C or ISO C89 instead of ANSI C.
* c-common.c (combine_strings, check_format_info): Refer to ISO C
or ISO C89 instead of ANSI C.
* c-decl.c (grokdeclarator, xref_tag, finish_struct,
build_enumerator, do_case): Likewise.
* c-lex.c (parse_float, yylex): Likewise.
* c-parse.in: Likewise.
* c-typeck.c (common_type, build_array_ref, build_binary_op,
build_unary_op, pedantic_lvalue_warning, build_conditional_expr,
build_c_cast, convert_for_assignment, set_init_index,
set_init_label, c_expand_start_case): Likewise.
* toplev.c (documented_lang_options, display_help): Likewise.
From-SVN: r35576
2000-08-09 01:19:11 +02:00
|
|
|
|
pedwarn_with_decl (x, "bit-field `%s' type invalid in ISO C");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
/* Detect and ignore out of range field width and process valid
|
|
|
|
|
field widths. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (DECL_INITIAL (x))
|
|
|
|
|
{
|
2000-11-13 15:14:44 +01:00
|
|
|
|
int max_width;
|
|
|
|
|
if (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == c_bool_type_node)
|
|
|
|
|
max_width = CHAR_TYPE_SIZE;
|
|
|
|
|
else
|
|
|
|
|
max_width = TYPE_PRECISION (TREE_TYPE (x));
|
1994-03-14 11:08:06 +01:00
|
|
|
|
if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
error_with_decl (x, "negative width in bit-field `%s'");
|
2000-11-13 15:14:44 +01:00
|
|
|
|
else if (0 < compare_tree_int (DECL_INITIAL (x), max_width))
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
pedwarn_with_decl (x, "width of `%s' exceeds its type");
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
else if (integer_zerop (DECL_INITIAL (x)) && DECL_NAME (x) != 0)
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
error_with_decl (x, "zero width for bit-field `%s'");
|
|
|
|
|
else
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
/* The test above has assured us that TREE_INT_CST_HIGH is 0. */
|
|
|
|
|
unsigned HOST_WIDE_INT width
|
|
|
|
|
= TREE_INT_CST_LOW (DECL_INITIAL (x));
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
|
|
|
|
|
&& (width < min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),
|
|
|
|
|
TREE_UNSIGNED (TREE_TYPE (x)))
|
|
|
|
|
|| (width
|
|
|
|
|
< min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)),
|
|
|
|
|
TREE_UNSIGNED (TREE_TYPE (x))))))
|
|
|
|
|
warning_with_decl (x,
|
|
|
|
|
"`%s' is narrower than values of its type");
|
|
|
|
|
|
|
|
|
|
DECL_SIZE (x) = bitsize_int (width);
|
2000-11-10 05:29:45 +01:00
|
|
|
|
DECL_BIT_FIELD (x) = 1;
|
|
|
|
|
SET_DECL_C_BIT_FIELD (x);
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
|
|
|
|
|
if (width == 0)
|
|
|
|
|
{
|
|
|
|
|
/* field size 0 => force desired amount of alignment. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#ifdef EMPTY_FIELD_BOUNDARY
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
DECL_ALIGN (x) = MAX (DECL_ALIGN (x), EMPTY_FIELD_BOUNDARY);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef PCC_BITFIELD_TYPE_MATTERS
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
if (PCC_BITFIELD_TYPE_MATTERS)
|
2000-06-14 07:30:09 +02:00
|
|
|
|
{
|
|
|
|
|
DECL_ALIGN (x) = MAX (DECL_ALIGN (x),
|
|
|
|
|
TYPE_ALIGN (TREE_TYPE (x)));
|
|
|
|
|
DECL_USER_ALIGN (x) |= TYPE_USER_ALIGN (TREE_TYPE (x));
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
#endif
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
|
1994-07-28 14:07:05 +02:00
|
|
|
|
else if (TREE_TYPE (x) != error_mark_node)
|
1992-04-04 10:50:38 +02:00
|
|
|
|
{
|
1998-03-12 01:02:52 +01:00
|
|
|
|
unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT
|
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables.
* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
* expr.c (expand_expr, case COMPONENT_REF): Get field size from
DECL_SIZE, not DECL_FIELD_SIZE.
* print-tree.c (print_node): Remove code that prints extra blank
lines in some cases.
Properly handle inline and builtin function cases.
* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
* tree.h (built_in_class_named, built_in_names): New declarations.
(union tree_decl): Rename internal unions to u1 and u2 and change
some of their components.
Add new field built_in_class.
(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
Reflect above changes.
(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
(encode_field_decl): Likewise; also remove obsolete test for bitfield.
* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
* ch/typeck.c (make_chill_struct_type): Likewise.
(apply_decl_field_layout): General cleanup.
Set DECL_SIZE instead of DECL_FIELD_SIZE.
* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
DECL_FIELD_SIZE.
(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
DECL_FIELD_SIZE.
* cp/rtti.c (expand_class_desc): Likewise.
* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
(THUNK_VCALL_OFFSET): Likewise.
(THUNK_DELTA): Reflect changes in ../tree.h.
* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
(DECL_BIT_INDEX): Use underlying representation.
* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
From-SVN: r32249
2000-02-29 03:34:48 +01:00
|
|
|
|
: TYPE_ALIGN (TREE_TYPE (x)));
|
|
|
|
|
|
1992-04-04 10:50:38 +02:00
|
|
|
|
/* Non-bit-fields are aligned for their type, except packed
|
|
|
|
|
fields which require only BITS_PER_UNIT alignment. */
|
|
|
|
|
DECL_ALIGN (x) = MAX (DECL_ALIGN (x), min_align);
|
2000-06-14 07:30:09 +02:00
|
|
|
|
if (! DECL_PACKED (x))
|
|
|
|
|
DECL_USER_ALIGN (x) |= TYPE_USER_ALIGN (TREE_TYPE (x));
|
1992-04-04 10:50:38 +02:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
DECL_INITIAL (x) = 0;
|
2001-01-05 06:58:23 +01:00
|
|
|
|
|
|
|
|
|
/* Detect flexible array member in an invalid context. */
|
|
|
|
|
if (TREE_CODE (TREE_TYPE (x)) == ARRAY_TYPE
|
|
|
|
|
&& TYPE_SIZE (TREE_TYPE (x)) == NULL_TREE
|
|
|
|
|
&& TYPE_DOMAIN (TREE_TYPE (x)) != NULL_TREE
|
|
|
|
|
&& TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (x))) == NULL_TREE)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (t) == UNION_TYPE)
|
|
|
|
|
error_with_decl (x, "flexible array member in union");
|
|
|
|
|
else if (TREE_CHAIN (x) != NULL_TREE)
|
|
|
|
|
error_with_decl (x, "flexible array member not at end of struct");
|
|
|
|
|
else if (! saw_named_field)
|
|
|
|
|
error_with_decl (x, "flexible array member in otherwise empty struct");
|
|
|
|
|
}
|
|
|
|
|
if (DECL_NAME (x))
|
|
|
|
|
saw_named_field = 1;
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Delete all duplicate fields from the fieldlist */
|
|
|
|
|
for (x = fieldlist; x && TREE_CHAIN (x);)
|
|
|
|
|
/* Anonymous fields aren't duplicates. */
|
|
|
|
|
if (DECL_NAME (TREE_CHAIN (x)) == 0)
|
|
|
|
|
x = TREE_CHAIN (x);
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree y = fieldlist;
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x)))
|
|
|
|
|
break;
|
|
|
|
|
if (y == x)
|
|
|
|
|
break;
|
|
|
|
|
y = TREE_CHAIN (y);
|
|
|
|
|
}
|
|
|
|
|
if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x)))
|
|
|
|
|
{
|
|
|
|
|
error_with_decl (TREE_CHAIN (x), "duplicate member `%s'");
|
|
|
|
|
TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x));
|
|
|
|
|
}
|
2000-08-11 00:01:22 +02:00
|
|
|
|
else
|
|
|
|
|
x = TREE_CHAIN (x);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now we have the nearly final fieldlist. Record it,
|
|
|
|
|
then lay out the structure or union (including the fields). */
|
|
|
|
|
|
|
|
|
|
TYPE_FIELDS (t) = fieldlist;
|
|
|
|
|
|
|
|
|
|
layout_type (t);
|
|
|
|
|
|
1999-10-08 02:10:09 +02:00
|
|
|
|
/* Delete all zero-width bit-fields from the fieldlist */
|
|
|
|
|
{
|
|
|
|
|
tree *fieldlistp = &fieldlist;
|
1999-10-10 21:23:38 +02:00
|
|
|
|
while (*fieldlistp)
|
|
|
|
|
if (TREE_CODE (*fieldlistp) == FIELD_DECL && DECL_INITIAL (*fieldlistp))
|
1999-10-08 02:10:09 +02:00
|
|
|
|
*fieldlistp = TREE_CHAIN (*fieldlistp);
|
|
|
|
|
else
|
|
|
|
|
fieldlistp = &TREE_CHAIN (*fieldlistp);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-01-05 06:58:23 +01:00
|
|
|
|
/* Now we have the truly final field list.
|
|
|
|
|
Store it in this type and in the variants. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
TYPE_FIELDS (t) = fieldlist;
|
|
|
|
|
|
|
|
|
|
for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x))
|
|
|
|
|
{
|
|
|
|
|
TYPE_FIELDS (x) = TYPE_FIELDS (t);
|
|
|
|
|
TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t);
|
|
|
|
|
TYPE_ALIGN (x) = TYPE_ALIGN (t);
|
2000-06-14 07:30:09 +02:00
|
|
|
|
TYPE_USER_ALIGN (x) = TYPE_USER_ALIGN (t);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
1995-08-30 01:15:47 +02:00
|
|
|
|
/* If this was supposed to be a transparent union, but we can't
|
|
|
|
|
make it one, warn and turn off the flag. */
|
|
|
|
|
if (TREE_CODE (t) == UNION_TYPE
|
|
|
|
|
&& TYPE_TRANSPARENT_UNION (t)
|
|
|
|
|
&& TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t)))
|
|
|
|
|
{
|
|
|
|
|
TYPE_TRANSPARENT_UNION (t) = 0;
|
1996-02-02 18:42:40 +01:00
|
|
|
|
warning ("union cannot be made transparent");
|
1995-08-30 01:15:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* If this structure or union completes the type of any previous
|
|
|
|
|
variable declaration, lay it out and output its rtl. */
|
|
|
|
|
|
|
|
|
|
if (current_binding_level->n_incomplete != 0)
|
|
|
|
|
{
|
|
|
|
|
tree decl;
|
|
|
|
|
for (decl = current_binding_level->names; decl; decl = TREE_CHAIN (decl))
|
|
|
|
|
{
|
2000-11-09 22:29:54 +01:00
|
|
|
|
if (TYPE_MAIN_VARIANT (TREE_TYPE (decl)) == TYPE_MAIN_VARIANT (t)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TREE_CODE (decl) != TYPE_DECL)
|
|
|
|
|
{
|
|
|
|
|
layout_decl (decl, 0);
|
|
|
|
|
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
|
|
|
|
maybe_objc_check_decl (decl);
|
2001-05-01 14:11:35 +02:00
|
|
|
|
rest_of_decl_compilation (decl, NULL, toplevel, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (! toplevel)
|
|
|
|
|
expand_decl (decl);
|
|
|
|
|
--current_binding_level->n_incomplete;
|
|
|
|
|
}
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
else if (!COMPLETE_TYPE_P (TREE_TYPE (decl))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
|
|
|
|
|
{
|
|
|
|
|
tree element = TREE_TYPE (decl);
|
|
|
|
|
while (TREE_CODE (element) == ARRAY_TYPE)
|
|
|
|
|
element = TREE_TYPE (element);
|
|
|
|
|
if (element == t)
|
|
|
|
|
layout_array_type (TREE_TYPE (decl));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Finish debugging output for this type. */
|
|
|
|
|
rest_of_type_compilation (t, toplevel);
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Lay out the type T, and its element type, and so on. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
layout_array_type (t)
|
|
|
|
|
tree t;
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
|
|
|
|
|
layout_array_type (TREE_TYPE (t));
|
|
|
|
|
layout_type (t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Begin compiling the definition of an enumeration type.
|
|
|
|
|
NAME is its name (or null if anonymous).
|
|
|
|
|
Returns the type object, as yet incomplete.
|
|
|
|
|
Also records info about it so that build_enumerator
|
|
|
|
|
may be used to declare the individual values as they are read. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
start_enum (name)
|
|
|
|
|
tree name;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree enumtype = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* If this is the real definition for a previous forward reference,
|
|
|
|
|
fill in the contents in the same object that used to be the
|
|
|
|
|
forward reference. */
|
|
|
|
|
|
|
|
|
|
if (name != 0)
|
|
|
|
|
enumtype = lookup_tag (ENUMERAL_TYPE, name, current_binding_level, 1);
|
|
|
|
|
|
|
|
|
|
if (enumtype == 0 || TREE_CODE (enumtype) != ENUMERAL_TYPE)
|
|
|
|
|
{
|
|
|
|
|
enumtype = make_node (ENUMERAL_TYPE);
|
|
|
|
|
pushtag (name, enumtype);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
C_TYPE_BEING_DEFINED (enumtype) = 1;
|
|
|
|
|
|
|
|
|
|
if (TYPE_VALUES (enumtype) != 0)
|
|
|
|
|
{
|
|
|
|
|
/* This enum is a named one that has been declared already. */
|
|
|
|
|
error ("redeclaration of `enum %s'", IDENTIFIER_POINTER (name));
|
|
|
|
|
|
|
|
|
|
/* Completely replace its old definition.
|
|
|
|
|
The old enumerators remain defined, however. */
|
|
|
|
|
TYPE_VALUES (enumtype) = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum_next_value = integer_zero_node;
|
1992-05-18 07:09:24 +02:00
|
|
|
|
enum_overflow = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1996-06-03 13:57:03 +02:00
|
|
|
|
if (flag_short_enums)
|
|
|
|
|
TYPE_PACKED (enumtype) = 1;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return enumtype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* After processing and defining all the values of an enumeration type,
|
|
|
|
|
install their decls in the enumeration type and finish it off.
|
1995-04-26 23:24:01 +02:00
|
|
|
|
ENUMTYPE is the type object, VALUES a list of decl-value pairs,
|
|
|
|
|
and ATTRIBUTES are the specified attributes.
|
1992-02-13 23:21:26 +01:00
|
|
|
|
Returns ENUMTYPE. */
|
|
|
|
|
|
|
|
|
|
tree
|
1995-04-26 23:24:01 +02:00
|
|
|
|
finish_enum (enumtype, values, attributes)
|
|
|
|
|
tree enumtype;
|
|
|
|
|
tree values;
|
|
|
|
|
tree attributes;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree pair, tem;
|
2000-07-26 05:50:56 +02:00
|
|
|
|
tree minnode = 0, maxnode = 0, enum_value_type;
|
2000-01-05 20:26:23 +01:00
|
|
|
|
int precision, unsign;
|
|
|
|
|
int toplevel = (global_binding_level == current_binding_level);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (in_parm_level_p ())
|
|
|
|
|
warning ("enum defined inside parms");
|
|
|
|
|
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_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_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
decl_attributes (&enumtype, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE);
|
1995-04-26 23:24:01 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Calculate the maximum value of any enumerator in this type. */
|
|
|
|
|
|
1994-05-16 14:25:28 +02:00
|
|
|
|
if (values == error_mark_node)
|
|
|
|
|
minnode = maxnode = integer_zero_node;
|
|
|
|
|
else
|
1996-04-15 01:01:38 +02:00
|
|
|
|
{
|
2000-01-05 20:26:23 +01:00
|
|
|
|
minnode = maxnode = TREE_VALUE (values);
|
|
|
|
|
for (pair = TREE_CHAIN (values); pair; pair = TREE_CHAIN (pair))
|
1996-04-15 01:01:38 +02:00
|
|
|
|
{
|
2000-01-05 20:26:23 +01:00
|
|
|
|
tree value = TREE_VALUE (pair);
|
|
|
|
|
if (tree_int_cst_lt (maxnode, value))
|
|
|
|
|
maxnode = value;
|
|
|
|
|
if (tree_int_cst_lt (value, minnode))
|
|
|
|
|
minnode = value;
|
1996-04-15 01:01:38 +02:00
|
|
|
|
}
|
2000-01-05 20:26:23 +01:00
|
|
|
|
}
|
1996-04-15 01:01:38 +02:00
|
|
|
|
|
2000-01-05 20:26:23 +01:00
|
|
|
|
/* Construct the final type of this enumeration. It is the same
|
|
|
|
|
as one of the integral types - the narrowest one that fits, except
|
|
|
|
|
that normally we only go as narrow as int - and signed iff any of
|
|
|
|
|
the values are negative. */
|
|
|
|
|
unsign = (tree_int_cst_sgn (minnode) >= 0);
|
|
|
|
|
precision = MAX (min_precision (minnode, unsign),
|
|
|
|
|
min_precision (maxnode, unsign));
|
2001-02-07 23:04:10 +01:00
|
|
|
|
if (TYPE_PACKED (enumtype) || precision > TYPE_PRECISION (integer_type_node))
|
2000-01-05 20:26:23 +01:00
|
|
|
|
{
|
2001-02-07 23:04:10 +01:00
|
|
|
|
tree narrowest = type_for_size (precision, unsign);
|
|
|
|
|
if (narrowest == 0)
|
|
|
|
|
{
|
|
|
|
|
warning ("enumeration values exceed range of largest integer");
|
|
|
|
|
narrowest = long_long_integer_type_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
precision = TYPE_PRECISION (narrowest);
|
1996-04-15 01:01:38 +02:00
|
|
|
|
}
|
2001-02-07 23:04:10 +01:00
|
|
|
|
else
|
|
|
|
|
precision = TYPE_PRECISION (integer_type_node);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-07-26 05:50:56 +02:00
|
|
|
|
if (precision == TYPE_PRECISION (integer_type_node))
|
|
|
|
|
enum_value_type = type_for_size (precision, 0);
|
|
|
|
|
else
|
|
|
|
|
enum_value_type = enumtype;
|
|
|
|
|
|
2000-01-05 20:26:23 +01:00
|
|
|
|
TYPE_MIN_VALUE (enumtype) = minnode;
|
|
|
|
|
TYPE_MAX_VALUE (enumtype) = maxnode;
|
|
|
|
|
TYPE_PRECISION (enumtype) = precision;
|
|
|
|
|
TREE_UNSIGNED (enumtype) = unsign;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TYPE_SIZE (enumtype) = 0;
|
|
|
|
|
layout_type (enumtype);
|
|
|
|
|
|
1994-05-16 14:25:28 +02:00
|
|
|
|
if (values != error_mark_node)
|
1993-09-07 14:26:20 +02:00
|
|
|
|
{
|
2000-01-05 20:26:23 +01:00
|
|
|
|
/* Change the type of the enumerators to be the enum type. We
|
|
|
|
|
need to do this irrespective of the size of the enum, for
|
|
|
|
|
proper type checking. Replace the DECL_INITIALs of the
|
|
|
|
|
enumerators, and the value slots of the list, with copies
|
|
|
|
|
that have the enum type; they cannot be modified in place
|
|
|
|
|
because they may be shared (e.g. integer_zero_node) Finally,
|
|
|
|
|
change the purpose slots to point to the names of the decls. */
|
1994-05-16 14:25:28 +02:00
|
|
|
|
for (pair = values; pair; pair = TREE_CHAIN (pair))
|
|
|
|
|
{
|
2000-01-05 20:26:23 +01:00
|
|
|
|
tree enu = TREE_PURPOSE (pair);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-01-05 20:26:23 +01:00
|
|
|
|
TREE_TYPE (enu) = enumtype;
|
|
|
|
|
DECL_SIZE (enu) = TYPE_SIZE (enumtype);
|
c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-decl.c (duplicate_decls, finish_enum): Likewise.
(finish_decl): Remove -Wlarger-than code from here.
* flags.h (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
Clean up checking to see if in table.
(make_bit_field_ref): Remove extra parm to bitsize_int.
* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
and for computing size of decl.
* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
Move -Wlarger-than code to here.
(layout_record): Remove extra arg to bitsize_int.
Set TYPE_BINFO_SIZE_UNIT.
(layout_union): Remove extra arg to bitsize_int.
Use proper type for size of QUAL_UNION.
(layout_type): Remove extra arg to bitsize_int.
* toplev.c (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
(decode_W_option): Clean up id-clash and larger-than- cases.
* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
(struct tree_decl): New field size_unit.
(size_int_wide): No HIGH operand; NUMBER is now signed.
(size_int_2): Deleted.
(size_int, bitsize_int): Don't use it and rework args.
* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
* ch/satisfy.c (safe_satisfy_decl): Likewise.
* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
(avoid_overlap, build_base_field): Likewise.
(build_base_field, build_base_fields, is_empty_class):
Test DECL_SIZE with integer_zero.
(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
* cp/cp-tree.h (struct lang_type): New field size_unit.
(CLASSTYPE_SIZE_UNIT): New macro.
* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
(cp_finish_decl): Delete -Wlarger-than processing.
* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
* cp/tree.c (make_binfo): binfo vector is one entry longer.
(walk_tree): Walk DECL_SIZE_UNIT.
* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
(duplicate_decls): Likewise.
(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
(finish_decl): Delete -Wlarger-than processing.
* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
* java/constants.c (build_constants_constructor): Likewise.
From-SVN: r32068
2000-02-20 02:11:00 +01:00
|
|
|
|
DECL_SIZE_UNIT (enu) = TYPE_SIZE_UNIT (enumtype);
|
2000-01-05 20:26:23 +01:00
|
|
|
|
DECL_ALIGN (enu) = TYPE_ALIGN (enumtype);
|
2000-06-14 07:30:09 +02:00
|
|
|
|
DECL_USER_ALIGN (enu) = TYPE_USER_ALIGN (enumtype);
|
2000-01-05 20:26:23 +01:00
|
|
|
|
DECL_MODE (enu) = TYPE_MODE (enumtype);
|
2000-07-26 05:50:56 +02:00
|
|
|
|
|
|
|
|
|
/* The ISO C Standard mandates enumerators to have type int,
|
|
|
|
|
even though the underlying type of an enum type is
|
|
|
|
|
unspecified. Here we convert any enumerators that fit in
|
|
|
|
|
an int to type int, to avoid promotions to unsigned types
|
|
|
|
|
when comparing integers with enumerators that fit in the
|
|
|
|
|
int range. When -pedantic is given, build_enumerator()
|
|
|
|
|
would have already taken care of those that don't fit. */
|
|
|
|
|
if (int_fits_type_p (DECL_INITIAL (enu), enum_value_type))
|
|
|
|
|
DECL_INITIAL (enu) = convert (enum_value_type, DECL_INITIAL (enu));
|
|
|
|
|
else
|
|
|
|
|
DECL_INITIAL (enu) = convert (enumtype, DECL_INITIAL (enu));
|
2000-01-05 20:26:23 +01:00
|
|
|
|
|
|
|
|
|
TREE_PURPOSE (pair) = DECL_NAME (enu);
|
|
|
|
|
TREE_VALUE (pair) = DECL_INITIAL (enu);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1994-05-16 14:25:28 +02:00
|
|
|
|
TYPE_VALUES (enumtype) = values;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1993-04-09 02:00:06 +02:00
|
|
|
|
/* Fix up all variant types of this enum type. */
|
|
|
|
|
for (tem = TYPE_MAIN_VARIANT (enumtype); tem; tem = TYPE_NEXT_VARIANT (tem))
|
|
|
|
|
{
|
2000-01-05 20:26:23 +01:00
|
|
|
|
if (tem == enumtype)
|
|
|
|
|
continue;
|
1993-04-09 02:00:06 +02:00
|
|
|
|
TYPE_VALUES (tem) = TYPE_VALUES (enumtype);
|
|
|
|
|
TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype);
|
|
|
|
|
TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype);
|
|
|
|
|
TYPE_SIZE (tem) = TYPE_SIZE (enumtype);
|
1998-08-17 22:26:47 +02:00
|
|
|
|
TYPE_SIZE_UNIT (tem) = TYPE_SIZE_UNIT (enumtype);
|
1993-04-09 02:00:06 +02:00
|
|
|
|
TYPE_MODE (tem) = TYPE_MODE (enumtype);
|
|
|
|
|
TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype);
|
|
|
|
|
TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype);
|
2000-06-14 07:30:09 +02:00
|
|
|
|
TYPE_USER_ALIGN (tem) = TYPE_USER_ALIGN (enumtype);
|
1993-04-09 02:00:06 +02:00
|
|
|
|
TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype);
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Finish debugging output for this type. */
|
|
|
|
|
rest_of_type_compilation (enumtype, toplevel);
|
|
|
|
|
|
|
|
|
|
return enumtype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Build and install a CONST_DECL for one value of the
|
|
|
|
|
current enumeration type (one that was begun with start_enum).
|
|
|
|
|
Return a tree-list containing the CONST_DECL and its value.
|
|
|
|
|
Assignment of sequential values by default is handled here. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
build_enumerator (name, value)
|
|
|
|
|
tree name, value;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree decl, type;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Validate and default VALUE. */
|
|
|
|
|
|
|
|
|
|
/* Remove no-op casts from the value. */
|
1992-07-09 08:11:19 +02:00
|
|
|
|
if (value)
|
1992-07-10 03:50:35 +02:00
|
|
|
|
STRIP_TYPE_NOPS (value);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1993-02-02 05:38:30 +01:00
|
|
|
|
if (value != 0)
|
1993-02-03 00:35:04 +01:00
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (value) == INTEGER_CST)
|
1993-09-04 01:02:27 +02:00
|
|
|
|
{
|
|
|
|
|
value = default_conversion (value);
|
|
|
|
|
constant_expression_warning (value);
|
|
|
|
|
}
|
1993-02-03 00:35:04 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error ("enumerator value for `%s' not integer constant",
|
|
|
|
|
IDENTIFIER_POINTER (name));
|
|
|
|
|
value = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Default based on previous value. */
|
|
|
|
|
/* It should no longer be possible to have NON_LVALUE_EXPR
|
|
|
|
|
in the default. */
|
|
|
|
|
if (value == 0)
|
1992-05-18 07:09:24 +02:00
|
|
|
|
{
|
|
|
|
|
value = enum_next_value;
|
|
|
|
|
if (enum_overflow)
|
|
|
|
|
error ("overflow in enumeration values");
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (pedantic && ! int_fits_type_p (value, integer_type_node))
|
|
|
|
|
{
|
c-common.c (combine_strings, [...]): Refer to ISO C or ISO C89 instead of ANSI C.
* c-common.c (combine_strings, check_format_info): Refer to ISO C
or ISO C89 instead of ANSI C.
* c-decl.c (grokdeclarator, xref_tag, finish_struct,
build_enumerator, do_case): Likewise.
* c-lex.c (parse_float, yylex): Likewise.
* c-parse.in: Likewise.
* c-typeck.c (common_type, build_array_ref, build_binary_op,
build_unary_op, pedantic_lvalue_warning, build_conditional_expr,
build_c_cast, convert_for_assignment, set_init_index,
set_init_label, c_expand_start_case): Likewise.
* toplev.c (documented_lang_options, display_help): Likewise.
From-SVN: r35576
2000-08-09 01:19:11 +02:00
|
|
|
|
pedwarn ("ISO C restricts enumerator values to range of `int'");
|
2000-07-26 05:50:56 +02:00
|
|
|
|
value = convert (integer_type_node, value);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set basis for default for next value. */
|
|
|
|
|
enum_next_value = build_binary_op (PLUS_EXPR, value, integer_one_node, 0);
|
1992-05-18 07:09:24 +02:00
|
|
|
|
enum_overflow = tree_int_cst_lt (enum_next_value, value);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Now create a declaration for the enum value name. */
|
|
|
|
|
|
1993-09-07 14:26:20 +02:00
|
|
|
|
type = TREE_TYPE (value);
|
|
|
|
|
type = type_for_size (MAX (TYPE_PRECISION (type),
|
|
|
|
|
TYPE_PRECISION (integer_type_node)),
|
|
|
|
|
((flag_traditional
|
|
|
|
|
|| TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node))
|
|
|
|
|
&& TREE_UNSIGNED (type)));
|
|
|
|
|
|
|
|
|
|
decl = build_decl (CONST_DECL, name, type);
|
2000-05-24 11:08:42 +02:00
|
|
|
|
DECL_INITIAL (decl) = convert (type, value);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
pushdecl (decl);
|
|
|
|
|
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
return tree_cons (decl, value, NULL_TREE);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
2000-09-17 09:38:23 +02:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Create the FUNCTION_DECL for a function definition.
|
c-common.c (decl_attributes): Only take a single attributes parameter.
* c-common.c (decl_attributes): Only take a single attributes
parameter.
* c-common.h (decl_attributes): Update prototype.
* c-decl.c (start_decl, start_function): Only take a single
attributes parameter. Update calls to decl_attributes.
(finish_struct, finish_enum): Update calls to decl_attributes.
(push_parm_decl): Expect unified list of attributes. Update call
to decl_attributes.
* c-parse.in (fndef, initdcl, notype_initdcl, nested_function,
notype_nested_function, component_declarator,
component_notype_declarator, label): Update calls to
decl_attributes.
(absdcl_maybe_attribute, parm, firstparm, myparm): Unify attribute
lists that are passed to push_parm_decl.
* c-tree.h (start_function, start_decl): Update prototypes.
* config/sh/sh-protos.h, config/sh/sh.c
(sh_pragma_insert_attributes): Only take a single attributes
parameter.
* config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Likewise.
* doc/tm.texi (INSERT_ATTRIBUTES): Update.
* objc/objc-act.c (define_decl, generate_objc_symtab_decl,
build_module_descriptor, generate_static_references,
generate_strings, build_selector_translation_table,
generate_descriptor_table, generate_protocols,
generate_ivars_list, generate_dispatch_table,
generate_protocol_list, generate_category,
generate_shared_structures, really_start_method, add_objc_decls,
generate_classref_translation_entry): Update calls to start_decl
and start_function.
(build_tmp_function_decl, start_method_def): Unify attribute lists
that are passed to push_parm_decl.
cp:
* decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update
calls to decl_attributes.
testsuite:
* gcc.c-torture/compile/20010701-1.c,
g++.old-deja/g++.ext/attrib6.C: New tests.
From-SVN: r43850
2001-07-08 21:58:19 +02:00
|
|
|
|
DECLSPECS, DECLARATOR and ATTRIBUTES are the parts of
|
1995-06-14 14:07:24 +02:00
|
|
|
|
the declaration; they describe the function's name and the type it returns,
|
1992-02-13 23:21:26 +01:00
|
|
|
|
but twisted together in a fashion that parallels the syntax of C.
|
|
|
|
|
|
|
|
|
|
This function creates a binding context for the function body
|
|
|
|
|
as well as setting up the FUNCTION_DECL in current_function_decl.
|
|
|
|
|
|
|
|
|
|
Returns 1 on success. If the DECLARATOR is not suitable for a function
|
|
|
|
|
(it defines a datum instead), we return 0, which tells
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
yyparse to report a parse error. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
int
|
c-common.c (decl_attributes): Only take a single attributes parameter.
* c-common.c (decl_attributes): Only take a single attributes
parameter.
* c-common.h (decl_attributes): Update prototype.
* c-decl.c (start_decl, start_function): Only take a single
attributes parameter. Update calls to decl_attributes.
(finish_struct, finish_enum): Update calls to decl_attributes.
(push_parm_decl): Expect unified list of attributes. Update call
to decl_attributes.
* c-parse.in (fndef, initdcl, notype_initdcl, nested_function,
notype_nested_function, component_declarator,
component_notype_declarator, label): Update calls to
decl_attributes.
(absdcl_maybe_attribute, parm, firstparm, myparm): Unify attribute
lists that are passed to push_parm_decl.
* c-tree.h (start_function, start_decl): Update prototypes.
* config/sh/sh-protos.h, config/sh/sh.c
(sh_pragma_insert_attributes): Only take a single attributes
parameter.
* config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Likewise.
* doc/tm.texi (INSERT_ATTRIBUTES): Update.
* objc/objc-act.c (define_decl, generate_objc_symtab_decl,
build_module_descriptor, generate_static_references,
generate_strings, build_selector_translation_table,
generate_descriptor_table, generate_protocols,
generate_ivars_list, generate_dispatch_table,
generate_protocol_list, generate_category,
generate_shared_structures, really_start_method, add_objc_decls,
generate_classref_translation_entry): Update calls to start_decl
and start_function.
(build_tmp_function_decl, start_method_def): Unify attribute lists
that are passed to push_parm_decl.
cp:
* decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update
calls to decl_attributes.
testsuite:
* gcc.c-torture/compile/20010701-1.c,
g++.old-deja/g++.ext/attrib6.C: New tests.
From-SVN: r43850
2001-07-08 21:58:19 +02:00
|
|
|
|
start_function (declspecs, declarator, attributes)
|
|
|
|
|
tree declarator, declspecs, attributes;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
tree decl1, old_decl;
|
|
|
|
|
tree restype;
|
1994-10-18 20:42:11 +01:00
|
|
|
|
int old_immediate_size_expand = immediate_size_expand;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
current_function_returns_value = 0; /* Assume, until we see it does. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
current_function_returns_null = 0;
|
|
|
|
|
warn_about_return_type = 0;
|
|
|
|
|
current_extern_inline = 0;
|
|
|
|
|
c_function_varargs = 0;
|
|
|
|
|
named_labels = 0;
|
|
|
|
|
shadowed_labels = 0;
|
|
|
|
|
|
1994-10-18 20:42:11 +01:00
|
|
|
|
/* Don't expand any sizes in the return type of the function. */
|
|
|
|
|
immediate_size_expand = 0;
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1);
|
|
|
|
|
|
|
|
|
|
/* If the declarator is not suitable for a function definition,
|
|
|
|
|
cause a syntax error. */
|
|
|
|
|
if (decl1 == 0)
|
1997-11-02 22:19:36 +01:00
|
|
|
|
{
|
|
|
|
|
immediate_size_expand = old_immediate_size_expand;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
c-common.c (decl_attributes): Take a pointer to the node to which attributes are to be attached...
* c-common.c (decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument.
* c-common.h (enum attribute_flags): New.
(decl_attributes): Update prototype.
* c-decl.c (start_decl, push_parm_decl, finish_struct,
finish_enum, start_function): Update calls to decl_attributes.
* c-parse.in (component_declarator, component_notype_declarator,
label): Update calls to decl_attributes.
cp:
* decl2.c (cplus_decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument. Update
call to decl_attributes.
(grokfield): Update call to decl_attributes.
* class.c (finish_struct): Update call to cplus_decl_attributes.
* cp-tree.h (cplus_decl_attributes): Update prototype.
* decl.c (start_decl, grokdeclarator, start_function): Update
calls to decl_attributes and cplus_decl_attributes.
* friend.c (do_friend): Update call to cplus_decl_attributes.
* parse.y (parse_bitfield): Update call to cplus_decl_attributes.
From-SVN: r43995
2001-07-13 22:40:43 +02:00
|
|
|
|
decl_attributes (&decl1, attributes, 0);
|
1995-03-10 03:31:02 +01:00
|
|
|
|
|
2001-10-18 20:29:02 +02:00
|
|
|
|
if (DECL_DECLARED_INLINE_P (decl1)
|
|
|
|
|
&& DECL_UNINLINABLE (decl1)
|
|
|
|
|
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl1)))
|
|
|
|
|
warning_with_decl (decl1,
|
|
|
|
|
"inline function `%s' given attribute noinline");
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
announce_function (decl1);
|
|
|
|
|
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl1))))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-06-26 18:42:23 +02:00
|
|
|
|
error ("return type is an incomplete type");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Make it return void instead. */
|
|
|
|
|
TREE_TYPE (decl1)
|
|
|
|
|
= build_function_type (void_type_node,
|
|
|
|
|
TYPE_ARG_TYPES (TREE_TYPE (decl1)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (warn_about_return_type)
|
2000-06-26 18:42:23 +02:00
|
|
|
|
pedwarn_c99 ("return type defaults to `int'");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Save the parm names or decls from this function's declarator
|
|
|
|
|
where store_parm_decls will find them. */
|
|
|
|
|
current_function_parms = last_function_parms;
|
|
|
|
|
current_function_parm_tags = last_function_parm_tags;
|
|
|
|
|
|
|
|
|
|
/* Make the init_value nonzero so pushdecl knows this is not tentative.
|
|
|
|
|
error_mark_node is replaced below (in poplevel) with the BLOCK. */
|
|
|
|
|
DECL_INITIAL (decl1) = error_mark_node;
|
|
|
|
|
|
|
|
|
|
/* If this definition isn't a prototype and we had a prototype declaration
|
|
|
|
|
before, copy the arg type info from that prototype.
|
|
|
|
|
But not if what we had before was a builtin function. */
|
|
|
|
|
old_decl = lookup_name_current_level (DECL_NAME (decl1));
|
|
|
|
|
if (old_decl != 0 && TREE_CODE (TREE_TYPE (old_decl)) == FUNCTION_TYPE
|
|
|
|
|
&& !DECL_BUILT_IN (old_decl)
|
1992-12-05 01:18:55 +01:00
|
|
|
|
&& (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
|
|
|
|
|
== TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (old_decl))))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
&& TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0)
|
1993-03-18 23:01:56 +01:00
|
|
|
|
{
|
|
|
|
|
TREE_TYPE (decl1) = TREE_TYPE (old_decl);
|
|
|
|
|
current_function_prototype_file = DECL_SOURCE_FILE (old_decl);
|
|
|
|
|
current_function_prototype_line = DECL_SOURCE_LINE (old_decl);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1994-07-21 23:55:22 +02:00
|
|
|
|
/* If there is no explicit declaration, look for any out-of-scope implicit
|
|
|
|
|
declarations. */
|
|
|
|
|
if (old_decl == 0)
|
|
|
|
|
old_decl = IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1));
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Optionally warn of old-fashioned def with no previous prototype. */
|
|
|
|
|
if (warn_strict_prototypes
|
|
|
|
|
&& TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0
|
2001-01-13 13:34:02 +01:00
|
|
|
|
&& !(old_decl != 0
|
|
|
|
|
&& (TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0
|
|
|
|
|
|| (DECL_BUILT_IN (old_decl)
|
|
|
|
|
&& ! C_DECL_ANTICIPATED (old_decl)))))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning ("function declaration isn't a prototype");
|
|
|
|
|
/* Optionally warn of any global def with no previous prototype. */
|
|
|
|
|
else if (warn_missing_prototypes
|
|
|
|
|
&& TREE_PUBLIC (decl1)
|
2001-01-13 13:34:02 +01:00
|
|
|
|
&& !(old_decl != 0
|
|
|
|
|
&& (TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0
|
|
|
|
|
|| (DECL_BUILT_IN (old_decl)
|
|
|
|
|
&& ! C_DECL_ANTICIPATED (old_decl))))
|
2000-08-24 22:09:27 +02:00
|
|
|
|
&& ! MAIN_NAME_P (DECL_NAME (decl1)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning_with_decl (decl1, "no previous prototype for `%s'");
|
|
|
|
|
/* Optionally warn of any def with no previous prototype
|
|
|
|
|
if the function has already been used. */
|
|
|
|
|
else if (warn_missing_prototypes
|
|
|
|
|
&& old_decl != 0 && TREE_USED (old_decl)
|
1994-07-21 23:55:22 +02:00
|
|
|
|
&& TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0)
|
1994-04-06 13:31:44 +02:00
|
|
|
|
warning_with_decl (decl1,
|
2000-08-11 00:01:22 +02:00
|
|
|
|
"`%s' was used with no prototype before its definition");
|
1994-04-06 13:31:44 +02:00
|
|
|
|
/* Optionally warn of any global def with no previous declaration. */
|
|
|
|
|
else if (warn_missing_declarations
|
|
|
|
|
&& TREE_PUBLIC (decl1)
|
|
|
|
|
&& old_decl == 0
|
2000-08-24 22:09:27 +02:00
|
|
|
|
&& ! MAIN_NAME_P (DECL_NAME (decl1)))
|
1994-04-06 13:31:44 +02:00
|
|
|
|
warning_with_decl (decl1, "no previous declaration for `%s'");
|
|
|
|
|
/* Optionally warn of any def with no previous declaration
|
|
|
|
|
if the function has already been used. */
|
|
|
|
|
else if (warn_missing_declarations
|
1994-07-21 23:55:22 +02:00
|
|
|
|
&& old_decl != 0 && TREE_USED (old_decl)
|
|
|
|
|
&& old_decl == IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)))
|
1994-04-06 13:31:44 +02:00
|
|
|
|
warning_with_decl (decl1,
|
2000-08-11 00:01:22 +02:00
|
|
|
|
"`%s' was used with no declaration before its definition");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* This is a definition, not a reference.
|
1992-07-12 04:56:45 +02:00
|
|
|
|
So normally clear DECL_EXTERNAL.
|
1992-02-13 23:21:26 +01:00
|
|
|
|
However, `extern inline' acts like a declaration
|
1992-07-12 04:56:45 +02:00
|
|
|
|
except for defining how to inline. So set DECL_EXTERNAL in that case. */
|
|
|
|
|
DECL_EXTERNAL (decl1) = current_extern_inline;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* This function exists in static storage.
|
|
|
|
|
(This does not mean `static' in the C sense!) */
|
|
|
|
|
TREE_STATIC (decl1) = 1;
|
|
|
|
|
|
|
|
|
|
/* A nested function is not global. */
|
|
|
|
|
if (current_function_decl != 0)
|
|
|
|
|
TREE_PUBLIC (decl1) = 0;
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Warn for unlikely, improbable, or stupid declarations of `main'. */
|
2000-08-24 22:09:27 +02:00
|
|
|
|
if (warn_main > 0 && MAIN_NAME_P (DECL_NAME (decl1)))
|
1997-01-19 21:04:35 +01:00
|
|
|
|
{
|
|
|
|
|
tree args;
|
|
|
|
|
int argct = 0;
|
|
|
|
|
|
|
|
|
|
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
|
2000-08-11 00:01:22 +02:00
|
|
|
|
!= integer_type_node)
|
1997-01-20 04:18:33 +01:00
|
|
|
|
pedwarn_with_decl (decl1, "return type of `%s' is not `int'");
|
1997-01-19 21:04:35 +01:00
|
|
|
|
|
|
|
|
|
for (args = TYPE_ARG_TYPES (TREE_TYPE (decl1)); args;
|
|
|
|
|
args = TREE_CHAIN (args))
|
|
|
|
|
{
|
|
|
|
|
tree type = args ? TREE_VALUE (args) : 0;
|
|
|
|
|
|
|
|
|
|
if (type == void_type_node)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
++argct;
|
|
|
|
|
switch (argct)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
if (TYPE_MAIN_VARIANT (type) != integer_type_node)
|
|
|
|
|
pedwarn_with_decl (decl1,
|
|
|
|
|
"first argument of `%s' should be `int'");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
if (TREE_CODE (type) != POINTER_TYPE
|
|
|
|
|
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|
|
|
|
|
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
|
|
|
|
|
!= char_type_node))
|
|
|
|
|
pedwarn_with_decl (decl1,
|
2000-08-11 00:01:22 +02:00
|
|
|
|
"second argument of `%s' should be `char **'");
|
1997-01-19 21:04:35 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
if (TREE_CODE (type) != POINTER_TYPE
|
|
|
|
|
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|
|
|
|
|
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
|
|
|
|
|
!= char_type_node))
|
|
|
|
|
pedwarn_with_decl (decl1,
|
2000-08-11 00:01:22 +02:00
|
|
|
|
"third argument of `%s' should probably be `char **'");
|
1997-01-19 21:04:35 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
1997-02-02 13:15:44 +01:00
|
|
|
|
}
|
1997-01-19 21:04:35 +01:00
|
|
|
|
|
1997-02-02 13:15:44 +01:00
|
|
|
|
/* It is intentional that this message does not mention the third
|
2001-01-02 16:58:16 +01:00
|
|
|
|
argument because it's only mentioned in an appendix of the
|
|
|
|
|
standard. */
|
1997-02-02 13:15:44 +01:00
|
|
|
|
if (argct > 0 && (argct < 2 || argct > 3))
|
|
|
|
|
pedwarn_with_decl (decl1, "`%s' takes only zero or two arguments");
|
1997-01-19 21:04:35 +01:00
|
|
|
|
|
|
|
|
|
if (! TREE_PUBLIC (decl1))
|
|
|
|
|
pedwarn_with_decl (decl1, "`%s' is normally a non-static function");
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Record the decl so that the function name is defined.
|
|
|
|
|
If we already have a decl for this name, and it is a FUNCTION_DECL,
|
|
|
|
|
use the old decl. */
|
|
|
|
|
|
|
|
|
|
current_function_decl = pushdecl (decl1);
|
|
|
|
|
|
|
|
|
|
pushlevel (0);
|
|
|
|
|
declare_parm_level (1);
|
|
|
|
|
current_binding_level->subblocks_tag_transparent = 1;
|
|
|
|
|
|
2001-01-11 00:06:30 +01:00
|
|
|
|
make_decl_rtl (current_function_decl, NULL);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
restype = TREE_TYPE (TREE_TYPE (current_function_decl));
|
|
|
|
|
/* Promote the value to int before returning it. */
|
2001-05-01 01:59:10 +02:00
|
|
|
|
if (c_promoting_integer_type_p (restype))
|
1992-08-07 06:06:43 +02:00
|
|
|
|
{
|
|
|
|
|
/* It retains unsignedness if traditional
|
|
|
|
|
or if not really getting wider. */
|
|
|
|
|
if (TREE_UNSIGNED (restype)
|
|
|
|
|
&& (flag_traditional
|
|
|
|
|
|| (TYPE_PRECISION (restype)
|
|
|
|
|
== TYPE_PRECISION (integer_type_node))))
|
|
|
|
|
restype = unsigned_type_node;
|
|
|
|
|
else
|
|
|
|
|
restype = integer_type_node;
|
|
|
|
|
}
|
1992-07-07 00:35:53 +02:00
|
|
|
|
DECL_RESULT (current_function_decl)
|
|
|
|
|
= build_decl (RESULT_DECL, NULL_TREE, restype);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* If this fcn was already referenced via a block-scope `extern' decl
|
|
|
|
|
(or an implicit decl), propagate certain information about the usage. */
|
|
|
|
|
if (TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (current_function_decl)))
|
|
|
|
|
TREE_ADDRESSABLE (current_function_decl) = 1;
|
|
|
|
|
|
1994-10-18 20:42:11 +01:00
|
|
|
|
immediate_size_expand = old_immediate_size_expand;
|
|
|
|
|
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
start_fname_decls ();
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record that this function is going to be a varargs function.
|
|
|
|
|
This is called before store_parm_decls, which is too early
|
|
|
|
|
to call mark_varargs directly. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
c_mark_varargs ()
|
|
|
|
|
{
|
|
|
|
|
c_function_varargs = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Store the parameter declarations into the current function declaration.
|
|
|
|
|
This is called after parsing the parameter declarations, before
|
|
|
|
|
digesting the body of the function.
|
|
|
|
|
|
|
|
|
|
For an old-style definition, modify the function's type
|
|
|
|
|
to specify at least the number of arguments. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
store_parm_decls ()
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree fndecl = current_function_decl;
|
|
|
|
|
tree parm;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* This is either a chain of PARM_DECLs (if a prototype was used)
|
|
|
|
|
or a list of IDENTIFIER_NODEs (for an old-fashioned C definition). */
|
|
|
|
|
tree specparms = current_function_parms;
|
|
|
|
|
|
|
|
|
|
/* This is a list of types declared among parms in a prototype. */
|
|
|
|
|
tree parmtags = current_function_parm_tags;
|
|
|
|
|
|
|
|
|
|
/* This is a chain of PARM_DECLs from old-style parm declarations. */
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree parmdecls = getdecls ();
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* This is a chain of any other decls that came in among the parm
|
|
|
|
|
declarations. If a parm is declared with enum {foo, bar} x;
|
|
|
|
|
then CONST_DECLs for foo and bar are put here. */
|
|
|
|
|
tree nonparms = 0;
|
|
|
|
|
|
|
|
|
|
/* Nonzero if this definition is written with a prototype. */
|
|
|
|
|
int prototype = 0;
|
|
|
|
|
|
2001-06-05 08:51:02 +02:00
|
|
|
|
/* The function containing FNDECL, if any. */
|
|
|
|
|
tree context = decl_function_context (fndecl);
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (specparms != 0 && TREE_CODE (specparms) != TREE_LIST)
|
|
|
|
|
{
|
|
|
|
|
/* This case is when the function was defined with an ANSI prototype.
|
|
|
|
|
The parms already have decls, so we need not do anything here
|
|
|
|
|
except record them as in effect
|
|
|
|
|
and complain if any redundant old-style parm decls were written. */
|
|
|
|
|
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree next;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
tree others = 0;
|
|
|
|
|
|
|
|
|
|
prototype = 1;
|
|
|
|
|
|
|
|
|
|
if (parmdecls != 0)
|
1992-10-06 01:23:17 +01:00
|
|
|
|
{
|
|
|
|
|
tree decl, link;
|
|
|
|
|
|
|
|
|
|
error_with_decl (fndecl,
|
|
|
|
|
"parm types given both in parmlist and separately");
|
|
|
|
|
/* Get rid of the erroneous decls; don't keep them on
|
|
|
|
|
the list of parms, since they might not be PARM_DECLs. */
|
|
|
|
|
for (decl = current_binding_level->names;
|
|
|
|
|
decl; decl = TREE_CHAIN (decl))
|
|
|
|
|
if (DECL_NAME (decl))
|
|
|
|
|
IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) = 0;
|
|
|
|
|
for (link = current_binding_level->shadowed;
|
|
|
|
|
link; link = TREE_CHAIN (link))
|
|
|
|
|
IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
|
|
|
|
|
current_binding_level->names = 0;
|
|
|
|
|
current_binding_level->shadowed = 0;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
specparms = nreverse (specparms);
|
|
|
|
|
for (parm = specparms; parm; parm = next)
|
|
|
|
|
{
|
|
|
|
|
next = TREE_CHAIN (parm);
|
|
|
|
|
if (TREE_CODE (parm) == PARM_DECL)
|
|
|
|
|
{
|
|
|
|
|
if (DECL_NAME (parm) == 0)
|
|
|
|
|
error_with_decl (parm, "parameter name omitted");
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
else if (TREE_CODE (TREE_TYPE (parm)) != ERROR_MARK
|
2000-06-05 15:16:14 +02:00
|
|
|
|
&& VOID_TYPE_P (TREE_TYPE (parm)))
|
1992-06-24 01:15:52 +02:00
|
|
|
|
{
|
|
|
|
|
error_with_decl (parm, "parameter `%s' declared void");
|
|
|
|
|
/* Change the type to error_mark_node so this parameter
|
|
|
|
|
will be ignored by assign_parms. */
|
|
|
|
|
TREE_TYPE (parm) = error_mark_node;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
pushdecl (parm);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* If we find an enum constant or a type tag,
|
|
|
|
|
put it aside for the moment. */
|
|
|
|
|
TREE_CHAIN (parm) = 0;
|
|
|
|
|
others = chainon (others, parm);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the decls in their original chain order
|
|
|
|
|
and record in the function. */
|
|
|
|
|
DECL_ARGUMENTS (fndecl) = getdecls ();
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
/* If this function takes a variable number of arguments,
|
|
|
|
|
add a phony parameter to the end of the parm list,
|
|
|
|
|
to represent the position of the first unnamed argument. */
|
|
|
|
|
if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl))))
|
|
|
|
|
!= void_type_node)
|
|
|
|
|
{
|
|
|
|
|
tree dummy = build_decl (PARM_DECL, NULL_TREE, void_type_node);
|
|
|
|
|
/* Let's hope the address of the unnamed parm
|
|
|
|
|
won't depend on its type. */
|
|
|
|
|
TREE_TYPE (dummy) = integer_type_node;
|
|
|
|
|
DECL_ARG_TYPE (dummy) = integer_type_node;
|
2000-08-11 00:01:22 +02:00
|
|
|
|
DECL_ARGUMENTS (fndecl) = chainon (DECL_ARGUMENTS (fndecl), dummy);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Now pushdecl the enum constants. */
|
|
|
|
|
for (parm = others; parm; parm = next)
|
|
|
|
|
{
|
|
|
|
|
next = TREE_CHAIN (parm);
|
|
|
|
|
if (DECL_NAME (parm) == 0)
|
|
|
|
|
;
|
1992-07-25 01:52:30 +02:00
|
|
|
|
else if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == void_type_node)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
;
|
|
|
|
|
else if (TREE_CODE (parm) != PARM_DECL)
|
|
|
|
|
pushdecl (parm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
storetags (chainon (parmtags, gettags ()));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* SPECPARMS is an identifier list--a chain of TREE_LIST nodes
|
|
|
|
|
each with a parm name as the TREE_VALUE.
|
|
|
|
|
|
|
|
|
|
PARMDECLS is a chain of declarations for parameters.
|
|
|
|
|
Warning! It can also contain CONST_DECLs which are not parameters
|
|
|
|
|
but are names of enumerators of any enum types
|
|
|
|
|
declared among the parameters.
|
|
|
|
|
|
|
|
|
|
First match each formal parameter name with its declaration.
|
|
|
|
|
Associate decls with the names and store the decls
|
|
|
|
|
into the TREE_PURPOSE slots. */
|
|
|
|
|
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
/* We use DECL_WEAK as a flag to show which parameters have been
|
|
|
|
|
seen already since it is not used on PARM_DECL or CONST_DECL. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
for (parm = parmdecls; parm; parm = TREE_CHAIN (parm))
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
DECL_WEAK (parm) = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
for (parm = specparms; parm; parm = TREE_CHAIN (parm))
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree tail, found = NULL;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
if (TREE_VALUE (parm) == 0)
|
|
|
|
|
{
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
error_with_decl (fndecl,
|
|
|
|
|
"parameter name missing from parameter list");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TREE_PURPOSE (parm) = 0;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* See if any of the parmdecls specifies this parm by name.
|
|
|
|
|
Ignore any enumerator decls. */
|
|
|
|
|
for (tail = parmdecls; tail; tail = TREE_CHAIN (tail))
|
|
|
|
|
if (DECL_NAME (tail) == TREE_VALUE (parm)
|
|
|
|
|
&& TREE_CODE (tail) == PARM_DECL)
|
|
|
|
|
{
|
|
|
|
|
found = tail;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If declaration already marked, we have a duplicate name.
|
2001-10-10 13:33:39 +02:00
|
|
|
|
Complain, and don't use this decl twice. */
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
if (found && DECL_WEAK (found))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error_with_decl (found, "multiple parameters named `%s'");
|
|
|
|
|
found = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the declaration says "void", complain and ignore it. */
|
2000-06-05 15:16:14 +02:00
|
|
|
|
if (found && VOID_TYPE_P (TREE_TYPE (found)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error_with_decl (found, "parameter `%s' declared void");
|
|
|
|
|
TREE_TYPE (found) = integer_type_node;
|
|
|
|
|
DECL_ARG_TYPE (found) = integer_type_node;
|
|
|
|
|
layout_decl (found, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Traditionally, a parm declared float is actually a double. */
|
|
|
|
|
if (found && flag_traditional
|
1992-07-15 20:34:18 +02:00
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_TYPE (found)) == float_type_node)
|
1993-03-05 06:43:51 +01:00
|
|
|
|
{
|
|
|
|
|
TREE_TYPE (found) = double_type_node;
|
|
|
|
|
DECL_ARG_TYPE (found) = double_type_node;
|
|
|
|
|
layout_decl (found, 0);
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* If no declaration found, default to int. */
|
|
|
|
|
if (!found)
|
|
|
|
|
{
|
|
|
|
|
found = build_decl (PARM_DECL, TREE_VALUE (parm),
|
|
|
|
|
integer_type_node);
|
|
|
|
|
DECL_ARG_TYPE (found) = TREE_TYPE (found);
|
|
|
|
|
DECL_SOURCE_LINE (found) = DECL_SOURCE_LINE (fndecl);
|
|
|
|
|
DECL_SOURCE_FILE (found) = DECL_SOURCE_FILE (fndecl);
|
2000-07-27 17:49:56 +02:00
|
|
|
|
if (flag_isoc99)
|
|
|
|
|
pedwarn_with_decl (found, "type of `%s' defaults to `int'");
|
|
|
|
|
else if (extra_warnings)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning_with_decl (found, "type of `%s' defaults to `int'");
|
|
|
|
|
pushdecl (found);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TREE_PURPOSE (parm) = found;
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Mark this decl as "already found". */
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
DECL_WEAK (found) = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Put anything which is on the parmdecls chain and which is
|
|
|
|
|
not a PARM_DECL onto the list NONPARMS. (The types of
|
|
|
|
|
non-parm things which might appear on the list include
|
|
|
|
|
enumerators and NULL-named TYPE_DECL nodes.) Complain about
|
|
|
|
|
any actual PARM_DECLs not matched with any names. */
|
|
|
|
|
|
|
|
|
|
nonparms = 0;
|
2000-08-11 00:01:22 +02:00
|
|
|
|
for (parm = parmdecls; parm;)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
tree next = TREE_CHAIN (parm);
|
|
|
|
|
TREE_CHAIN (parm) = 0;
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (parm) != PARM_DECL)
|
|
|
|
|
nonparms = chainon (nonparms, parm);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Complain about args with incomplete types. */
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (TREE_TYPE (parm)))
|
2000-08-11 00:01:22 +02:00
|
|
|
|
{
|
|
|
|
|
error_with_decl (parm, "parameter `%s' has incomplete type");
|
|
|
|
|
TREE_TYPE (parm) = error_mark_node;
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
if (! DECL_WEAK (parm))
|
2000-08-11 00:01:22 +02:00
|
|
|
|
{
|
|
|
|
|
error_with_decl (parm,
|
|
|
|
|
"declaration for parameter `%s' but no such parameter");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Pretend the parameter was not missing.
|
|
|
|
|
This gets us to a standard state and minimizes
|
|
|
|
|
further error messages. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
specparms
|
1992-02-13 23:21:26 +01:00
|
|
|
|
= chainon (specparms,
|
|
|
|
|
tree_cons (parm, NULL_TREE, NULL_TREE));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parm = next;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Chain the declarations together in the order of the list of
|
|
|
|
|
names. Store that chain in the function decl, replacing the
|
|
|
|
|
list of names. */
|
1992-02-13 23:21:26 +01:00
|
|
|
|
parm = specparms;
|
|
|
|
|
DECL_ARGUMENTS (fndecl) = 0;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree last;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
for (last = 0; parm; parm = TREE_CHAIN (parm))
|
|
|
|
|
if (TREE_PURPOSE (parm))
|
|
|
|
|
{
|
|
|
|
|
if (last == 0)
|
|
|
|
|
DECL_ARGUMENTS (fndecl) = TREE_PURPOSE (parm);
|
|
|
|
|
else
|
|
|
|
|
TREE_CHAIN (last) = TREE_PURPOSE (parm);
|
|
|
|
|
last = TREE_PURPOSE (parm);
|
|
|
|
|
TREE_CHAIN (last) = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If there was a previous prototype,
|
|
|
|
|
set the DECL_ARG_TYPE of each argument according to
|
|
|
|
|
the type previously specified, and report any mismatches. */
|
|
|
|
|
|
|
|
|
|
if (TYPE_ARG_TYPES (TREE_TYPE (fndecl)))
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree type;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
for (parm = DECL_ARGUMENTS (fndecl),
|
|
|
|
|
type = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
|
1992-07-25 01:52:30 +02:00
|
|
|
|
parm || (type && (TYPE_MAIN_VARIANT (TREE_VALUE (type))
|
|
|
|
|
!= void_type_node));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
parm = TREE_CHAIN (parm), type = TREE_CHAIN (type))
|
|
|
|
|
{
|
|
|
|
|
if (parm == 0 || type == 0
|
1992-07-25 01:52:30 +02:00
|
|
|
|
|| TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
error ("number of arguments doesn't match prototype");
|
1993-03-18 23:01:56 +01:00
|
|
|
|
error_with_file_and_line (current_function_prototype_file,
|
|
|
|
|
current_function_prototype_line,
|
|
|
|
|
"prototype declaration");
|
1992-02-13 23:21:26 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
2001-06-11 15:26:19 +02:00
|
|
|
|
/* Type for passing arg must be consistent with that
|
|
|
|
|
declared for the arg. ISO C says we take the unqualified
|
|
|
|
|
type for parameters declared with qualified type. */
|
|
|
|
|
if (! comptypes (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (parm)),
|
|
|
|
|
TYPE_MAIN_VARIANT (TREE_VALUE (type))))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1992-12-22 23:56:39 +01:00
|
|
|
|
if (TYPE_MAIN_VARIANT (TREE_TYPE (parm))
|
|
|
|
|
== TYPE_MAIN_VARIANT (TREE_VALUE (type)))
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1992-04-04 10:50:38 +02:00
|
|
|
|
/* Adjust argument to match prototype. E.g. a previous
|
|
|
|
|
`int foo(float);' prototype causes
|
|
|
|
|
`int foo(x) float x; {...}' to be treated like
|
|
|
|
|
`int foo(float x) {...}'. This is particularly
|
|
|
|
|
useful for argument types like uid_t. */
|
|
|
|
|
DECL_ARG_TYPE (parm) = TREE_TYPE (parm);
|
1999-08-03 01:17:06 +02:00
|
|
|
|
|
|
|
|
|
if (PROMOTE_PROTOTYPES
|
2001-06-04 22:26:16 +02:00
|
|
|
|
&& INTEGRAL_TYPE_P (TREE_TYPE (parm))
|
1992-04-04 10:50:38 +02:00
|
|
|
|
&& TYPE_PRECISION (TREE_TYPE (parm))
|
|
|
|
|
< TYPE_PRECISION (integer_type_node))
|
|
|
|
|
DECL_ARG_TYPE (parm) = integer_type_node;
|
1999-08-03 01:17:06 +02:00
|
|
|
|
|
1992-04-04 10:50:38 +02:00
|
|
|
|
if (pedantic)
|
1993-03-18 23:01:56 +01:00
|
|
|
|
{
|
1993-03-29 06:49:21 +02:00
|
|
|
|
pedwarn ("promoted argument `%s' doesn't match prototype",
|
1993-03-18 23:01:56 +01:00
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (parm)));
|
|
|
|
|
warning_with_file_and_line
|
|
|
|
|
(current_function_prototype_file,
|
|
|
|
|
current_function_prototype_line,
|
|
|
|
|
"prototype declaration");
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
1992-04-04 10:50:38 +02:00
|
|
|
|
/* If -traditional, allow `int' argument to match
|
|
|
|
|
`unsigned' prototype. */
|
|
|
|
|
else if (! (flag_traditional
|
1992-07-15 20:34:18 +02:00
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == integer_type_node
|
|
|
|
|
&& TYPE_MAIN_VARIANT (TREE_VALUE (type)) == unsigned_type_node))
|
1993-03-18 23:01:56 +01:00
|
|
|
|
{
|
|
|
|
|
error ("argument `%s' doesn't match prototype",
|
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (parm)));
|
|
|
|
|
error_with_file_and_line (current_function_prototype_file,
|
|
|
|
|
current_function_prototype_line,
|
|
|
|
|
"prototype declaration");
|
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Otherwise, create a prototype that would match. */
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
1994-02-27 16:43:17 +01:00
|
|
|
|
tree actual = 0, last = 0, type;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
for (parm = DECL_ARGUMENTS (fndecl); parm; parm = TREE_CHAIN (parm))
|
|
|
|
|
{
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
type = tree_cons (NULL_TREE, DECL_ARG_TYPE (parm), NULL_TREE);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (last)
|
|
|
|
|
TREE_CHAIN (last) = type;
|
|
|
|
|
else
|
|
|
|
|
actual = type;
|
|
|
|
|
last = type;
|
|
|
|
|
}
|
c-common.c, [...]: Remove all references to obstack functions obsoleted by GC...
* c-common.c, c-decl.c, c-lang.c, c-lex.c, c-parse.in, c-pragma.c,
c-typeck.c, objc/objc-act.c: Remove all references to obstack
functions obsoleted by GC, such as push_obstacks_nochange,
end_temporary_allocation, savealloc, saveable_tree_cons, etc.
and code which existed only to decide whether or not to call
them. Remove now-unused NESTED argument from start_function;
all callers changed. Do not change behavior based on ggc_p.
The use of the ixp_obstack in c-iterate.c and the util_obstack
in objc/objc-act.c remain; these are not obsoleted by garbage
collection.
* c-tree.h: Update prototype for start_function.
* c-parse.y, c-parse.c, objc/objc-parse.c, objc/objc-parse.y: Rebuild.
From-SVN: r31611
2000-01-25 18:13:14 +01:00
|
|
|
|
type = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
if (last)
|
|
|
|
|
TREE_CHAIN (last) = type;
|
|
|
|
|
else
|
|
|
|
|
actual = type;
|
|
|
|
|
|
1992-03-08 23:08:20 +01:00
|
|
|
|
/* We are going to assign a new value for the TYPE_ACTUAL_ARG_TYPES
|
|
|
|
|
of the type of this function, but we need to avoid having this
|
|
|
|
|
affect the types of other similarly-typed functions, so we must
|
|
|
|
|
first force the generation of an identical (but separate) type
|
|
|
|
|
node for the relevant function type. The new node we create
|
|
|
|
|
will be a variant of the main variant of the original function
|
|
|
|
|
type. */
|
|
|
|
|
|
1992-03-23 03:07:53 +01:00
|
|
|
|
TREE_TYPE (fndecl) = build_type_copy (TREE_TYPE (fndecl));
|
1992-03-08 23:08:20 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = actual;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now store the final chain of decls for the arguments
|
|
|
|
|
as the decl-chain of the current lexical scope.
|
|
|
|
|
Put the enumerators in as well, at the front so that
|
|
|
|
|
DECL_ARGUMENTS is not modified. */
|
|
|
|
|
|
|
|
|
|
storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make sure the binding level for the top of the function body
|
|
|
|
|
gets a BLOCK if there are any in the function.
|
|
|
|
|
Otherwise, the dbx output is wrong. */
|
|
|
|
|
|
|
|
|
|
keep_next_if_subblocks = 1;
|
|
|
|
|
|
|
|
|
|
/* ??? This might be an improvement,
|
|
|
|
|
but needs to be thought about some more. */
|
|
|
|
|
#if 0
|
|
|
|
|
keep_next_level_flag = 1;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Write a record describing this function definition to the prototypes
|
|
|
|
|
file (if requested). */
|
|
|
|
|
|
|
|
|
|
gen_aux_info_record (fndecl, 1, 0, prototype);
|
|
|
|
|
|
|
|
|
|
/* Initialize the RTL code for the function. */
|
|
|
|
|
init_function_start (fndecl, input_filename, lineno);
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Begin the statement tree for this function. */
|
|
|
|
|
begin_stmt_tree (&DECL_SAVED_TREE (current_function_decl));
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2001-06-05 08:51:02 +02:00
|
|
|
|
/* If this is a nested function, save away the sizes of any
|
|
|
|
|
variable-size types so that we can expand them when generating
|
|
|
|
|
RTL. */
|
|
|
|
|
if (context)
|
|
|
|
|
{
|
|
|
|
|
tree t;
|
|
|
|
|
|
|
|
|
|
DECL_LANG_SPECIFIC (fndecl)->pending_sizes
|
|
|
|
|
= nreverse (get_pending_sizes ());
|
|
|
|
|
for (t = DECL_LANG_SPECIFIC (fndecl)->pending_sizes;
|
|
|
|
|
t;
|
|
|
|
|
t = TREE_CHAIN (t))
|
|
|
|
|
SAVE_EXPR_CONTEXT (TREE_VALUE (t)) = context;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* This function is being processed in whole-function mode. */
|
|
|
|
|
cfun->x_whole_function_mode_p = 1;
|
1992-05-18 07:09:24 +02:00
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Even though we're inside a function body, we still don't want to
|
|
|
|
|
call expand_expr to calculate the size of a variable-sized array.
|
|
|
|
|
We haven't necessarily assigned RTL to all variables yet, so it's
|
|
|
|
|
not safe to try to expand expressions involving them. */
|
|
|
|
|
immediate_size_expand = 0;
|
|
|
|
|
cfun->x_dont_save_pending_sizes_p = 1;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Finish up a function declaration and compile that function
|
|
|
|
|
all the way to assembler language output. The free the storage
|
|
|
|
|
for the function definition.
|
|
|
|
|
|
|
|
|
|
This is called after parsing the body of the function definition.
|
|
|
|
|
|
|
|
|
|
NESTED is nonzero if the function being finished is nested in another. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
finish_function (nested)
|
|
|
|
|
int nested;
|
|
|
|
|
{
|
2001-10-11 05:16:15 +02:00
|
|
|
|
tree fndecl = current_function_decl;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* TREE_READONLY (fndecl) = 1;
|
|
|
|
|
This caused &foo to be of type ptr-to-const-function
|
|
|
|
|
which then got a warning when stored in a ptr-to-function variable. */
|
|
|
|
|
|
|
|
|
|
poplevel (1, 0, 1);
|
1992-07-05 23:12:43 +02:00
|
|
|
|
BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
|
|
|
|
/* Must mark the RESULT_DECL as being in this function. */
|
|
|
|
|
|
|
|
|
|
DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
|
|
|
|
|
|
|
|
|
|
/* Obey `register' declarations if `setjmp' is called in this fn. */
|
|
|
|
|
if (flag_traditional && current_function_calls_setjmp)
|
|
|
|
|
{
|
|
|
|
|
setjmp_protect (DECL_INITIAL (fndecl));
|
|
|
|
|
setjmp_protect_args ();
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-24 22:09:27 +02:00
|
|
|
|
if (MAIN_NAME_P (DECL_NAME (fndecl)) && flag_hosted)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
1992-07-15 20:34:18 +02:00
|
|
|
|
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
|
|
|
|
|
!= integer_type_node)
|
1997-01-19 21:04:35 +01:00
|
|
|
|
{
|
1999-04-12 16:05:29 +02:00
|
|
|
|
/* If warn_main is 1 (-Wmain) or 2 (-Wall), we have already warned.
|
2000-08-11 00:01:22 +02:00
|
|
|
|
If warn_main is -1 (-Wno-main) we don't want to be warned. */
|
1997-01-19 21:04:35 +01:00
|
|
|
|
if (! warn_main)
|
|
|
|
|
pedwarn_with_decl (fndecl, "return type of `%s' is not `int'");
|
|
|
|
|
}
|
1992-07-07 03:09:25 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
1996-04-08 20:44:21 +02:00
|
|
|
|
#ifdef DEFAULT_MAIN_RETURN
|
1992-07-07 03:09:25 +02:00
|
|
|
|
/* Make it so that `main' always returns success by default. */
|
|
|
|
|
DEFAULT_MAIN_RETURN;
|
2000-07-27 21:51:41 +02:00
|
|
|
|
#else
|
|
|
|
|
if (flag_isoc99)
|
|
|
|
|
c_expand_return (integer_zero_node);
|
1996-04-08 20:44:21 +02:00
|
|
|
|
#endif
|
1992-07-07 03:09:25 +02:00
|
|
|
|
}
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
Lazy __FUNCTION__ generation.
gcc:
Lazy __FUNCTION__ generation.
* c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME,
RID_C99_FUNCTION_NAME): New _RIDs.
(CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove.
(CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL,
CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New
global tree slots.
(function_id_node, pretty_function_id_node, func_id_node): Remove.
(c99_function_name_decl_node, function_name_decl_node,
pretty_function_name_decl_node, saved_function_name_decls):
Declare.
(struct language_function): Remove x_function_name_declared_p.
(make_fname_decl): Remove a parameter.
(declare_function_names): Remove prototype.
(start_fname_decls, finish_fname_decls): Prototype.
(fname_as_string): Likewise.
(fname_string, fname_decl): Likewise.
* c-common.c (make_fname_decl): Adjust.
(struct fname_var_t): New struct.
(fname_vars): New static array.
(declare_function_name): Remove.
(start_fname_decls, finish_fname_decls): New functions.
(fname_as_string): New function from remnants of
declare_function_name.
(fname_string, fname_decl): New functions.
* c-decl.c (c_function_name_declared_p): Remove.
(init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(c_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number. Call finish_decl.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
Remove c_function_name_declared_p.
(push_c_function_context): Don't push c_function_name_declared_p.
(pop_c_function_context): Don't pop c_function_name_declared_p.
(c_begin_compound_stmt): Don't check c_function_name_declared_p.
* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens.
(program): Call finish_fname_decls for C.
(primary): Add VAR_FUNC_NAME.
(reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
(yylexname): If it's a STRING_FUNC_NAME generate the function name
now. Don't look for VAR_DECLs containing __FUNCTION__ et al.
* c-semantics.c (prune_unused_decls): Remove.
(finish_stmt_tree): Don't call prune_unused_decls.
(genrtl_decl_stmt): Don't prune unused decls here.
cp:
Lazy __FUNCTION__ generation.
* cp-tree.def (FUNCTION_NAME): Remove.
* cp-tree.h (function_name_declared_p): Remove.
(cp_fname_init): Prototype.
* decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
don't call declare_function_name. Call start_fname_decls.
(cp_make_fname_decl): Adjust parameters. Generate the name. Don't
clobber the line number.
(cp_fname_init): New function.
(start_function): Call start_fname_decls.
(finish_function): Call finish_fname_decls.
* lex.c (reswords): Add slots for __FUNCTION__ et al.
(rid_to_yy): Add mappings for __FUNCTION__ et al.
* optimize.c (maybe_clone_body): Remove function_name_declared_p.
* parse.y (VAR_FUNC_NAME): New token.
(primary): Add VAR_FUNC_NAME.
* pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
generation.
(tsubst, FUNCTION_NAME case): Remove.
(tsubst_copy, FUNCTION_NAME case): Remove.
(tsubst_expr, DECL_STMT case): Be careful with a
DECL_PRETTY_FUNCTION_P.
(instantiate_decl): Remove function_name_declared_p.
* semantics.c (begin_compound_statement): Don't call
declare_function_name here.
(setup_vtbl_ptr). Don't save & restore function_name_declared_p.
(finish_translation_unit): Call finish_fname_decls.
(expand_body): Remove function_name_declared_p.
* typeck2.c (digest_init): Allow any ERROR_MARK.
testsuite:
* gcc.dg/c99-func-2.c: Remove xfail.
* gcc.dg/c99-func-3.c: Remove xfail.
* gcc.dg/c99-func-4.c: Remove xfail.
From-SVN: r41520
2001-04-24 10:22:06 +02:00
|
|
|
|
|
|
|
|
|
finish_fname_decls ();
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Tie off the statement tree for this function. */
|
|
|
|
|
finish_stmt_tree (&DECL_SAVED_TREE (fndecl));
|
|
|
|
|
/* Clear out memory we no longer need. */
|
|
|
|
|
free_after_parsing (cfun);
|
|
|
|
|
/* Since we never call rest_of_compilation, we never clear
|
|
|
|
|
CFUN. Do so explicitly. */
|
|
|
|
|
free_after_compilation (cfun);
|
|
|
|
|
cfun = NULL;
|
|
|
|
|
|
|
|
|
|
if (! nested)
|
|
|
|
|
{
|
|
|
|
|
/* Generate RTL for the body of this function. */
|
2001-11-12 01:02:36 +01:00
|
|
|
|
c_expand_body (fndecl, nested, 1);
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Let the error reporting routines know that we're outside a
|
|
|
|
|
function. For a nested function, this value is used in
|
|
|
|
|
pop_c_function_context and then reset via pop_function_context. */
|
|
|
|
|
current_function_decl = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-12 01:02:36 +01:00
|
|
|
|
/* Generate the RTL for a deferred function FNDECL. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
c_expand_deferred_function (fndecl)
|
|
|
|
|
tree fndecl;
|
|
|
|
|
{
|
2001-11-21 12:09:01 +01:00
|
|
|
|
/* DECL_INLINE or DECL_RESULT might got cleared after the inline
|
|
|
|
|
function was deferred, e.g. in duplicate_decls. */
|
|
|
|
|
if (DECL_INLINE (fndecl) && DECL_RESULT (fndecl))
|
|
|
|
|
{
|
|
|
|
|
c_expand_body (fndecl, 0, 0);
|
|
|
|
|
current_function_decl = NULL;
|
|
|
|
|
}
|
2001-11-12 01:02:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Generate the RTL for the body of FNDECL. If NESTED_P is non-zero,
|
|
|
|
|
then we are already in the process of generating RTL for another
|
2001-11-12 01:02:36 +01:00
|
|
|
|
function. If can_defer_p is zero, we won't attempt to defer the
|
|
|
|
|
generation of RTL. */
|
2000-09-17 09:38:23 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2001-11-12 01:02:36 +01:00
|
|
|
|
c_expand_body (fndecl, nested_p, can_defer_p)
|
2000-09-17 09:38:23 +02:00
|
|
|
|
tree fndecl;
|
2001-11-12 01:02:36 +01:00
|
|
|
|
int nested_p, can_defer_p;
|
2000-09-17 09:38:23 +02:00
|
|
|
|
{
|
2001-10-05 06:20:27 +02:00
|
|
|
|
int uninlinable = 1;
|
|
|
|
|
|
2000-10-01 21:19:30 +02:00
|
|
|
|
/* There's no reason to do any of the work here if we're only doing
|
|
|
|
|
semantic analysis; this code just generates RTL. */
|
|
|
|
|
if (flag_syntax_only)
|
|
|
|
|
return;
|
|
|
|
|
|
2001-10-05 06:20:27 +02:00
|
|
|
|
if (flag_inline_trees)
|
|
|
|
|
{
|
|
|
|
|
/* First, cache whether the current function is inlinable. Some
|
|
|
|
|
predicates depend on cfun and current_function_decl to
|
|
|
|
|
function completely. */
|
2001-11-14 20:36:17 +01:00
|
|
|
|
timevar_push (TV_INTEGRATION);
|
2001-10-05 06:20:27 +02:00
|
|
|
|
uninlinable = ! tree_inlinable_function_p (fndecl);
|
|
|
|
|
|
2001-11-12 01:02:36 +01:00
|
|
|
|
if (! uninlinable && can_defer_p
|
|
|
|
|
/* Save function tree for inlining. Should return 0 if the
|
|
|
|
|
language does not support function deferring or the
|
|
|
|
|
function could not be deferred. */
|
|
|
|
|
&& defer_fn (fndecl))
|
|
|
|
|
{
|
ChangeLog.0, [...]: Fix spelling errors.
* ChangeLog.0, ChangeLog.2, ChangeLog.3, ChangeLog.4, ChangeLog,
FSFChangeLog.10, c-decl.c, cppfiles.c, cppinit.c, cpplex.c,
cpplib.c, cppmain.c, cse.c, df.c, diagnostic.c, dominance.c,
dwarf2out.c, dwarfout.c, emit-rtl.c, errors.c, except.c, except.h,
explow.c, function.c, gcse.c, genrecog.c, predict.c, regmove.c,
sched-rgn.c, ssa-ccp.c, stmt.c, toplev.c: Fix spelling errors.
From-SVN: r47279
2001-11-23 03:05:19 +01:00
|
|
|
|
/* Let the back-end know that this function exists. */
|
2001-11-12 01:02:36 +01:00
|
|
|
|
(*debug_hooks->deferred_inline_function) (fndecl);
|
2001-11-14 20:36:17 +01:00
|
|
|
|
timevar_pop (TV_INTEGRATION);
|
2001-11-12 01:02:36 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-05 06:20:27 +02:00
|
|
|
|
/* Then, inline any functions called in it. */
|
|
|
|
|
optimize_inline_calls (fndecl);
|
2001-11-14 20:36:17 +01:00
|
|
|
|
timevar_pop (TV_INTEGRATION);
|
2001-10-05 06:20:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-11-14 20:36:17 +01:00
|
|
|
|
timevar_push (TV_EXPAND);
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
if (nested_p)
|
2001-06-05 08:51:02 +02:00
|
|
|
|
{
|
|
|
|
|
/* Make sure that we will evaluate variable-sized types involved
|
|
|
|
|
in our function's type. */
|
|
|
|
|
expand_pending_sizes (DECL_LANG_SPECIFIC (fndecl)->pending_sizes);
|
|
|
|
|
/* Squirrel away our current state. */
|
|
|
|
|
push_function_context ();
|
|
|
|
|
}
|
2000-09-17 09:38:23 +02:00
|
|
|
|
|
|
|
|
|
/* Initialize the RTL code for the function. */
|
|
|
|
|
current_function_decl = fndecl;
|
2000-11-26 01:16:18 +01:00
|
|
|
|
init_function_start (fndecl, input_filename, DECL_SOURCE_LINE (fndecl));
|
2000-09-17 09:38:23 +02:00
|
|
|
|
|
|
|
|
|
/* This function is being processed in whole-function mode. */
|
|
|
|
|
cfun->x_whole_function_mode_p = 1;
|
|
|
|
|
|
|
|
|
|
/* Even though we're inside a function body, we still don't want to
|
|
|
|
|
call expand_expr to calculate the size of a variable-sized array.
|
|
|
|
|
We haven't necessarily assigned RTL to all variables yet, so it's
|
|
|
|
|
not safe to try to expand expressions involving them. */
|
|
|
|
|
immediate_size_expand = 0;
|
|
|
|
|
cfun->x_dont_save_pending_sizes_p = 1;
|
|
|
|
|
|
2000-09-19 04:14:33 +02:00
|
|
|
|
/* If this is a varargs function, inform function.c. */
|
|
|
|
|
if (c_function_varargs)
|
|
|
|
|
mark_varargs ();
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Set up parameters and prepare for return, for the function. */
|
|
|
|
|
expand_function_start (fndecl, 0);
|
|
|
|
|
|
|
|
|
|
/* If this function is `main', emit a call to `__main'
|
|
|
|
|
to run global initializers, etc. */
|
|
|
|
|
if (DECL_NAME (fndecl)
|
|
|
|
|
&& MAIN_NAME_P (DECL_NAME (fndecl))
|
|
|
|
|
&& DECL_CONTEXT (fndecl) == NULL_TREE)
|
|
|
|
|
expand_main_function ();
|
|
|
|
|
|
|
|
|
|
/* Generate the RTL for this function. */
|
|
|
|
|
expand_stmt (DECL_SAVED_TREE (fndecl));
|
2001-10-05 06:20:27 +02:00
|
|
|
|
if (uninlinable)
|
|
|
|
|
{
|
|
|
|
|
/* Allow the body of the function to be garbage collected. */
|
|
|
|
|
DECL_SAVED_TREE (fndecl) = NULL_TREE;
|
|
|
|
|
}
|
2000-09-17 09:38:23 +02:00
|
|
|
|
|
2001-06-05 08:51:02 +02:00
|
|
|
|
/* We hard-wired immediate_size_expand to zero above.
|
2000-09-17 09:38:23 +02:00
|
|
|
|
expand_function_end will decrement this variable. So, we set the
|
|
|
|
|
variable to one here, so that after the decrement it will remain
|
|
|
|
|
zero. */
|
|
|
|
|
immediate_size_expand = 1;
|
|
|
|
|
|
|
|
|
|
/* Allow language dialects to perform special processing. */
|
|
|
|
|
if (lang_expand_function_end)
|
|
|
|
|
(*lang_expand_function_end) ();
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Generate rtl for function exit. */
|
1993-11-23 07:19:09 +01:00
|
|
|
|
expand_function_end (input_filename, lineno, 0);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
1999-09-10 05:16:49 +02:00
|
|
|
|
/* If this is a nested function, protect the local variables in the stack
|
|
|
|
|
above us from being collected while we're compiling this function. */
|
2000-09-17 09:38:23 +02:00
|
|
|
|
if (nested_p)
|
1999-09-10 05:16:49 +02:00
|
|
|
|
ggc_push_context ();
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Run the optimizers and output the assembler code for this function. */
|
|
|
|
|
rest_of_compilation (fndecl);
|
|
|
|
|
|
1999-09-10 05:16:49 +02:00
|
|
|
|
/* Undo the GC context switch. */
|
2000-09-17 09:38:23 +02:00
|
|
|
|
if (nested_p)
|
1999-09-10 05:16:49 +02:00
|
|
|
|
ggc_pop_context ();
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* With just -W, complain only if function returns both with
|
|
|
|
|
and without a value. */
|
2000-10-06 08:01:27 +02:00
|
|
|
|
if (extra_warnings
|
|
|
|
|
&& current_function_returns_value
|
|
|
|
|
&& current_function_returns_null)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
warning ("this function may return with or without a value");
|
|
|
|
|
|
1994-02-27 21:19:57 +01:00
|
|
|
|
/* If requested, warn about function definitions where the function will
|
|
|
|
|
return a value (usually of some struct or union type) which itself will
|
|
|
|
|
take up a lot of stack space. */
|
|
|
|
|
|
|
|
|
|
if (warn_larger_than && !DECL_EXTERNAL (fndecl) && TREE_TYPE (fndecl))
|
|
|
|
|
{
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
tree ret_type = TREE_TYPE (TREE_TYPE (fndecl));
|
1994-02-27 21:19:57 +01:00
|
|
|
|
|
2001-01-30 20:19:40 +01:00
|
|
|
|
if (ret_type && TYPE_SIZE_UNIT (ret_type)
|
|
|
|
|
&& TREE_CODE (TYPE_SIZE_UNIT (ret_type)) == INTEGER_CST
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
&& 0 < compare_tree_int (TYPE_SIZE_UNIT (ret_type),
|
|
|
|
|
larger_than_size))
|
1994-02-27 21:19:57 +01:00
|
|
|
|
{
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
unsigned int size_as_int
|
|
|
|
|
= TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type));
|
1994-02-27 21:19:57 +01:00
|
|
|
|
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0)
|
|
|
|
|
warning_with_decl (fndecl,
|
|
|
|
|
"size of return value of `%s' is %u bytes",
|
|
|
|
|
size_as_int);
|
|
|
|
|
else
|
|
|
|
|
warning_with_decl (fndecl,
|
2000-08-11 00:01:22 +02:00
|
|
|
|
"size of return value of `%s' is larger than %d bytes",
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
larger_than_size);
|
1994-02-27 21:19:57 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-05 06:20:27 +02:00
|
|
|
|
if (DECL_SAVED_INSNS (fndecl) == 0 && ! nested_p
|
|
|
|
|
&& ! flag_inline_trees)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-08-11 00:01:22 +02:00
|
|
|
|
/* Stop pointing to the local nodes about to be freed.
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
But DECL_INITIAL must remain nonzero so we know this
|
2000-08-11 00:01:22 +02:00
|
|
|
|
was an actual function definition.
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
For a nested function, this is done in pop_c_function_context.
|
|
|
|
|
If rest_of_compilation set this to 0, leave it 0. */
|
1993-10-30 09:33:30 +01:00
|
|
|
|
if (DECL_INITIAL (fndecl) != 0)
|
|
|
|
|
DECL_INITIAL (fndecl) = error_mark_node;
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
DECL_ARGUMENTS (fndecl) = 0;
|
|
|
|
|
}
|
|
|
|
|
|
1995-01-14 02:09:01 +01:00
|
|
|
|
if (DECL_STATIC_CONSTRUCTOR (fndecl))
|
|
|
|
|
{
|
2001-08-10 00:33:35 +02:00
|
|
|
|
if (targetm.have_ctors_dtors)
|
|
|
|
|
(* targetm.asm_out.constructor) (XEXP (DECL_RTL (fndecl), 0),
|
|
|
|
|
DEFAULT_INIT_PRIORITY);
|
1995-01-14 02:09:01 +01:00
|
|
|
|
else
|
2001-08-10 00:33:35 +02:00
|
|
|
|
static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
|
1995-01-14 02:09:01 +01:00
|
|
|
|
}
|
2001-08-07 02:13:35 +02:00
|
|
|
|
|
1995-01-14 02:09:01 +01:00
|
|
|
|
if (DECL_STATIC_DESTRUCTOR (fndecl))
|
|
|
|
|
{
|
2001-08-10 00:33:35 +02:00
|
|
|
|
if (targetm.have_ctors_dtors)
|
|
|
|
|
(* targetm.asm_out.destructor) (XEXP (DECL_RTL (fndecl), 0),
|
|
|
|
|
DEFAULT_INIT_PRIORITY);
|
1995-01-14 02:09:01 +01:00
|
|
|
|
else
|
2001-08-10 00:33:35 +02:00
|
|
|
|
static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
|
1995-01-14 02:09:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
if (nested_p)
|
2001-06-06 05:08:21 +02:00
|
|
|
|
/* Return to the enclosing function. */
|
|
|
|
|
pop_function_context ();
|
2001-10-20 12:04:00 +02:00
|
|
|
|
timevar_pop (TV_EXPAND);
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-19 00:18:36 +01:00
|
|
|
|
/* Check the declarations given in a for-loop for satisfying the C99
|
|
|
|
|
constraints. */
|
|
|
|
|
void
|
|
|
|
|
check_for_loop_decls ()
|
|
|
|
|
{
|
|
|
|
|
tree t;
|
|
|
|
|
|
|
|
|
|
if (!flag_isoc99)
|
|
|
|
|
{
|
|
|
|
|
/* If we get here, declarations have been used in a for loop without
|
|
|
|
|
the C99 for loop scope. This doesn't make much sense, so don't
|
|
|
|
|
allow it. */
|
|
|
|
|
error ("`for' loop initial declaration used outside C99 mode");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* C99 subclause 6.8.5 paragraph 3:
|
|
|
|
|
|
|
|
|
|
[#3] The declaration part of a for statement shall only
|
|
|
|
|
declare identifiers for objects having storage class auto or
|
|
|
|
|
register.
|
|
|
|
|
|
|
|
|
|
It isn't clear whether, in this sentence, "identifiers" binds to
|
|
|
|
|
"shall only declare" or to "objects" - that is, whether all identifiers
|
|
|
|
|
declared must be identifiers for objects, or whether the restriction
|
|
|
|
|
only applies to those that are. (A question on this in comp.std.c
|
|
|
|
|
in November 2000 received no answer.) We implement the strictest
|
|
|
|
|
interpretation, to avoid creating an extension which later causes
|
|
|
|
|
problems. */
|
|
|
|
|
|
|
|
|
|
for (t = gettags (); t; t = TREE_CHAIN (t))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_PURPOSE (t) != 0)
|
2001-10-30 13:14:28 +01:00
|
|
|
|
{
|
|
|
|
|
enum tree_code code = TREE_CODE (TREE_VALUE (t));
|
|
|
|
|
|
|
|
|
|
if (code == RECORD_TYPE)
|
|
|
|
|
error ("`struct %s' declared in `for' loop initial declaration",
|
|
|
|
|
IDENTIFIER_POINTER (TREE_PURPOSE (t)));
|
|
|
|
|
else if (code == UNION_TYPE)
|
|
|
|
|
error ("`union %s' declared in `for' loop initial declaration",
|
|
|
|
|
IDENTIFIER_POINTER (TREE_PURPOSE (t)));
|
|
|
|
|
else
|
|
|
|
|
error ("`enum %s' declared in `for' loop initial declaration",
|
|
|
|
|
IDENTIFIER_POINTER (TREE_PURPOSE (t)));
|
|
|
|
|
}
|
2000-11-19 00:18:36 +01:00
|
|
|
|
}
|
2001-10-30 13:14:28 +01:00
|
|
|
|
|
2000-11-19 00:18:36 +01:00
|
|
|
|
for (t = getdecls (); t; t = TREE_CHAIN (t))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (t) != VAR_DECL && DECL_NAME (t))
|
|
|
|
|
error_with_decl (t, "declaration of non-variable `%s' in `for' loop initial declaration");
|
|
|
|
|
else if (TREE_STATIC (t))
|
|
|
|
|
error_with_decl (t, "declaration of static variable `%s' in `for' loop initial declaration");
|
|
|
|
|
else if (DECL_EXTERNAL (t))
|
|
|
|
|
error_with_decl (t, "declaration of `extern' variable `%s' in `for' loop initial declaration");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1992-02-13 23:21:26 +01:00
|
|
|
|
/* Save and restore the variables in this file and elsewhere
|
|
|
|
|
that keep track of the progress of compilation of the current function.
|
|
|
|
|
Used for nested functions. */
|
|
|
|
|
|
2000-09-07 03:36:11 +02:00
|
|
|
|
struct c_language_function
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-09-07 03:36:11 +02:00
|
|
|
|
struct language_function base;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
tree named_labels;
|
|
|
|
|
tree shadowed_labels;
|
|
|
|
|
int returns_value;
|
|
|
|
|
int returns_null;
|
|
|
|
|
int warn_about_return_type;
|
|
|
|
|
int extern_inline;
|
|
|
|
|
struct binding_level *binding_level;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Save and reinitialize the variables
|
|
|
|
|
used during compilation of a C function. */
|
|
|
|
|
|
|
|
|
|
void
|
1999-09-05 03:06:48 +02:00
|
|
|
|
push_c_function_context (f)
|
|
|
|
|
struct function *f;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2000-09-07 03:36:11 +02:00
|
|
|
|
struct c_language_function *p;
|
2001-01-02 08:00:49 +01:00
|
|
|
|
p = ((struct c_language_function *)
|
2000-09-07 03:36:11 +02:00
|
|
|
|
xmalloc (sizeof (struct c_language_function)));
|
|
|
|
|
f->language = (struct language_function *) p;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
p->base.x_stmt_tree = c_stmt_tree;
|
|
|
|
|
p->base.x_scope_stmt_stack = c_scope_stmt_stack;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
p->named_labels = named_labels;
|
|
|
|
|
p->shadowed_labels = shadowed_labels;
|
|
|
|
|
p->returns_value = current_function_returns_value;
|
|
|
|
|
p->returns_null = current_function_returns_null;
|
|
|
|
|
p->warn_about_return_type = warn_about_return_type;
|
|
|
|
|
p->extern_inline = current_extern_inline;
|
|
|
|
|
p->binding_level = current_binding_level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Restore the variables used during compilation of a C function. */
|
|
|
|
|
|
|
|
|
|
void
|
1999-09-05 03:06:48 +02:00
|
|
|
|
pop_c_function_context (f)
|
|
|
|
|
struct function *f;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
2001-01-02 08:00:49 +01:00
|
|
|
|
struct c_language_function *p
|
2000-09-07 03:36:11 +02:00
|
|
|
|
= (struct c_language_function *) f->language;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
tree link;
|
|
|
|
|
|
|
|
|
|
/* Bring back all the labels that were shadowed. */
|
|
|
|
|
for (link = shadowed_labels; link; link = TREE_CHAIN (link))
|
|
|
|
|
if (DECL_NAME (TREE_VALUE (link)) != 0)
|
|
|
|
|
IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link)))
|
|
|
|
|
= TREE_VALUE (link);
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
if (DECL_SAVED_INSNS (current_function_decl) == 0
|
|
|
|
|
&& DECL_SAVED_TREE (current_function_decl) == NULL_TREE)
|
1992-02-13 23:21:26 +01:00
|
|
|
|
{
|
|
|
|
|
/* Stop pointing to the local nodes about to be freed. */
|
|
|
|
|
/* But DECL_INITIAL must remain nonzero so we know this
|
|
|
|
|
was an actual function definition. */
|
|
|
|
|
DECL_INITIAL (current_function_decl) = error_mark_node;
|
|
|
|
|
DECL_ARGUMENTS (current_function_decl) = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
c_stmt_tree = p->base.x_stmt_tree;
|
|
|
|
|
c_scope_stmt_stack = p->base.x_scope_stmt_stack;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
named_labels = p->named_labels;
|
|
|
|
|
shadowed_labels = p->shadowed_labels;
|
|
|
|
|
current_function_returns_value = p->returns_value;
|
|
|
|
|
current_function_returns_null = p->returns_null;
|
|
|
|
|
warn_about_return_type = p->warn_about_return_type;
|
|
|
|
|
current_extern_inline = p->extern_inline;
|
|
|
|
|
current_binding_level = p->binding_level;
|
|
|
|
|
|
|
|
|
|
free (p);
|
1999-09-05 03:06:48 +02:00
|
|
|
|
f->language = 0;
|
1992-02-13 23:21:26 +01:00
|
|
|
|
}
|
1994-05-14 03:56:51 +02:00
|
|
|
|
|
1999-09-06 23:28:22 +02:00
|
|
|
|
/* Mark the language specific parts of F for GC. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1999-09-06 23:28:22 +02:00
|
|
|
|
void
|
|
|
|
|
mark_c_function_context (f)
|
|
|
|
|
struct function *f;
|
|
|
|
|
{
|
2001-01-02 08:00:49 +01:00
|
|
|
|
struct c_language_function *p
|
2000-09-07 03:36:11 +02:00
|
|
|
|
= (struct c_language_function *) f->language;
|
1999-09-06 23:28:22 +02:00
|
|
|
|
|
|
|
|
|
if (p == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
mark_c_language_function (&p->base);
|
1999-09-06 23:28:22 +02:00
|
|
|
|
ggc_mark_tree (p->shadowed_labels);
|
|
|
|
|
ggc_mark_tree (p->named_labels);
|
|
|
|
|
mark_binding_level (&p->binding_level);
|
|
|
|
|
}
|
|
|
|
|
|
ChangeLog.2, [...]: Fix spelling errors and typos.
* ChangeLog.2, ChangeLog.3, ChangeLog.4, FSFChangeLog.10,
FSFChangeLog.11, c-common.c, c-common.def, c-common.h, c-decl.c,
c-dump.c, c-typeck.c, except.c, sdbout.c, simplify-rtx.c,
timevar.h, tree.h, varasm.c: Fix spelling errors and typos.
From-SVN: r46621
2001-10-30 00:01:45 +01:00
|
|
|
|
/* Copy the DECL_LANG_SPECIFIC data associated with NODE. */
|
1994-05-14 03:56:51 +02:00
|
|
|
|
|
|
|
|
|
void
|
2000-09-17 09:38:23 +02:00
|
|
|
|
copy_lang_decl (decl)
|
|
|
|
|
tree decl;
|
1994-05-14 03:56:51 +02:00
|
|
|
|
{
|
2000-09-17 09:38:23 +02:00
|
|
|
|
struct lang_decl *ld;
|
|
|
|
|
|
|
|
|
|
if (!DECL_LANG_SPECIFIC (decl))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ld = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl));
|
Use memset/memcmp instead of bzero/bcmp.
* c-decl.c (duplicate_decls, copy_lang_decl), dwarfout.c
(dwarfout_line), gcc.c (main, save_string), tree.c (init_obstacks,
perm_calloc, get_identifier, maybe_get_identifier,
real_value_from_int_cst, simple_cst_equal), varasm.c
(assemble_name, assemble_real, immed_real_const_1,
compare_constant_1, decode_rtx_const, output_constant_pool): Use
strrchr () instead of rindex (). Use memcmp () instead of bcmp
(). Use memcpy () instead of bcopy (). Use memset () instead of
bzero ().
cp:
* tree.c (cp_tree_equal): Use memcmp () instead of bcmp ().
From-SVN: r37228
2000-11-03 19:55:54 +01:00
|
|
|
|
memcpy ((char *) ld, (char *) DECL_LANG_SPECIFIC (decl),
|
|
|
|
|
sizeof (struct lang_decl));
|
2000-09-17 09:38:23 +02:00
|
|
|
|
DECL_LANG_SPECIFIC (decl) = ld;
|
1994-05-14 03:56:51 +02:00
|
|
|
|
}
|
1999-09-06 23:28:22 +02:00
|
|
|
|
|
|
|
|
|
/* Mark the language specific bits in T for GC. */
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
1999-09-06 23:28:22 +02:00
|
|
|
|
void
|
|
|
|
|
lang_mark_tree (t)
|
|
|
|
|
tree t;
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (t) == IDENTIFIER_NODE)
|
|
|
|
|
{
|
|
|
|
|
struct lang_identifier *i = (struct lang_identifier *) t;
|
|
|
|
|
ggc_mark_tree (i->global_value);
|
|
|
|
|
ggc_mark_tree (i->local_value);
|
|
|
|
|
ggc_mark_tree (i->label_value);
|
|
|
|
|
ggc_mark_tree (i->implicit_decl);
|
|
|
|
|
ggc_mark_tree (i->error_locus);
|
|
|
|
|
ggc_mark_tree (i->limbo_value);
|
|
|
|
|
}
|
1999-09-09 23:41:38 +02:00
|
|
|
|
else if (TYPE_P (t) && TYPE_LANG_SPECIFIC (t))
|
|
|
|
|
ggc_mark (TYPE_LANG_SPECIFIC (t));
|
2000-09-17 09:38:23 +02:00
|
|
|
|
else if (DECL_P (t) && DECL_LANG_SPECIFIC (t))
|
|
|
|
|
{
|
|
|
|
|
ggc_mark (DECL_LANG_SPECIFIC (t));
|
|
|
|
|
c_mark_lang_decl (&DECL_LANG_SPECIFIC (t)->base);
|
2001-06-05 08:51:02 +02:00
|
|
|
|
ggc_mark_tree (DECL_LANG_SPECIFIC (t)->pending_sizes);
|
2000-09-17 09:38:23 +02:00
|
|
|
|
}
|
1999-09-06 23:28:22 +02:00
|
|
|
|
}
|
2000-07-02 07:23:01 +02:00
|
|
|
|
|
|
|
|
|
/* The functions below are required for functionality of doing
|
|
|
|
|
function at once processing in the C front end. Currently these
|
|
|
|
|
functions are not called from anywhere in the C front end, but as
|
2000-08-11 00:01:22 +02:00
|
|
|
|
these changes continue, that will change. */
|
2000-07-02 07:23:01 +02:00
|
|
|
|
|
|
|
|
|
/* Returns non-zero if the current statement is a full expression,
|
|
|
|
|
i.e. temporaries created during that statement should be destroyed
|
|
|
|
|
at the end of the statement. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
stmts_are_full_exprs_p ()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-07 03:36:11 +02:00
|
|
|
|
/* Returns the stmt_tree (if any) to which statements are currently
|
|
|
|
|
being added. If there is no active statement-tree, NULL is
|
|
|
|
|
returned. */
|
|
|
|
|
|
|
|
|
|
stmt_tree
|
|
|
|
|
current_stmt_tree ()
|
|
|
|
|
{
|
2000-09-17 09:38:23 +02:00
|
|
|
|
return &c_stmt_tree;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns the stack of SCOPE_STMTs for the current function. */
|
|
|
|
|
|
|
|
|
|
tree *
|
|
|
|
|
current_scope_stmt_stack ()
|
|
|
|
|
{
|
|
|
|
|
return &c_scope_stmt_stack;
|
2000-09-07 03:36:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-07-02 07:23:01 +02:00
|
|
|
|
/* Nonzero if TYPE is an anonymous union or struct type. Always 0 in
|
2000-08-11 00:01:22 +02:00
|
|
|
|
C. */
|
2000-07-02 07:23:01 +02:00
|
|
|
|
|
2000-08-11 00:01:22 +02:00
|
|
|
|
int
|
2000-07-02 07:23:01 +02:00
|
|
|
|
anon_aggr_type_p (node)
|
2000-07-12 18:17:15 +02:00
|
|
|
|
tree node ATTRIBUTE_UNUSED;
|
2000-07-02 07:23:01 +02:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Dummy function in place of callback used by C++. */
|
2000-07-02 07:23:01 +02:00
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
void
|
|
|
|
|
extract_interface_info ()
|
2000-07-02 07:23:01 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Return a new COMPOUND_STMT, after adding it to the current
|
|
|
|
|
statement tree. */
|
2000-07-02 07:23:01 +02:00
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
tree
|
|
|
|
|
c_begin_compound_stmt ()
|
2000-07-02 07:23:01 +02:00
|
|
|
|
{
|
2000-09-17 09:38:23 +02:00
|
|
|
|
tree stmt;
|
2000-08-11 00:01:22 +02:00
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Create the COMPOUND_STMT. */
|
|
|
|
|
stmt = add_stmt (build_stmt (COMPOUND_STMT, NULL_TREE));
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
return stmt;
|
2000-07-02 07:23:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Expand T (a DECL_STMT) if it declares an entity not handled by the
|
|
|
|
|
common code. */
|
2000-07-02 07:23:01 +02:00
|
|
|
|
|
|
|
|
|
void
|
2000-09-17 09:38:23 +02:00
|
|
|
|
c_expand_decl_stmt (t)
|
|
|
|
|
tree t;
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
{
|
2000-09-17 09:38:23 +02:00
|
|
|
|
tree decl = DECL_STMT_DECL (t);
|
2001-01-02 08:00:49 +01:00
|
|
|
|
|
2000-09-17 09:38:23 +02:00
|
|
|
|
/* Expand nested functions. */
|
|
|
|
|
if (TREE_CODE (decl) == FUNCTION_DECL
|
|
|
|
|
&& DECL_CONTEXT (decl) == current_function_decl
|
|
|
|
|
&& DECL_SAVED_TREE (decl))
|
2001-11-12 01:02:36 +01:00
|
|
|
|
c_expand_body (decl, /*nested_p=*/1, /*can_defer_p=*/0);
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
}
|
c-common.c: Include "defaults.h".
* c-common.c: Include "defaults.h".
(WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Define.
(c_common_nodes_and_builtins): Create string_type_node,
const_string_type_node, wint_type_node, intmax_type_node,
uintmax_type_node, default_function_type, ptrdiff_type_node and
unsigned_ptrdiff_type_node.
* c-common.h (identifier_global_value): Declare.
* c-decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define.
(init_decl_processing): Don't create string_type_node,
const_string_type_node, wint_type_node, intmax_type_node,
uintmax_type_node, default_function_type, ptrdiff_type_node and
unsigned_ptrdiff_type_node.
(identifier_global_value): New function.
cp:
* decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define.
(init_decl_processing): Don't create string_type_node,
const_string_type_node, wint_type_node, intmax_type_node,
uintmax_type_node, default_function_type, ptrdiff_type_node and
unsigned_ptrdiff_type_node. Adjust position of call to
c_common_nodes_and_builtins.
(identifier_global_value): New function.
From-SVN: r37931
2000-12-01 23:25:43 +01:00
|
|
|
|
|
|
|
|
|
/* Return the IDENTIFIER_GLOBAL_VALUE of T, for use in common code, since
|
|
|
|
|
the definition of IDENTIFIER_GLOBAL_VALUE is different for C and C++. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
identifier_global_value (t)
|
|
|
|
|
tree t;
|
|
|
|
|
{
|
|
|
|
|
return IDENTIFIER_GLOBAL_VALUE (t);
|
|
|
|
|
}
|
c-common.c (SIZE_TYPE, WCHAR_TYPE): Define.
* c-common.c (SIZE_TYPE, WCHAR_TYPE): Define.
(flag_short_double, flag_short_wchar): Define.
(c_common_nodes_and_builtins): Create many tree nodes shared
between C and C++ here instead of in cp/decl.c and ...
* c-decl.c (init_decl_processing): ... here.
(SIZE_TYPE, WCHAR_TYPE): Don't define.
(flag_short_double, flag_short_wchar): Don't define.
(record_builtin_type): New function.
(build_void_list_node): New function.
* c-common.h (flag_short_double, flag_short_wchar,
record_builtin_type, build_void_list_node): Declare.
cp:
* decl.c (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE): Don't define.
(record_builtin_type): Make non-static.
(flag_short_double): Don't declare.
(init_decl_processing): Remove the creation of many tree nodes now
in c_common_nodes_and_builtins.
(build_void_list_node): New function.
* decl2.c (flag_short_double, flag_short_wchar): Don't define.
* cp-tree.h (flag_short_wchar): Don't declare.
From-SVN: r38695
2001-01-05 00:53:54 +01:00
|
|
|
|
|
|
|
|
|
/* Record a builtin type for C. If NAME is non-NULL, it is the name used;
|
|
|
|
|
otherwise the name is found in ridpointers from RID_INDEX. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
record_builtin_type (rid_index, name, type)
|
|
|
|
|
enum rid rid_index;
|
|
|
|
|
const char *name;
|
|
|
|
|
tree type;
|
|
|
|
|
{
|
|
|
|
|
tree id;
|
|
|
|
|
if (name == 0)
|
|
|
|
|
id = ridpointers[(int) rid_index];
|
|
|
|
|
else
|
|
|
|
|
id = get_identifier (name);
|
|
|
|
|
pushdecl (build_decl (TYPE_DECL, id, type));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Build the void_list_node (void_type_node having been created). */
|
|
|
|
|
tree
|
|
|
|
|
build_void_list_node ()
|
|
|
|
|
{
|
|
|
|
|
tree t = build_tree_list (NULL_TREE, void_type_node);
|
|
|
|
|
return t;
|
|
|
|
|
}
|