gcc/gcc/objc/objc-encoding.c

953 lines
28 KiB
C
Raw Normal View History

In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
/* Routines dealing with ObjC encoding of types
Copyright (C) 1992-2017 Free Software Foundation, Inc.
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
This file is part of GCC.
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 3, or (at your option)
any later version.
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.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tree.h"
tree-core.h: Include symtab.h. 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * tree-core.h: Include symtab.h. * rtl.h: Include hard-reg-set.h but not flags.h. (HARD_CONST): Remove condition compilation involving HARD_CONST since hard-reg-set.h is always included. * regs.h: Don't include hard-reg-set.h or rtl.h. * cfg.h: Include dominance.h. * gimple.h: Include tree-ssa-alias.h and gimple-expr.h. * backend.h: New. Aggregate commonly used backend header files. * gimple-ssa.h: Don't include tree-hasher.h. * ssa.h: New. Aggregate commonly used SSA header files. * regset.h: Remove bitmap.h and hard-reg-set.h #includes. * sel-sched-ir.h: Flatten includes. * lra-int.h: Flatten completely. * sel-sched-dump.h: Flatten includes. * ira-int.h: Flatten includes. * gimple-streamer.h: Remove all includes. * cfgloop.h: Remove all #includes except cfgloopmanip.h. * resource.h: Flatten hard-reg-set.h and df.h. * sched-int.h: Flatten insn-arrt.h and df.h. * valtrack.h: flatten bitmap.h, df.h, and rtl.h * df.h: Flatten includes, leaving regset.h, alloc-pool.h and timevar.h. * genattrtab.c (write_header): Adjust generated includes. * genautomata.c (main): Likewise. * genconditions.c (write-header): Likewise. * genemit.c (main): Likewise. * gengtype.c (open_base_files): Likewise. * genopinit.c (main): Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c (main): Likewise. * genpreds.c (write_insn_preds_c): Likewise. * genrecog.c (write_header): Likewise. * alias.c: Adjust includes. * asan.c: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * ccmp.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * cilk-common.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * cppbuiltin.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * data-streamer-in.c: Likewise. * data-streamer-out.c: Likewise. * data-streamer.c: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * debug.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dfp.c: Likewise. * dojump.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * dse.c: Likewise. * dumpfile.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * fwprop.c: Likewise. * gcc-plugin.h: Likewise. * gcse-common.c: Likewise. * gcse.c: Likewise. * generic-match-head.c: Likewise. * ggc-page.c: Likewise. * gimple-builder.c: Likewise. * gimple-expr.c: Likewise. * gimple-fold.c: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-match-head.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimple.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * godump.c: Likewise. * graph.c: Likewise. * graphite-blocking.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-isl-ast-to-gimple.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * ifcvt.c: Likewise. * init-regs.c: Likewise. * internal-fn.c: Likewise. * ipa-chkp.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-coalesce.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * opts-global.c: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * realmpfr.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regrename.c: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl-chkp.c: Likewise. * rtlanal.c: Likewise. * rtlhooks.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * symtab.c: Likewise. * target-globals.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-affine.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp-opt.c: Likewise. * tree-chkp.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * ubsan.c: Likewise. * valtrack.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * vtable-verify.c: Likewise. * web.c: Likewise. * wide-int.cc: Likewise. * xcoffout.c: Likewise. * config/aarch64/aarch64-builtins.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/aarch64/cortex-a57-fma-steering.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/aarch-common.c: Likewise. * config/arm/arm-builtins.c: Likewise. * config/arm/arm-c.c: Likewise. * config/arm/arm.c: Likewise. * config/avr/avr-c.c: Likewise. * config/avr/avr-log.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/cr16/cr16.c: Likewise. * config/cris/cris.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/epiphany/epiphany.c: Likewise. * config/epiphany/mode-switch-use.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/ft32/ft32.c: Likewise. * config/h8300/h8300.c: Likewise. * config/i386/i386-c.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/msformat-c.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/microblaze/microblaze-c.c: Likewise. * config/microblaze/microblaze.c: Likewise. * config/mips/mips.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/msp430/msp430-c.c: Likewise. * config/msp430/msp430.c: Likewise. * config/nds32/nds32-cost.c: Likewise. * config/nds32/nds32-fp-as-gp.c: Likewise. * config/nds32/nds32-intrinsic.c: Likewise. * config/nds32/nds32-isr.c: Likewise. * config/nds32/nds32-md-auxiliary.c: Likewise. * config/nds32/nds32-memory-manipulation.c: Likewise. * config/nds32/nds32-pipelines-auxiliary.c: Likewise. * config/nds32/nds32-predicates.c: Likewise. * config/nds32/nds32.c: Likewise. * config/nios2/nios2.c: Likewise. * config/nvptx/nvptx.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/rl78/rl78-c.c: Likewise. * config/rl78/rl78.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390-c.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh-c.c: Likewise. * config/sh/sh-mem.cc: Likewise. * config/sh/sh.c: Likewise. * config/sh/sh_optimize_sett_clrt.cc: Likewise. * config/sh/sh_treg_combine.cc: Likewise. * config/sol2-c.c: Likewise. * config/sol2-cxx.c: Likewise. * config/sol2-stubs.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc-c.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu-c.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/tilegx/mul-tables.c: Likewise. * config/tilegx/tilegx-c.c: Likewise. * config/tilegx/tilegx.c: Likewise. * config/tilepro/mul-tables.c: Likewise. * config/tilepro/tilepro-c.c: Likewise. * config/tilepro/tilepro.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/visium/visium.c: Likewise. * config/vms/vms-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. ada 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/cuintp.c: Adjust includes. * gcc-interface/decl.c: Likewise. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. c 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Adjust includes. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Adjust includes. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * call.c: Adjust includes. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. fortran 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * convert.c: Adjust includes. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Adjust includes. * go-gcc.cc: Likewise. * go-lang.c: Likewise. java 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Adjust includes. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. jit 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Adjust includes. * jit-common.h: Likewise. * jit-playback.c: Likewise. lto 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Adjust includes. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * objc-act.c: Adjust includes. * objc-encoding.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-lang.c: Likewise. * objc-map.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. objcp 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Adjust includes. * objcp-lang.c: Likewise. From-SVN: r225531
2015-07-08 02:53:03 +02:00
#include "options.h"
Factor unrelated declarations out of tree.h. This patch applies the rule that functions defined in FOO.c must be declared in FOO.h. One of the worst offenders in the code base is tree.h, unsurprisingly. The patch creates several new headers: attribs.h calls.h fold-const.h gcc-symtab.h print-rtl.h print-tree.h stmt.h stor-layout.h stringpool.h tree-nested.h tree-object-size.h varasm.h. Functions in each corresponding .c file got moved to those headers and others that already existed. I wanted to make this patch as mechanical as possible, so I made no attempt to fix problems like having build_addr defined in tree-inline.c. I left that for later. There were some declarations that I could not move out of tree.h because of header poisoning or the use of target macros. We forbid the inclusion of things like expr.h from FE files. While that's a reasonable idea, the FE file *still* manage to at expr.c functionality because the declarations they want to use were defined in tree.h. The affected files are builtins.h, emit-rtl.h and expr.h. If that functionality is allowed to be accessed from the FEs, then I will later move those functions out of expr.c into tree.c. I have moved these declarations to the bottom of tree.h so they are easy to identify later. There is a namespace collision with libcpp. The file gcc/symtab.c cannot use gcc/symtab.h because the #include command picks up libcpp/include/symtab.h first. So I named this file gcc-symtab.h for now. Finally, I added a new header to PLUGIN_HEADERS to account for the tree.h refactoring. I did not add all headers factored out of tree.h because it is unclear (and impossible to tell) what plugins need. This adds the one header used by the plugins in the testsuite. This will be changing quite dramatically as we progress with the header refactoring. This patch should offer some minimal incremental build advantages by reducing the size of tree.h. Changes that would otherwise affected tree.h, will now go to other headers which are less frequently included. * tree.h: Include fold-const.h. (aggregate_value_p): Moved to function.h. (alloca_call_p): Moved to calls.h. (allocate_struct_function): Moved to function.h. (apply_tm_attr): Moved to attribs.h. (array_at_struct_end_p): Moved to expr.h. (array_ref_element_size): Moved to tree-dfa.h. (array_ref_low_bound): Moved to tree-dfa.h. (array_ref_up_bound): Moved to tree.h. (assemble_alias): Moved to cgraph.h. (bit_from_pos): Moved to stor-layout.h. (build_addr): Moved to tree-nested.h. (build_duplicate_type): Moved to tree-inline.h. (build_fold_addr_expr): Moved to fold-const.h. (build_fold_addr_expr_with_type): Moved to fold-const.h. (build_fold_addr_expr_with_type_loc): Moved to fold-const.h. (build_fold_indirect_ref): Moved to fold-const.h. (build_fold_indirect_ref_loc): Moved to fold-const.h. (build_personality_function): Moved to tree.h. (build_range_check): Moved to fold-const.h. (build_simple_mem_ref): Moved to fold-const.h. (build_simple_mem_ref_loc): Moved to fold-const.h. (build_tm_abort_call): Moved to trans-mem.h. (byte_from_pos): Moved to stor-layout.h. (call_expr_flags): Moved to calls.h. (can_move_by_pieces): Moved to expr.h. (categorize_ctor_elements): Moved to expr.h. (change_decl_assembler_name): Moved to gcc-symtab.h. (combine_comparisons): Moved to fold-const.h. (complete_ctor_at_level_p): Moved to tree.h. (component_ref_field_offset): Moved to tree-dfa.h. (compute_builtin_object_size): Moved to tree-object-size.h. (compute_record_mode): Moved to stor-layout.h. (constant_boolean_node): Moved to fold-const.h. (constructor_static_from_elts_p): Moved to varasm.h. (cxx11_attribute_p): Moved to attribs.h. (debug_body): Moved to print-tree.h. (debug_find_tree): Moved to tree-inline.h. (debug_fold_checksum): Moved to fold-const.h. (debug_head): Moved to print-tree.h. (debug_head): Moved to print-tree.h. (debug_raw): Moved to print-tree.h. (debug_tree): Moved to print-tree.h. (debug_vec_tree): Moved to print-tree.h. (debug_verbose): Moved to print-tree.h. (debug_verbose): Moved to print-tree.h. (decl_attributes): Moved to attribs.h. (decl_binds_to_current_def_p): Moved to varasm.h. (decl_default_tls_model): Moved to varasm.h. (decl_replaceable_p): Moved to varasm.h. (div_if_zero_remainder): Moved to fold-const.h. (double_int mem_ref_offset): Moved to fold-const.h. (dump_addr): Moved to print-tree.h. (element_precision): Moved to machmode.h. (expand_dummy_function_end): Moved to function.h. (expand_function_end): Moved to function.h. (expand_function_start): Moved to function.h. (expand_label): Moved to stmt.h. (expr_first): Moved to tree-iterator.h. (expr_last): Moved to tree-iterator.h. (finalize_size_functions): Moved to stor-layout.h. (finish_builtin_struct): Moved to stor-layout.h. (finish_record_layout): Moved to stor-layout.h. (fixup_signed_type): Moved to stor-layout.h. (fixup_unsigned_type): Moved to stor-layout.h. (flags_from_decl_or_type): Moved to calls.h. (fold): Moved to fold-const.h. (fold_abs_const): Moved to fold-const.h. (fold_binary): Moved to fold-const.h. (fold_binary_loc): Moved to fold-const.h. (fold_binary_to_constant): Moved to fold-const.h. (fold_build1): Moved to fold-const.h. (fold_build1_initializer_loc): Moved to fold-const.h. (fold_build1_loc): Moved to fold-const.h. (fold_build1_stat_loc): Moved to fold-const.h. (fold_build2): Moved to fold-const.h. (fold_build2_initializer_loc): Moved to fold-const.h. (fold_build2_loc): Moved to fold-const.h. (fold_build2_stat_loc): Moved to fold-const.h. (fold_build3): Moved to fold-const.h. (fold_build3_loc): Moved to fold-const.h. (fold_build3_stat_loc): Moved to fold-const.h. (fold_build_call_array): Moved to fold-const.h. (fold_build_call_array_initializer): Moved to fold-const.h. (fold_build_call_array_initializer_loc): Moved to fold-const.h. (fold_build_call_array_loc): Moved to fold-const.h. (fold_build_cleanup_point_expr): Moved to fold-const.h. (fold_convert): Moved to fold-const.h. (fold_convert_loc): Moved to fold-const.h. (fold_convertible_p): Moved to fold-const.h. (fold_defer_overflow_warnings): Moved to fold-const.h. (fold_deferring_overflow_warnings_p): Moved to fold-const.h. (fold_fma): Moved to fold-const.h. (fold_ignored_result): Moved to fold-const.h. (fold_indirect_ref): Moved to fold-const.h. (fold_indirect_ref_1): Moved to fold-const.h. (fold_indirect_ref_loc): Moved to fold-const.h. (fold_read_from_constant_string): Moved to fold-const.h. (fold_real_zero_addition_p): Moved to fold-const.h. (fold_single_bit_test): Moved to fold-const.h. (fold_strip_sign_ops): Moved to fold-const.h. (fold_ternary): Moved to fold-const.h. (fold_ternary_loc): Moved to fold-const.h. (fold_unary): Moved to tree-data-ref.h. (fold_unary_ignore_overflow): Moved to fold-const.h. (fold_unary_ignore_overflow_loc): Moved to fold-const.h. (fold_unary_loc): Moved to fold-const.h. (fold_unary_to_constant): Moved to fold-const.h. (fold_undefer_and_ignore_overflow_warnings): Moved to fold-const.h. (fold_undefer_overflow_warnings): Moved to fold-const.h. (folding_initializer): Moved to fold-const.h. (free_temp_slots): Moved to function.h. (generate_setjmp_warnings): Moved to function.h. (get_attribute_name): Moved to attribs.h. (get_identifier): Moved to stringpool.h. (get_identifier_with_length): Moved to stringpool.h. (get_inner_reference): Moved to tree.h. (gimple_alloca_call_p): Moved to calls.h. (gimplify_parameters): Moved to function.h. (highest_pow2_factor): Moved to expr.h. (indent_to): Moved to print-tree.h. (init_attributes): Moved to attribs.h. (init_dummy_function_start): Moved to function.h. (init_function_start): Moved to function.h. (init_inline_once): Moved to tree-inline.h. (init_object_sizes): Moved to tree-object-size.h. (init_temp_slots): Moved to function.h. (init_tree_optimization_optabs): Moved to optabs.h. (initialize_sizetypes): Moved to stor-layout.h. (initializer_constant_valid_for_bitfield_p): Moved to varasm.h. (initializer_constant_valid_p): Moved to varasm.h. (int_const_binop): Moved to fold-const.h. (internal_reference_types): Moved to stor-layout.h. (invert_tree_comparison): Moved to fold-const.h. (invert_truthvalue): Moved to fold-const.h. (invert_truthvalue_loc): Moved to fold-const.h. (is_tm_ending_fndecl): Moved to trans-mem.h. (is_tm_may_cancel_outer): Moved to trans-mem.h. (is_tm_pure): Moved to trans-mem.h. (is_tm_safe): Moved to trans-mem.h. (layout_decl): Moved to stor-layout.h. (layout_type): Moved to stor-layout.h. (lookup_attribute_spec): Moved to attribs.h. (make_accum_type): Moved to stor-layout.h. (make_decl_one_only): Moved to varasm.h. (make_decl_rtl): Moved to tree.h. (make_decl_rtl_for_debug): Moved to varasm.h. (make_fract_type): Moved to stor-layout.h. (make_or_reuse_sat_signed_accum_type): Moved to stor-layout.h. (make_or_reuse_sat_signed_fract_type): Moved to stor-layout.h. (make_or_reuse_sat_unsigned_accum_type): Moved to stor-layout.h. (make_or_reuse_sat_unsigned_fract_type): Moved to stor-layout.h. (make_or_reuse_signed_accum_type): Moved to stor-layout.h. (make_or_reuse_signed_fract_type): Moved to stor-layout.h. (make_or_reuse_unsigned_accum_type): Moved to stor-layout.h. (make_or_reuse_unsigned_fract_type): Moved to stor-layout.h. (make_range): Moved to fold-const.h. (make_range_step): Moved to fold-const.h. (make_sat_signed_accum_type): Moved to stor-layout.h. (make_sat_signed_fract_type): Moved to stor-layout.h. (make_sat_unsigned_accum_type): Moved to stor-layout.h. (make_sat_unsigned_fract_type): Moved to stor-layout.h. (make_signed_accum_type): Moved to stor-layout.h. (make_signed_fract_type): Moved to stor-layout.h. (make_signed_type): Moved to stor-layout.h. (make_unsigned_accum_type): Moved to stor-layout.h. (make_unsigned_fract_type): Moved to stor-layout.h. (make_unsigned_type): Moved to stor-layout.h. (mark_decl_referenced): Moved to varasm.h. (mark_referenced): Moved to varasm.h. (may_negate_without_overflow_p): Moved to fold-const.h. (maybe_get_identifier): Moved to stringpool.h. (merge_ranges): Moved to fold-const.h. (merge_weak): Moved to varasm.h. (mode_for_size_tree): Moved to stor-layout.h. (multiple_of_p): Moved to fold-const.h. (must_pass_in_stack_var_size): Moved to calls.h. (must_pass_in_stack_var_size_or_pad): Moved to calls.h. (native_encode_expr): Moved to fold-const.h. (native_interpret_expr): Moved to fold-const.h. (non_lvalue): Moved to fold-const.h. (non_lvalue_loc): Moved to fold-const.h. (normalize_offset): Moved to stor-layout.h. (normalize_rli): Moved to stor-layout.h. (notice_global_symbol): Moved to varasm.h. (omit_one_operand): Moved to fold-const.h. (omit_one_operand_loc): Moved to fold-const.h. (omit_two_operands): Moved to fold-const.h. (omit_two_operands_loc): Moved to fold-const.h. (operand_equal_p): Moved to tree-data-ref.h. (parse_input_constraint): Moved to stmt.h. (parse_output_constraint): Moved to stmt.h. (place_field): Moved to stor-layout.h. (pop_function_context): Moved to function.h. (pop_temp_slots): Moved to function.h. (pos_from_bit): Moved to stor-layout.h. (preserve_temp_slots): Moved to function.h. (print_node): Moved to print-tree.h. (print_node_brief): Moved to print-tree.h. (print_rtl): Moved to rtl.h. (process_pending_assemble_externals): Moved to varasm.h. (ptr_difference_const): Moved to fold-const.h. (push_function_context): Moved to function.h. (push_struct_function): Moved to function.h. (push_temp_slots): Moved to function.h. (record_tm_replacement): Moved to trans-mem.h. (relayout_decl): Moved to stor-layout.h. (resolve_asm_operand_names): Moved to stmt.h. (resolve_unique_section): Moved to varasm.h. (rli_size_so_far): Moved to stor-layout.h. (rli_size_unit_so_far): Moved to stor-layout.h. (round_down): Moved to fold-const.h. (round_down_loc): Moved to fold-const.h. (round_up): Moved to fold-const.h. (round_up_loc): Moved to fold-const.h. (set_decl_incoming_rtl): Moved to emit-rtl.h. (set_decl_rtl): Moved to tree.h. (set_min_and_max_values_for_integral_type): Moved to stor-layout.h. (set_user_assembler_name): Moved to varasm.h. (setjmp_call_p): Moved to calls.h. (size_binop): Moved to fold-const.h. (size_binop_loc): Moved to fold-const.h. (size_diffop): Moved to fold-const.h. (size_diffop_loc): Moved to fold-const.h. (size_int_kind): Moved to fold-const.h. (stack_protect_epilogue): Moved to function.h. (start_record_layout): Moved to stor-layout.h. (supports_one_only): Moved to varasm.h. (swap_tree_comparison): Moved to fold-const.h. (tm_malloc_replacement): Moved to trans-mem.h. (tree build_fold_addr_expr_loc): Moved to fold-const.h. (tree build_invariant_address): Moved to fold-const.h. (tree_binary_nonnegative_warnv_p): Moved to fold-const.h. (tree_binary_nonzero_warnv_p): Moved to fold-const.h. (tree_call_nonnegative_warnv_p): Moved to fold-const.h. (tree_expr_nonnegative_p): Moved to fold-const.h. (tree_expr_nonnegative_warnv_p): Moved to fold-const.h. (tree_output_constant_def): Moved to varasm.h. (tree_overlaps_hard_reg_set): Moved to stmt.h. (tree_single_nonnegative_warnv_p): Moved to fold-const.h. (tree_single_nonzero_warnv_p): Moved to fold-const.h. (tree_swap_operands_p): Moved to fold-const.h. (tree_unary_nonnegative_warnv_p): Moved to fold-const.h. (tree_unary_nonzero_warnv_p): Moved to fold-const.h. (update_alignment_for_field): Moved to stor-layout.h. (use_register_for_decl): Moved to function.h. (variable_size): Moved to rtl.h. (vector_type_mode): Moved to stor-layout.h. * cgraph.h: Corresponding changes. * emit-rtl.h: Corresponding changes. * expr.h: Corresponding changes. * function.h: Corresponding changes. * optabs.h: Corresponding changes. * trans-mem.h: Corresponding changes. Protect against multiple inclusion. * tree-inline.h: Corresponding changes. * tree-iterator.h: Corresponding changes. * tree-dfa.h: Include expr.h. * tree-ssanames.h: Include stringpool.h. * attribs.h: New file. * calls.h: New file. * fold-const.h: New file. * gcc-symtab.h: New file. * print-rtl.h: New file. * print-tree.h: New file. * stmt.h: New file. * stor-layout.h: New file. * strinpool.h: New file. * tree-nested.h: New file * tree-object-size.h: New file. * varasm.h: New file. * Makefile.in (PLUGIN_HEADERS): Add stringpool.h. * alias.c: Include varasm.h. Include expr.h. * asan.c: Include calls.h. Include stor-layout.h. Include varasm.h. * attribs.c: Include stringpool.h. Include attribs.h. Include stor-layout.h. * builtins.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. Include tree-object-size.h. * calls.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include attribs.h. * cfgexpand.c: Include stringpool.h. Include varasm.h. Include stor-layout.h. Include stmt.h. Include print-tree.h. * cgraph.c: Include varasm.h. Include calls.h. Include print-tree.h. * cgraphclones.c: Include stringpool.h. Include function.h. Include emit-rtl.h. Move inclusion of rtl.h earlier in the file. * cgraphunit.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. * cilk-common.c: Include stringpool.h. Include stor-layout.h. * combine.c: Include stor-layout.h. * config/aarch64/aarch64-builtins.c: Include stor-layout.h. Include stringpool.h. Include calls.h. * config/aarch64/aarch64.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/alpha/alpha.c: Include stor-layout.h. Include calls.h. Include varasm.h. * config/arc/arc.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. Include calls.h. * config/arm/arm.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/avr/avr-c.c: Include stor-layout.h. * config/avr/avr-log.c: Include print-tree.h. * config/avr/avr.c: Include print-tree.h. Include calls.h. Include stor-layout.h. Include stringpool.h. * config/bfin/bfin.c: Include varasm.h. Include calls.h. * config/c6x/c6x.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/cr16/cr16.c: Include stor-layout.h. Include calls.h. * config/cris/cris.c: Include varasm.h. Include stor-layout.h. Include calls.h. Include stmt.h. * config/darwin.c: Include stringpool.h. Include varasm.h. Include stor-layout.h. * config/epiphany/epiphany.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/fr30/fr30.c: Include stor-layout.h. Include varasm.h. * config/frv/frv.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. * config/h8300/h8300.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/i386/i386.c: Include stringpool.h. Include attribs.h. Include calls.h. Include stor-layout.h. Include varasm.h. * config/i386/winnt-cxx.c: Include stringpool.h. Include attribs.h. * config/i386/winnt.c: Include stringpool.h. Include varasm.h. * config/ia64/ia64-c.c: Include stringpool.h. * config/ia64/ia64.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/iq2000/iq2000.c: Include stor-layout.h. Include calls.h. Include varasm.h. * config/lm32/lm32.c: Include calls.h. * config/m32c/m32c.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/m32r/m32r.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include calls.h. * config/m68k/m68k.c: Include calls.h. Include stor-layout.h. Include varasm.h. * config/mcore/mcore.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include calls.h. * config/mep/mep.c: Include varasm.h. Include calls.h. Include stringpool.h. Include stor-layout.h. * config/microblaze/microblaze.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/mips/mips.c: Include varasm.h. Include stringpool.h. Include stor-layout.h. Include calls.h. * config/mmix/mmix.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/mn10300/mn10300.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/moxie/moxie.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/msp430/msp430.c: Include stor-layout.h. Include calls.h. * config/nds32/nds32.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/pa/pa.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. Include calls.h. * config/pdp11/pdp11.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/picochip/picochip.c: Include calls.h. Include stor-layout.h. Include stringpool.h. Include varasm.h. * config/rl78/rl78.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/rs6000/rs6000-c.c: Include stor-layout.h. Include stringpool.h. * config/rs6000/rs6000.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include print-tree.h. Include varasm.h. * config/rx/rx.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/s390/s390.c: Include print-tree.h. Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/score/score.c: Include stringpool.h. Include calls.h. Include varasm.h. Include stor-layout.h. * config/sh/sh-c.c: Include stringpool.h. Include attribs.h.h. * config/sh/sh.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/sol2-c.c: Include stringpool.h. Include attribs.h. * config/sol2-cxx.c: Include stringpool.h. * config/sol2.c: Include stringpool.h. Include varasm.h. * config/sparc/sparc.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/spu/spu-c.c: Include stringpool.h. * config/spu/spu.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/stormy16/stormy16.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/tilegx/tilegx.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/tilepro/tilepro.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/v850/v850-c.c: Include stringpool.h. Include attribs.h. * config/v850/v850.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/vax/vax.c: Include calls.h. Include varasm.h. * config/vms/vms.c: Include stringpool.h. * config/vxworks.c: Include stringpool.h. * config/xtensa/xtensa.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * convert.c: Include stor-layout.h. * coverage.c: Include stringpool.h. Include stor-layout.h. * dbxout.c: Include varasm.h. Include stor-layout.h. * dojump.c: Include stor-layout.h. * dse.c: Include stor-layout.h. * dwarf2asm.c: Include stringpool.h. Include varasm.h. * dwarf2cfi.c: Include stor-layout.h. * dwarf2out.c: Include rtl.h. Include stringpool.h. Include stor-layout.h. Include varasm.h. Include function.h. Include emit-rtl.h. Move inclusion of rtl.h earlier in the file. * emit-rtl.c: Include varasm.h. * except.c: Include stringpool.h. Include stor-layout.h. * explow.c: Include stor-layout.h. * expmed.c: Include stor-layout.h. * expr.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. Include varasm.h. * final.c: Include varasm.h. * fold-const.c: Include stor-layout.h. Include calls.h. Include tree-iterator.h. * function.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. * genattrtab.c (write_header): Emit includes for varasm.h, stor-layout.h and calls.h. * genautomata.c (main): Likewise. * genemit.c: Likewise. * genopinit.c: Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c: Likewise. * genpreds.c (write_insn_preds_c): Likewise. * gengtype.c (open_base_files): Add stringpool.h. * gimple-expr.c: Include stringpool.h. Include stor-layout.h. * gimple-fold.c: Include stringpool.h. Include expr.h. Include stmt.h. Include stor-layout.h. * gimple-low.c: Include tree-nested.h. Include calls.h. * gimple-pretty-print.c: Include stringpool.h. * gimple-ssa-strength-reduction.c: Include stor-layout.h. Include expr.h. * gimple-walk.c: Include stmt.h. * gimple.c: Include calls.h. Include stmt.h. Include stor-layout.h. * gimplify.c: Include stringpool.h. Include calls.h. Include varasm.h. Include stor-layout.h. Include stmt.h. Include print-tree.h. Include expr.h. * gimplify-me.c: Include stmt.h Include stor-layout.h * internal-fn.c: Include stor-layout.h. * ipa-devirt.c: Include print-tree.h. Include calls.h. * ipa-inline-analysis.c: Include stor-layout.h. Include stringpool.h. Include print-tree.h. * ipa-inline.c: Include trans-mem.h. Include calls.h. * ipa-prop.c: Include expr.h. Include stor-layout.h. Include print-tree.h. * ipa-pure-const.c: Include print-tree.h. Include calls.h. * ipa-reference.c: Include calls.h. * ipa-split.c: Include stringpool.h. Include expr.h. Include calls.h. * ipa.c: Include calls.h. Include stringpool.h. * langhooks.c: Include stringpool.h. Include attribs.h. * lto-cgraph.c: Include stringpool.h. * lto-streamer-in.c: Include stringpool.h. * lto-streamer-out.c: Include stor-layout.h. Include stringpool.h. * omp-low.c: Include stringpool.h. Include stor-layout.h. Include expr.h. * optabs.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. * passes.c: Include varasm.h. * predict.c: Include calls.h. * print-rtl.c: Include print-tree.h. * print-tree.c: Include varasm.h. Include print-rtl.h. Include stor-layout.h. * realmpfr.c: Include stor-layout.h. * reg-stack.c: Include varasm.h. * sdbout.c: Include varasm.h. Include stor-layout.h. * simplify-rtx.c: Include varasm.h. * stmt.c: Include varasm.h. Include stor-layout.h. * stor-layout.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. Include print-tree.h. * symtab.c: Include rtl.h. Include print-tree.h. Include varasm.h. Include function.h. Include emit-rtl.h. * targhooks.c: Include stor-layout.h. Include varasm.h. * toplev.c: Include varasm.h. Include tree-inline.h. * trans-mem.c: Include calls.h. Include function.h. Include rtl.h. Include emit-rtl.h. * tree-affine.c: Include expr.h. * tree-browser.c: Include print-tree.h. * tree-call-cdce.c: Include stor-layout.h. * tree-cfg.c: Include trans-mem.h. Include stor-layout.h. Include print-tree.h. * tree-complex.c: Include stor-layout.h. * tree-data-ref.c: Include expr.h. * tree-dfa.c: Include stor-layout.h. * tree-eh.c: Include expr.h. Include calls.h. * tree-emutls.c: Include stor-layout.h. Include varasm.h. * tree-if-conv.c: Include stor-layout.h. * tree-inline.c: Include stor-layout.h. Include calls.h. * tree-loop-distribution.c: Include stor-layout.h. * tree-nested.c: Include stringpool.h. Include stor-layout.h. * tree-object-size.c: Include tree-object-size.h. * tree-outof-ssa.c: Include stor-layout.h. * tree-parloops.c: Include stor-layout.h. Include tree-nested.h. * tree-pretty-print.c: Include stor-layout.h. Include expr.h. * tree-profile.c: Include varasm.h. Include tree-nested.h. * tree-scalar-evolution.c: Include expr.h. * tree-sra.c: Include stor-layout.h. * tree-ssa-address.c: Include stor-layout.h. * tree-ssa-ccp.c: Include stor-layout.h. * tree-ssa-dce.c: Include calls.h. * tree-ssa-dom.c: Include stor-layout.h. * tree-ssa-forwprop.c: Include stor-layout.h. * tree-ssa-ifcombine.c: Include stor-layout.h. * tree-ssa-loop-ivopts.c: Include stor-layout.h. * tree-ssa-loop-niter.c: Include calls.h. Include expr.h. * tree-ssa-loop-prefetch.c: Include stor-layout.h. * tree-ssa-math-opts.c: Include stor-layout.h. * tree-ssa-operands.c: Include stmt.h. Include print-tree.h. * tree-ssa-phiopt.c: Include stor-layout.h. * tree-ssa-reassoc.c: Include stor-layout.h. * tree-ssa-sccvn.c: Include stor-layout.h. * tree-ssa-sink.c: Include stor-layout.h. * tree-ssa-strlen.c: Include stor-layout.h. * tree-ssa-structalias.c: Include stor-layout.h. Include stmt.h. * tree-ssa-tail-merge.c: Include stor-layout.h. Include trans-mem.h. * tree-ssa-uncprop.c: Include stor-layout.h. * tree-ssa.c: Include stor-layout.h. * tree-ssanames.c: Include stor-layout.h. * tree-streamer-in.c: Include stringpool.h. * tree-streamer-out.c: Include stor-layout.h. * tree-switch-conversion.c: Include varasm.h. Include stor-layout.h. * tree-tailcall.c: Include stor-layout.h. * tree-vect-data-refs.c: Include stor-layout.h. * tree-vect-generic.c: Include stor-layout.h. * tree-vect-loop.c: Include stor-layout.h. * tree-vect-patterns.c: Include stor-layout.h. * tree-vect-slp.c: Include stor-layout.h. * tree-vect-stmts.c: Include stor-layout.h. * tree-vectorizer.c: Include stor-layout.h. * tree-vrp.c: Include stor-layout.h. Include calls.h. * tree.c: Include stor-layout.h. Include calls.h. Include attribs.h. Include varasm.h. * tsan.c: Include expr.h. * ubsan.c: Include stor-layout.h. Include stringpool.h. * value-prof.c: Include tree-nested.h. Include calls.h. * var-tracking.c: Include varasm.h. Include stor-layout.h. * varasm.c: Include stor-layout.h. Include stringpool.h. Include gcc-symtab.h. Include varasm.h. * varpool.c: Include varasm.h. * vmsdbgout.c: Include varasm.h. * xcoffout.c: Include varasm.h. ada/ChangeLog * gcc-interface/decl.c: Include stringpool.h Include stor-layout.h * gcc-interface/misc.c: Include stor-layout.h Include print-tree.h * gcc-interface/trans.c: Include stringpool.h Include stor-layout.h Include stmt.h Include varasm.h * gcc-interface/utils.c: Include stringpool.h Include stor-layout.h Include attribs.h Include varasm.h * gcc-interface/utils2.c: Include stringpool.h Include stor-layout.h Include attribs.h Include varasm.h c-family/ChangeLog * c-common.c: Include fold-const.h. Include stor-layout.h. Include calls.h. Include stringpool.h. Include attribs.h. Include varasm.h. Include trans-mem.h. * c-cppbuiltin.c: Include stor-layout.h. Include stringpool.h. * c-format.c: Include stringpool.h. * c-lex.c: Include stringpool.h. Include stor-layout.h. * c-pragma.c: Include stringpool.h. Include attribs.h. Include varasm.h. Include gcc-symtab.h. * c-pretty-print.c: Include stor-layout.h. Include attribs.h. * cilk.c: Include stringpool.h. Include calls.h. c/ChangeLog * c-decl.c: Include print-tree.h. Include stor-layout.h. Include varasm.h. Include attribs.h. Include stringpool.h. * c-lang.c: Include fold-const.h. * c-parser.c: Include stringpool.h. Include attribs.h. Include stor-layout.h. Include varasm.h. Include trans-mem.h. * c-typeck.c: Include stor-layout.h. Include trans-mem.h. Include varasm.h. Include stmt.h. cp/ChangeLog * call.c: Include stor-layout.h. Include trans-mem.h. Include stringpool.h. * class.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. * cp-gimplify.c: Include stor-layout.h. * cvt.c: Include stor-layout.h. * decl.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include attribs.h. Include calls.h. * decl2.c: Include stringpool.h. Include varasm.h. Include attribs.h. Include stor-layout.h. Include calls.h. * error.c: Include stringpool.h. * except.c: Include stringpool.h. Include trans-mem.h. Include attribs.h. * init.c: Include stringpool.h. Include varasm.h. * lambda.c: Include stringpool.h. * lex.c: Include stringpool.h. * mangle.c: Include stor-layout.h. Include stringpool.h. * method.c: Include stringpool.h. Include varasm.h. * name-lookup.c: Include stringpool.h. Include print-tree.h. Include attribs.h. * optimize.c: Include stringpool.h. * parser.c: Include print-tree.h. Include stringpool.h. Include attribs.h. Include trans-mem.h. * pt.c: Include stringpool.h. Include varasm.h. Include attribs.h. Include stor-layout.h. * ptree.c: Include print-tree.h. * repo.c: Include stringpool.h. * rtti.c: Include stringpool.h. Include stor-layout.h. * semantics.c: Include stmt.h. Include varasm.h. Include stor-layout.h. Include stringpool.h. * tree.c: Include stor-layout.h. Include print-tree.h. Include tree-iterator.h. * typeck.c: Include stor-layout.h. Include varasm.h. * typeck2.c: Include stor-layout.h. Include varasm.h. * vtable-class-hierarchy.c: Include stringpool.h. Include stor-layout.h. fortran/ChangeLog * decl.c: Include stringpool.h. * iresolve.c: Include stringpool.h. * match.c: Include stringpool.h. * module.c: Include stringpool.h. * target-memory.c: Include stor-layout.h. * trans-common.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. * trans-const.c: Include stor-layout.h. * trans-decl.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include attribs.h. * trans-expr.c: Include stringpool.h. * trans-intrinsic.c: Include stringpool.h. Include tree-nested.h. Include stor-layout.h. * trans-io.c: Include stringpool.h. Include stor-layout.h. * trans-openmp.c: Include stringpool.h. * trans-stmt.c: Include stringpool.h. * trans-types.c: Include stor-layout.h. Include stringpool.h. * trans.c: Include stringpool.h. go/ChangeLog * go-backend.c: Include stor-layout.h. * go-gcc.cc: Include stringpool.h. Include stor-layout.h. Include varasm.h. * go-lang.c: Include stor-layout.h. java/ChangeLog * builtins.c: Include stor-layout.h. Include stringpool.h. * class.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. * constants.c: Include stringpool.h. Include stor-layout.h. * decl.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. * except.c: Include stringpool.h. Include stor-layout.h. * expr.c: Include stringpool.h. Include stor-layout.h. * jcf-parse.c: Include stringpool.h. * mangle.c: Include stringpool.h. * resource.c: Include stringpool.h. Include stor-layout.h. * typeck.c: Include stor-layout.h. Include stringpool.h. * verify-glue.c: Include stringpool.h. lto/ChangeLog * lto-lang.c: Include stringpool.h. Include stor-layout.h. * lto-partition.c: Include gcc-symtab.h. * lto.c: Include stor-layout.h. objc/ChangeLog * objc-act.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. * objc-encoding.c: Include stringpool.h. Include stor-layout.h. * objc-gnu-runtime-abi-01.c: Include stringpool.h. * objc-next-runtime-abi-01.c: Include stringpool.h. * objc-next-runtime-abi-02.c: Include stringpool.h. * objc-runtime-shared-support.c: Include stringpool.h. testsuite/ChangeLog * gcc.dg/plugin/selfassign.c: Include stringpool.h. * gcc.dg/plugin/start_unit_plugin.c: Likewise. From-SVN: r205023
2013-11-19 13:31:09 +01:00
#include "stringpool.h"
#include "stor-layout.h"
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
#ifdef OBJCPLUS
configure.ac: Skip C if explicitly selected. toplevel/ * configure.ac: Skip C if explicitly selected. * configure: Regenerate. gcc/ * configure.ac: Remove special gtfiles case for C. * configure: Regenerate. * Makefile.in: Remove C front-end hooks and build hooks that will be picked up from c/Make-lang.in now. Add tree-mudflap to C_COMMON_OBJS. * gengtype.c (files_rules): Adjust gt-files for c/c-decl.c. * config/vms/vms.c: Look for c-tree.h in c/. * doc/gty.texi: Remove reference to c-config-lang.in. * doc/sourcebuild.texi: Document the c/ subdirectory. c/ * Make-lang.in: New file, rules migrated from gcc/Makefile.in and add language Makefile hooks. * config-lang.in: New file. * c-config-lang.in: Moved from gcc/config-lang.in to here, and add the required "normal" config-lang.in rules. * c-lang.h: Moved from gcc/ to here. * c-tree.h: Likewise. * c-objc-common.c: Likewise. * c-objc-common.h: Likewise. * c-typeck.c: Likewise. * c-convert.c: Likewise. * c-lang.c: Likewise. * c-aux-info.c: Likewise. * c-errors.c: Likewise. * gccspec.c: Likewise. * c-decl.c: Likewise. Include gt-c-c-decl.h, not gt-c-decl.h. * c-parser.c: Likewise. Include gt-c-c-parser.h, not gt-c-parser.h. c-family/ * cppspec.c: Moved from gcc/ to here. objc/ * Make-ang.in: Adjust for move of C front-end files. * config-lang.in: Likewise. * objc-encoding.c: Look for cp-tree.h in cp/, and for c-tree.h and c-lang.h in c/. * objc-runtime-shared-support.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-act.c: Likewise. * objc-lang.c: Likewise. cp/ * Make-lang.in: Remove tree-mudflap.o from CXX_AND_OBJCXX_OBJS. From-SVN: r189080
2012-06-29 18:12:35 +02:00
#include "cp/cp-tree.h"
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
#else
configure.ac: Skip C if explicitly selected. toplevel/ * configure.ac: Skip C if explicitly selected. * configure: Regenerate. gcc/ * configure.ac: Remove special gtfiles case for C. * configure: Regenerate. * Makefile.in: Remove C front-end hooks and build hooks that will be picked up from c/Make-lang.in now. Add tree-mudflap to C_COMMON_OBJS. * gengtype.c (files_rules): Adjust gt-files for c/c-decl.c. * config/vms/vms.c: Look for c-tree.h in c/. * doc/gty.texi: Remove reference to c-config-lang.in. * doc/sourcebuild.texi: Document the c/ subdirectory. c/ * Make-lang.in: New file, rules migrated from gcc/Makefile.in and add language Makefile hooks. * config-lang.in: New file. * c-config-lang.in: Moved from gcc/config-lang.in to here, and add the required "normal" config-lang.in rules. * c-lang.h: Moved from gcc/ to here. * c-tree.h: Likewise. * c-objc-common.c: Likewise. * c-objc-common.h: Likewise. * c-typeck.c: Likewise. * c-convert.c: Likewise. * c-lang.c: Likewise. * c-aux-info.c: Likewise. * c-errors.c: Likewise. * gccspec.c: Likewise. * c-decl.c: Likewise. Include gt-c-c-decl.h, not gt-c-decl.h. * c-parser.c: Likewise. Include gt-c-c-parser.h, not gt-c-parser.h. c-family/ * cppspec.c: Moved from gcc/ to here. objc/ * Make-ang.in: Adjust for move of C front-end files. * config-lang.in: Likewise. * objc-encoding.c: Look for cp-tree.h in cp/, and for c-tree.h and c-lang.h in c/. * objc-runtime-shared-support.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-act.c: Likewise. * objc-lang.c: Likewise. cp/ * Make-lang.in: Remove tree-mudflap.o from CXX_AND_OBJCXX_OBJS. From-SVN: r189080
2012-06-29 18:12:35 +02:00
#include "c/c-tree.h"
#include "c/c-lang.h"
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
#endif
#include "c-family/c-objc.h"
#include "objc-encoding.h"
#include "objc-act.h"
/* For my_build_string(). */
#include "objc-runtime-shared-support.h"
/* For BITS_PER_UNIT. */
/* When building Objective-C++, we are not linking against the C front-end
and so need to replicate the C tree-construction functions in some way. */
#ifdef OBJCPLUS
#define OBJCP_REMAP_FUNCTIONS
#include "objcp-decl.h"
#endif /* OBJCPLUS */
/* Set up for use of obstacks. */
In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * objc-encoding.h (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (encode_field_decl): Updated prototype to return a tree and take a single tree argument. Updated comments. * objc-encoding.c (util_obstack, util_firstobj): Made static. (objc_encoding_init): New. (encode_field_decl): Existing function renamed to encode_field and made static. New encode_field_decl wrapper function added. (encode_aggregate_fields): Update call to encode_field_decl to call encode_field. * objc-next-runtime-abi-02.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_v2_ivar_list_initializer): Updated call to encode_field_decl. * objc-runtime-shared-support.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_ivar_list_initializer): Updated call to encode_field_decl. * objc-act.c (objc_init): Use objc_encoding_init. * Make-lang.in (objc/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Likewise. In gcc/objcp/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (objcp/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Likewise. From-SVN: r176139
2011-07-11 11:42:23 +02:00
/* This obstack is used to accumulate the encoding of a data type. */
static struct obstack util_obstack;
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
/* This points to the beginning of obstack contents, so we can free
In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * objc-encoding.h (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (encode_field_decl): Updated prototype to return a tree and take a single tree argument. Updated comments. * objc-encoding.c (util_obstack, util_firstobj): Made static. (objc_encoding_init): New. (encode_field_decl): Existing function renamed to encode_field and made static. New encode_field_decl wrapper function added. (encode_aggregate_fields): Update call to encode_field_decl to call encode_field. * objc-next-runtime-abi-02.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_v2_ivar_list_initializer): Updated call to encode_field_decl. * objc-runtime-shared-support.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_ivar_list_initializer): Updated call to encode_field_decl. * objc-act.c (objc_init): Use objc_encoding_init. * Make-lang.in (objc/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Likewise. In gcc/objcp/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (objcp/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Likewise. From-SVN: r176139
2011-07-11 11:42:23 +02:00
the whole contents. */
static char *util_firstobj;
void objc_encoding_init (void)
{
gcc_obstack_init (&util_obstack);
util_firstobj = (char *) obstack_finish (&util_obstack);
}
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
int generating_instance_variables = 0;
static void encode_type_qualifiers (tree);
static void encode_type (tree, int, int);
In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * objc-encoding.h (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (encode_field_decl): Updated prototype to return a tree and take a single tree argument. Updated comments. * objc-encoding.c (util_obstack, util_firstobj): Made static. (objc_encoding_init): New. (encode_field_decl): Existing function renamed to encode_field and made static. New encode_field_decl wrapper function added. (encode_aggregate_fields): Update call to encode_field_decl to call encode_field. * objc-next-runtime-abi-02.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_v2_ivar_list_initializer): Updated call to encode_field_decl. * objc-runtime-shared-support.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_ivar_list_initializer): Updated call to encode_field_decl. * objc-act.c (objc_init): Use objc_encoding_init. * Make-lang.in (objc/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Likewise. In gcc/objcp/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (objcp/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Likewise. From-SVN: r176139
2011-07-11 11:42:23 +02:00
static void encode_field (tree field_decl, int curtype, int format);
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
static tree
objc_method_parm_type (tree type)
{
type = TREE_VALUE (TREE_TYPE (type));
if (TREE_CODE (type) == TYPE_DECL)
type = TREE_TYPE (type);
return type;
}
static int
objc_encoded_type_size (tree type)
{
int sz = int_size_in_bytes (type);
/* Make all integer and enum types at least as large
as an int. */
if (sz > 0 && INTEGRAL_TYPE_P (type))
sz = MAX (sz, int_size_in_bytes (integer_type_node));
/* Treat arrays as pointers, since that's how they're
passed in. */
else if (TREE_CODE (type) == ARRAY_TYPE)
sz = int_size_in_bytes (ptr_type_node);
return sz;
}
/* Encode a method prototype. */
tree
encode_method_prototype (tree method_decl)
{
tree parms;
int parm_offset, i;
char buf[40];
tree result;
/* ONEWAY and BYCOPY, for remote object are the only method qualifiers. */
encode_type_qualifiers (TREE_PURPOSE (TREE_TYPE (method_decl)));
/* Encode return type. */
encode_type (objc_method_parm_type (method_decl),
obstack_object_size (&util_obstack),
OBJC_ENCODE_INLINE_DEFS);
/* Stack size. */
/* The first two arguments (self and _cmd) are pointers; account for
their size. */
i = int_size_in_bytes (ptr_type_node);
parm_offset = 2 * i;
for (parms = METHOD_SEL_ARGS (method_decl); parms;
parms = DECL_CHAIN (parms))
{
tree type = objc_method_parm_type (parms);
int sz = objc_encoded_type_size (type);
/* If a type size is not known, bail out. */
if (sz < 0)
{
error_at (DECL_SOURCE_LOCATION (method_decl),
"type %qT does not have a known size",
type);
/* Pretend that the encoding succeeded; the compilation will
fail nevertheless. */
goto finish_encoding;
}
parm_offset += sz;
}
sprintf (buf, "%d@0:%d", parm_offset, i);
obstack_grow (&util_obstack, buf, strlen (buf));
/* Argument types. */
parm_offset = 2 * i;
for (parms = METHOD_SEL_ARGS (method_decl); parms;
parms = DECL_CHAIN (parms))
{
tree type = objc_method_parm_type (parms);
/* Process argument qualifiers for user supplied arguments. */
encode_type_qualifiers (TREE_PURPOSE (TREE_TYPE (parms)));
/* Type. */
encode_type (type, obstack_object_size (&util_obstack),
OBJC_ENCODE_INLINE_DEFS);
/* Compute offset. */
sprintf (buf, "%d", parm_offset);
parm_offset += objc_encoded_type_size (type);
obstack_grow (&util_obstack, buf, strlen (buf));
}
finish_encoding:
obstack_1grow (&util_obstack, '\0');
result = get_identifier (XOBFINISH (&util_obstack, char *));
obstack_free (&util_obstack, util_firstobj);
return result;
}
/* This is used to implement @encode(). */
tree
objc_build_encode_expr (tree type)
{
tree result;
const char *string;
encode_type (type, obstack_object_size (&util_obstack),
OBJC_ENCODE_INLINE_DEFS);
obstack_1grow (&util_obstack, 0); /* null terminate string */
string = XOBFINISH (&util_obstack, const char *);
/* Synthesize a string that represents the encoded struct/union. */
result = my_build_string (strlen (string) + 1, string);
obstack_free (&util_obstack, util_firstobj);
return result;
}
/* "Encode" a data type into a string, which grows in util_obstack.
The format is described in gcc/doc/objc.texi, section 'Type
encoding'.
Most of the encode_xxx functions have a 'type' argument, which is
the type to encode, and an integer 'curtype' argument, which is the
index in the encoding string of the beginning of the encoding of
the current type, and allows you to find what characters have
already been written for the current type (they are the ones in the
current encoding string starting from 'curtype').
For example, if we are encoding a method which returns 'int' and
takes a 'char **' argument, then when we get to the point of
encoding the 'char **' argument, the encoded string already
contains 'i12@0:4' (assuming a pointer size of 4 bytes). So,
'curtype' will be set to 7 when starting to encode 'char **'.
During the whole of the encoding of 'char **', 'curtype' will be
fixed at 7, so the routine encoding the second pointer can find out
that it's actually encoding a pointer to a pointer by looking
backwards at what has already been encoded for the current type,
and seeing there is a "^" (meaning a pointer) in there. */
/* Encode type qualifiers encodes one of the "PQ" Objective-C
keywords, ie 'in', 'out', 'inout', 'bycopy', 'byref', 'oneway'.
'const', instead, is encoded directly as part of the type. */
static void
encode_type_qualifiers (tree declspecs)
{
tree spec;
for (spec = declspecs; spec; spec = TREE_CHAIN (spec))
{
/* FIXME: Shouldn't we use token->keyword here ? */
if (ridpointers[(int) RID_IN] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'n');
else if (ridpointers[(int) RID_INOUT] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'N');
else if (ridpointers[(int) RID_OUT] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'o');
else if (ridpointers[(int) RID_BYCOPY] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'O');
else if (ridpointers[(int) RID_BYREF] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'R');
else if (ridpointers[(int) RID_ONEWAY] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'V');
else
gcc_unreachable ();
}
}
/* Determine if a pointee is marked read-only. Only used by the NeXT
runtime to be compatible with gcc-3.3. */
static bool
pointee_is_readonly (tree pointee)
{
while (POINTER_TYPE_P (pointee))
pointee = TREE_TYPE (pointee);
return TYPE_READONLY (pointee);
}
/* Encode a pointer type. */
static void
encode_pointer (tree type, int curtype, int format)
{
tree pointer_to = TREE_TYPE (type);
if (flag_next_runtime)
{
/* This code is used to be compatible with gcc-3.3. */
/* For historical/compatibility reasons, the read-only qualifier
of the pointee gets emitted _before_ the '^'. The read-only
qualifier of the pointer itself gets ignored, _unless_ we are
looking at a typedef! Also, do not emit the 'r' for anything
but the outermost type! */
if (!generating_instance_variables
&& (obstack_object_size (&util_obstack) - curtype <= 1)
&& (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
? TYPE_READONLY (type)
: pointee_is_readonly (pointer_to)))
obstack_1grow (&util_obstack, 'r');
}
if (TREE_CODE (pointer_to) == RECORD_TYPE)
{
if (OBJC_TYPE_NAME (pointer_to)
&& TREE_CODE (OBJC_TYPE_NAME (pointer_to)) == IDENTIFIER_NODE)
{
const char *name = IDENTIFIER_POINTER (OBJC_TYPE_NAME (pointer_to));
if (strcmp (name, TAG_OBJECT) == 0) /* '@' */
{
obstack_1grow (&util_obstack, '@');
return;
}
else if (TYPE_HAS_OBJC_INFO (pointer_to)
&& TYPE_OBJC_INTERFACE (pointer_to))
{
if (generating_instance_variables)
{
obstack_1grow (&util_obstack, '@');
obstack_1grow (&util_obstack, '"');
obstack_grow (&util_obstack, name, strlen (name));
obstack_1grow (&util_obstack, '"');
return;
}
else
{
obstack_1grow (&util_obstack, '@');
return;
}
}
else if (strcmp (name, TAG_CLASS) == 0) /* '#' */
{
obstack_1grow (&util_obstack, '#');
return;
}
else if (strcmp (name, TAG_SELECTOR) == 0) /* ':' */
{
obstack_1grow (&util_obstack, ':');
return;
}
}
}
else if (TREE_CODE (pointer_to) == INTEGER_TYPE
&& TYPE_MODE (pointer_to) == QImode)
{
tree pname = TREE_CODE (OBJC_TYPE_NAME (pointer_to)) == IDENTIFIER_NODE
? OBJC_TYPE_NAME (pointer_to)
: DECL_NAME (OBJC_TYPE_NAME (pointer_to));
/* (BOOL *) are an exception and are encoded as ^c, while all
other pointers to char are encoded as *. */
if (strcmp (IDENTIFIER_POINTER (pname), "BOOL"))
{
if (!flag_next_runtime)
{
/* The NeXT runtime adds the 'r' before getting here. */
/* It appears that "r*" means "const char *" rather than
"char *const". "char *const" is encoded as "*",
which is identical to "char *", so the "const" is
unfortunately lost. */
if (TYPE_READONLY (pointer_to))
obstack_1grow (&util_obstack, 'r');
}
obstack_1grow (&util_obstack, '*');
return;
}
}
/* We have a normal pointer type that does not get special treatment. */
obstack_1grow (&util_obstack, '^');
encode_type (pointer_to, curtype, format);
}
static void
encode_array (tree type, int curtype, int format)
{
tree an_int_cst = TYPE_SIZE (type);
tree array_of = TREE_TYPE (type);
char buffer[40];
if (an_int_cst == NULL)
{
/* We are trying to encode an incomplete array. An incomplete
array is forbidden as part of an instance variable; but it
may occur if the instance variable is a pointer to such an
array. */
/* So the only case in which an incomplete array could occur
(without being pointed to) is if we are encoding the
arguments or return value of a method. In that case, an
incomplete array argument or return value (eg,
-(void)display: (char[])string) is treated like a pointer
because that is how the compiler does the function call. A
special, more complicated case, is when the incomplete array
is the last member of a struct (eg, if we are encoding
"struct { unsigned long int a;double b[];}"), which is again
part of a method argument/return value. In that case, we
really need to communicate to the runtime that there is an
incomplete array (not a pointer!) there. So, we detect that
special case and encode it as a zero-length array.
Try to detect that we are part of a struct. We do this by
searching for '=' in the type encoding for the current type.
NB: This hack assumes that you can't use '=' as part of a C
identifier.
*/
{
char *enc = (char *) obstack_base (&util_obstack) + curtype;
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
if (memchr (enc, '=',
obstack_object_size (&util_obstack) - curtype) == NULL)
{
/* We are not inside a struct. Encode the array as a
pointer. */
encode_pointer (type, curtype, format);
return;
}
}
/* Else, we are in a struct, and we encode it as a zero-length
array. */
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0);
}
else if (TREE_INT_CST_LOW (TYPE_SIZE (array_of)) == 0)
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0);
else
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (an_int_cst)
/ TREE_INT_CST_LOW (TYPE_SIZE (array_of)));
obstack_grow (&util_obstack, buffer, strlen (buffer));
encode_type (array_of, curtype, format);
obstack_1grow (&util_obstack, ']');
return;
}
/* Encode a vector. The vector type is a GCC extension to C. */
static void
encode_vector (tree type, int curtype, int format)
{
tree vector_of = TREE_TYPE (type);
char buffer[40];
/* Vectors are like simple fixed-size arrays. */
/* Output ![xx,yy,<code>] where xx is the vector_size, yy is the
alignment of the vector, and <code> is the base type. Eg, int
__attribute__ ((vector_size (16))) gets encoded as ![16,32,i]
assuming that the alignment is 32 bytes. We include size and
alignment in bytes so that the runtime does not have to have any
knowledge of the actual types.
*/
sprintf (buffer, "![" HOST_WIDE_INT_PRINT_DEC ",%d",
/* We want to compute the equivalent of sizeof (<vector>).
Code inspired by c_sizeof_or_alignof_type. */
((TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type))
/ (TYPE_PRECISION (char_type_node) / BITS_PER_UNIT))),
/* We want to compute the equivalent of __alignof__
(<vector>). Code inspired by
c_sizeof_or_alignof_type. */
TYPE_ALIGN_UNIT (type));
obstack_grow (&util_obstack, buffer, strlen (buffer));
encode_type (vector_of, curtype, format);
obstack_1grow (&util_obstack, ']');
return;
}
static void
encode_aggregate_fields (tree type, bool pointed_to, int curtype, int format)
{
tree field = TYPE_FIELDS (type);
for (; field; field = DECL_CHAIN (field))
{
#ifdef OBJCPLUS
/* C++ static members, and things that are not field at all,
should not appear in the encoding. */
if (TREE_CODE (field) != FIELD_DECL || TREE_STATIC (field))
continue;
#endif
/* Recursively encode fields of embedded base classes. */
if (DECL_ARTIFICIAL (field) && !DECL_NAME (field)
&& TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE)
{
encode_aggregate_fields (TREE_TYPE (field),
pointed_to, curtype, format);
continue;
}
if (generating_instance_variables && !pointed_to)
{
tree fname = DECL_NAME (field);
obstack_1grow (&util_obstack, '"');
if (fname && TREE_CODE (fname) == IDENTIFIER_NODE)
obstack_grow (&util_obstack,
IDENTIFIER_POINTER (fname),
strlen (IDENTIFIER_POINTER (fname)));
obstack_1grow (&util_obstack, '"');
}
In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * objc-encoding.h (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (encode_field_decl): Updated prototype to return a tree and take a single tree argument. Updated comments. * objc-encoding.c (util_obstack, util_firstobj): Made static. (objc_encoding_init): New. (encode_field_decl): Existing function renamed to encode_field and made static. New encode_field_decl wrapper function added. (encode_aggregate_fields): Update call to encode_field_decl to call encode_field. * objc-next-runtime-abi-02.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_v2_ivar_list_initializer): Updated call to encode_field_decl. * objc-runtime-shared-support.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_ivar_list_initializer): Updated call to encode_field_decl. * objc-act.c (objc_init): Use objc_encoding_init. * Make-lang.in (objc/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Likewise. In gcc/objcp/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (objcp/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Likewise. From-SVN: r176139
2011-07-11 11:42:23 +02:00
encode_field (field, curtype, format);
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
}
}
static void
encode_aggregate_within (tree type, int curtype, int format, int left,
int right)
{
tree name;
/* NB: aggregates that are pointed to have slightly different encoding
rules in that you never encode the names of instance variables. */
int ob_size = obstack_object_size (&util_obstack);
bool inline_contents = false;
bool pointed_to = false;
if (flag_next_runtime)
{
if (ob_size > 0
&& *((char *) obstack_next_free (&util_obstack) - 1) == '^')
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
pointed_to = true;
if ((format == OBJC_ENCODE_INLINE_DEFS || generating_instance_variables)
&& (!pointed_to || ob_size - curtype == 1
|| (ob_size - curtype == 2
&& *((char *) obstack_next_free (&util_obstack) - 2) == 'r')))
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
inline_contents = true;
}
else
{
/* c0 and c1 are the last two characters in the encoding of the
current type; if the last two characters were '^' or '^r',
then we are encoding an aggregate that is "pointed to". The
comment above applies: in that case we should avoid encoding
the names of instance variables.
*/
char c0, c1;
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
c1 = ob_size > 1 ? *((char *) obstack_next_free (&util_obstack) - 2) : 0;
c0 = ob_size > 0 ? *((char *) obstack_next_free (&util_obstack) - 1) : 0;
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
if (c0 == '^' || (c1 == '^' && c0 == 'r'))
pointed_to = true;
if (format == OBJC_ENCODE_INLINE_DEFS || generating_instance_variables)
{
if (!pointed_to)
inline_contents = true;
else
{
/* Note that the check (ob_size - curtype < 2) prevents
infinite recursion when encoding a structure which is
a linked list (eg, struct node { struct node *next;
}). Each time we follow a pointer, we add one
character to ob_size, and curtype is fixed, so after
at most two pointers we stop inlining contents and
break the loop.
The other case where we don't inline is "^r", which
is a pointer to a constant struct.
*/
if ((ob_size - curtype <= 2) && !(c0 == 'r'))
inline_contents = true;
}
}
}
/* Traverse struct aliases; it is important to get the
original struct and its tag name (if any). */
type = TYPE_MAIN_VARIANT (type);
name = OBJC_TYPE_NAME (type);
/* Open parenth/bracket. */
obstack_1grow (&util_obstack, left);
/* Encode the struct/union tag name, or '?' if a tag was
not provided. Typedef aliases do not qualify. */
#ifdef OBJCPLUS
/* For compatibility with the NeXT runtime, ObjC++ encodes template
args as a composite struct tag name. */
if (name && TREE_CODE (name) == IDENTIFIER_NODE
/* Did this struct have a tag? */
&& !TYPE_WAS_UNNAMED (type))
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
obstack_grow (&util_obstack,
decl_as_string (type, TFF_DECL_SPECIFIERS | TFF_UNQUALIFIED_NAME),
strlen (decl_as_string (type, TFF_DECL_SPECIFIERS | TFF_UNQUALIFIED_NAME)));
#else
if (name && TREE_CODE (name) == IDENTIFIER_NODE)
obstack_grow (&util_obstack,
IDENTIFIER_POINTER (name),
strlen (IDENTIFIER_POINTER (name)));
#endif
else
obstack_1grow (&util_obstack, '?');
/* Encode the types (and possibly names) of the inner fields,
if required. */
if (inline_contents)
{
obstack_1grow (&util_obstack, '=');
encode_aggregate_fields (type, pointed_to, curtype, format);
}
/* Close parenth/bracket. */
obstack_1grow (&util_obstack, right);
}
/* Encode a bitfield NeXT-style (i.e., without a bit offset or the underlying
field type. */
static void
encode_next_bitfield (int width)
{
char buffer[40];
sprintf (buffer, "b%d", width);
obstack_grow (&util_obstack, buffer, strlen (buffer));
}
/* Encodes 'type', ignoring type qualifiers (which you should encode
beforehand if needed) with the exception of 'const', which is
encoded by encode_type. See above for the explanation of
'curtype'. 'format' can be OBJC_ENCODE_INLINE_DEFS or
OBJC_ENCODE_DONT_INLINE_DEFS. */
static void
encode_type (tree type, int curtype, int format)
{
enum tree_code code = TREE_CODE (type);
/* Ignore type qualifiers other than 'const' when encoding a
type. */
if (type == error_mark_node)
return;
if (!flag_next_runtime)
{
if (TYPE_READONLY (type))
obstack_1grow (&util_obstack, 'r');
}
switch (code)
{
case ENUMERAL_TYPE:
if (flag_next_runtime)
{
/* Kludge for backwards-compatibility with gcc-3.3: enums
are always encoded as 'i' no matter what type they
actually are (!). */
obstack_1grow (&util_obstack, 'i');
break;
}
/* Else, they are encoded exactly like the integer type that is
used by the compiler to store them. */
re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) PR c/7652 gcc/ * alias.c (find_base_value): Adjust fall through comment. * cfgexpand.c (expand_debug_expr): Likewise. * combine.c (find_split_point): Likewise. (expand_compound_operation): Likewise. Add FALLTHRU. (make_compound_operation): Adjust fall through comment. (canon_reg_for_combine): Add FALLTHRU. (force_to_mode): Adjust fall through comment. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Add FALLTHRU. * config/aarch64/predicates.md: Likewise. * config/i386/i386.c (function_arg_advance_32): Likewise. (ix86_gimplify_va_arg): Likewise. (print_reg): Likewise. (ix86_print_operand): Likewise. (ix86_build_const_vector): Likewise. (ix86_expand_branch): Likewise. (ix86_sched_init_global): Adjust fall through comment. (ix86_expand_args_builtin): Add FALLTHRU. (ix86_expand_builtin): Likewise. (ix86_expand_vector_init_one_var): Likewise. * config/rs6000/rs6000.c (rs6000_emit_vector_compare_inner): Likewise. (rs6000_adjust_cost): Likewise. (insn_must_be_first_in_group): Likewise. * config/rs6000/rs6000.md: Likewise. Adjust fall through comment. * dbxout.c (dbxout_symbol): Adjust fall through comment. * df-scan.c (df_uses_record): Likewise. * dojump.c (do_jump): Add FALLTHRU. * dwarf2out.c (mem_loc_descriptor): Likewise. Adjust fall through comment. (resolve_args_picking_1): Adjust fall through comment. (loc_list_from_tree_1): Likewise. * expmed.c (make_tree): Likewise. * expr.c (expand_expr_real_2): Add FALLTHRU. (expand_expr_real_1): Likewise. Adjust fall through comment. * fold-const.c (const_binop): Adjust fall through comment. (fold_truth_not_expr): Likewise. (fold_cond_expr_with_comparison): Add FALLTHRU. (fold_binary_loc): Likewise. (contains_label_1): Adjust fall through comment. (multiple_of_p): Likewise. * gcov-tool.c (process_args): Add FALLTHRU. * genattrtab.c (check_attr_test): Likewise. (write_test_expr): Likewise. * genconfig.c (walk_insn_part): Likewise. * genpreds.c (validate_exp): Adjust fall through comment. (needs_variable): Likewise. * gensupport.c (get_alternatives_number): Add FALLTHRU. (subst_dup): Likewise. * gimple-pretty-print.c (dump_gimple_assign): Likewise. * gimplify.c (gimplify_addr_expr): Adjust fall through comment. (gimplify_scan_omp_clauses): Add FALLTHRU. (goa_stabilize_expr): Likewise. * graphite-isl-ast-to-gimple.c (substitute_ssa_name): Adjust fall through comment. * hsa-gen.c (get_address_from_value): Likewise. * ipa-icf.c (sem_function::hash_stmt): Likewise. * ira.c (ira_setup_alts): Add FALLTHRU. * lra-eliminations.c (lra_eliminate_regs_1): Adjust fall through comment. * lto-streamer-out.c (lto_output_tree_ref): Add FALLTHRU. * opts.c (common_handle_option): Likewise. * read-rtl.c (read_rtx_code): Likewise. * real.c (round_for_format): Likewise. * recog.c (asm_operand_ok): Likewise. * reginfo.c (reg_scan_mark_refs): Adjust fall through comment. * reload1.c (set_label_offsets): Likewise. (eliminate_regs_1): Likewise. (reload_reg_reaches_end_p): Likewise. * rtlanal.c (commutative_operand_precedence): Add FALLTHRU. (rtx_cost): Likewise. * sched-rgn.c (is_exception_free): Likewise. * simplify-rtx.c (simplify_rtx): Adjust fall through comment. * stor-layout.c (int_mode_for_mode): Likewise. * toplev.c (print_to_asm_out_file): Likewise. (print_to_stderr): Likewise. * tree-cfg.c (gimple_verify_flow_info): Likewise. * tree-chrec.c (chrec_fold_plus_1): Add FALLTHRU. (chrec_fold_multiply): Likewise. (evolution_function_is_invariant_rec_p): Likewise. (for_each_scev_op): Likewise. * tree-data-ref.c (siv_subscript_p): Likewise. (get_references_in_stmt): Likewise. * tree.c (find_placeholder_in_expr): Adjust fall through comment. (substitute_in_expr): Likewise. (type_cache_hasher::equal): Likewise. (walk_type_fields): Likewise. * var-tracking.c (adjust_mems): Add FALLTHRU. (set_dv_changed): Adjust fall through comment. * varasm.c (default_function_section): Add FALLTHRU. gcc/c-family/ * c-common.c (scalar_to_vector): Adjust fall through comment. * c-opts.c (c_common_handle_option): Likewise. * c-pragma.c (handle_pragma_pack): Add FALLTHRU. * c-pretty-print.c (c_pretty_printer::postfix_expression): Adjust fall through comment. * cilk.c (extract_free_variables): Add FALLTHRU. gcc/c/ * c-parser.c (c_parser_external_declaration): Add FALLTHRU. (c_parser_postfix_expression): Likewise. * c-typeck.c (build_unary_op): Adjust fall through comment. (c_mark_addressable): Likewise. gcc/cp/ * call.c (add_builtin_candidate): Add FALLTHRU. (build_integral_nontype_arg_conv): Adjust fall through comment. (build_new_op_1): Add FALLTHRU. (convert_like_real): Adjust fall through comment. * class.c (fixed_type_or_null): Likewise. * constexpr.c (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. Add FALLTHRU. * cp-gimplify.c (cp_gimplify_expr): Adjust fall through comment. (cp_fold): Add FALLTHRU. * cvt.c (build_expr_type_conversion): Adjust fall through comment. * cxx-pretty-print.c (pp_cxx_unqualified_id): Add FALLTHRU. (pp_cxx_qualified_id): Likewise. (cxx_pretty_printer::constant): Adjust fall through comment. (cxx_pretty_printer::primary_expression): Add FALLTHRU. (pp_cxx_pm_expression): Adjust fall through comment. (cxx_pretty_printer::expression): Add FALLTHRU. (cxx_pretty_printer::declaration_specifiers): Reformat code. (pp_cxx_type_specifier_seq): Adjust fall through comment. (pp_cxx_ptr_operator): Likewise. Add FALLTHRU. * error.c (dump_type): Adjust fall through comment. (dump_decl): Likewise. * mangle.c (write_type): Likewise. * method.c (synthesized_method_walk): Add FALLTHRU. * name-lookup.c (arg_assoc_type): Likewise. * parser.c (cp_lexer_print_token): Adjust fall through comment. (cp_parser_primary_expression): Add FALLTHRU. (cp_parser_operator): Likewise. * pt.c (find_parameter_packs_r): Likewise. (tsubst_aggr_type): Adjust fall through comment. * semantics.c (finish_omp_clauses): Add FALLTHRU. * tree.c (lvalue_kind): Likewise. gcc/fortran/ * decl.c (match_attr_spec): Add FALLTHRU. * primary.c (match_arg_list_function): Likewise. * resolve.c (resolve_operator): Adjust fall through comment. (fixup_charlen): Add FALLTHRU. (resolve_allocate_expr): Adjust fall through comment. * trans-array.c (gfc_conv_ss_startstride): Add FALLTHRU. * trans-intrinsic.c (gfc_conv_intrinsic_len): Adjust fall through comment. gcc/java/ * expr.c (java_truthvalue_conversion): Adjust fall through comment. * jcf-io.c (verify_constant_pool): Likewise. * typeck.c (promote_type): Likewise. gcc/objc/ * objc-encoding.c (encode_type): Add FALLTHRU. libcpp/ * lex.c (search_line_fast): Add FALLTHRU. (_cpp_lex_direct): Likewise. (cpp_token_val_index): Adjust fall through comment. * macro.c (parse_params): Add FALLTHRU. * pch.c (count_defs): Adjust fall through comment. (write_defs): Likewise. libiberty/ * cp-demangle.c (d_print_mod): Add FALLTHRU. From-SVN: r239410
2016-08-12 12:30:47 +02:00
/* FALLTHRU */
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
case INTEGER_TYPE:
{
char c;
switch (GET_MODE_BITSIZE (TYPE_MODE (type)))
{
case 8: c = TYPE_UNSIGNED (type) ? 'C' : 'c'; break;
case 16: c = TYPE_UNSIGNED (type) ? 'S' : 's'; break;
case 32:
{
tree int_type = type;
if (flag_next_runtime)
{
/* Another legacy kludge for compatibility with
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
gcc-3.3: 32-bit longs are encoded as 'l' or 'L',
but not always. For typedefs, we need to use 'i'
or 'I' instead if encoding a struct field, or a
pointer! */
int_type = ((!generating_instance_variables
&& (obstack_object_size (&util_obstack)
== (unsigned) curtype))
? TYPE_MAIN_VARIANT (type)
: type);
}
if (int_type == long_unsigned_type_node
|| int_type == long_integer_type_node)
c = TYPE_UNSIGNED (type) ? 'L' : 'l';
else
c = TYPE_UNSIGNED (type) ? 'I' : 'i';
}
break;
case 64: c = TYPE_UNSIGNED (type) ? 'Q' : 'q'; break;
case 128: c = TYPE_UNSIGNED (type) ? 'T' : 't'; break;
default: gcc_unreachable ();
}
obstack_1grow (&util_obstack, c);
break;
}
case REAL_TYPE:
{
char c;
/* Floating point types. */
switch (GET_MODE_BITSIZE (TYPE_MODE (type)))
{
case 32: c = 'f'; break;
case 64: c = 'd'; break;
case 96:
case 128: c = 'D'; break;
default: gcc_unreachable ();
}
obstack_1grow (&util_obstack, c);
break;
}
case VOID_TYPE:
obstack_1grow (&util_obstack, 'v');
break;
case BOOLEAN_TYPE:
obstack_1grow (&util_obstack, 'B');
break;
case ARRAY_TYPE:
encode_array (type, curtype, format);
break;
case POINTER_TYPE:
#ifdef OBJCPLUS
case REFERENCE_TYPE:
#endif
encode_pointer (type, curtype, format);
break;
case RECORD_TYPE:
encode_aggregate_within (type, curtype, format, '{', '}');
break;
case UNION_TYPE:
encode_aggregate_within (type, curtype, format, '(', ')');
break;
case FUNCTION_TYPE: /* '?' means an unknown type. */
obstack_1grow (&util_obstack, '?');
break;
case COMPLEX_TYPE:
/* A complex is encoded as 'j' followed by the inner type (eg,
"_Complex int" is encoded as 'ji'). */
obstack_1grow (&util_obstack, 'j');
encode_type (TREE_TYPE (type), curtype, format);
break;
case VECTOR_TYPE:
encode_vector (type, curtype, format);
break;
default:
warning (0, "unknown type %<%T%> found during Objective-C encoding",
TREE_TYPE (type));
obstack_1grow (&util_obstack, '?');
break;
}
if (flag_next_runtime)
{
/* Super-kludge. Some ObjC qualifier and type combinations need
to be rearranged for compatibility with gcc-3.3. */
if (code == POINTER_TYPE && obstack_object_size (&util_obstack) >= 3)
{
char *enc = (char *) obstack_base (&util_obstack) + curtype;
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
/* Rewrite "in const" from "nr" to "rn". */
if (curtype >= 1 && !strncmp (enc - 1, "nr", 2))
strncpy (enc - 1, "rn", 2);
}
}
}
static void
encode_gnu_bitfield (int position, tree type, int size)
{
enum tree_code code = TREE_CODE (type);
char buffer[40];
char charType = '?';
/* This code is only executed for the GNU runtime, so we can ignore
the NeXT runtime kludge of always encoding enums as 'i' no matter
what integers they actually are. */
if (code == INTEGER_TYPE || code == ENUMERAL_TYPE)
{
if (integer_zerop (TYPE_MIN_VALUE (type)))
/* Unsigned integer types. */
{
switch (TYPE_MODE (type))
{
case QImode:
charType = 'C'; break;
case HImode:
charType = 'S'; break;
case SImode:
{
if (type == long_unsigned_type_node)
charType = 'L';
else
charType = 'I';
break;
}
case DImode:
charType = 'Q'; break;
default:
gcc_unreachable ();
}
}
else
/* Signed integer types. */
{
switch (TYPE_MODE (type))
{
case QImode:
charType = 'c'; break;
case HImode:
charType = 's'; break;
case SImode:
{
if (type == long_integer_type_node)
charType = 'l';
else
charType = 'i';
break;
}
case DImode:
charType = 'q'; break;
default:
gcc_unreachable ();
}
}
}
else
{
/* Do not do any encoding, produce an error and keep going. */
error ("trying to encode non-integer type as a bitfield");
return;
}
sprintf (buffer, "b%d%c%d", position, charType, size);
obstack_grow (&util_obstack, buffer, strlen (buffer));
}
In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * objc-encoding.h (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (encode_field_decl): Updated prototype to return a tree and take a single tree argument. Updated comments. * objc-encoding.c (util_obstack, util_firstobj): Made static. (objc_encoding_init): New. (encode_field_decl): Existing function renamed to encode_field and made static. New encode_field_decl wrapper function added. (encode_aggregate_fields): Update call to encode_field_decl to call encode_field. * objc-next-runtime-abi-02.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_v2_ivar_list_initializer): Updated call to encode_field_decl. * objc-runtime-shared-support.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_ivar_list_initializer): Updated call to encode_field_decl. * objc-act.c (objc_init): Use objc_encoding_init. * Make-lang.in (objc/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Likewise. In gcc/objcp/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (objcp/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Likewise. From-SVN: r176139
2011-07-11 11:42:23 +02:00
static void
encode_field (tree field_decl, int curtype, int format)
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
{
#ifdef OBJCPLUS
/* C++ static members, and things that are not fields at all,
should not appear in the encoding. */
if (TREE_CODE (field_decl) != FIELD_DECL || TREE_STATIC (field_decl))
return;
#endif
/* Generate the bitfield typing information, if needed. Note the difference
between GNU and NeXT runtimes. */
if (DECL_BIT_FIELD_TYPE (field_decl))
{
decl.c, [...]: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ada/ * gcc-interface/decl.c, gcc-interface/utils.c, gcc-interface/utils2.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c-family/ * c-common.c, c-cppbuiltin.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c/ * c-decl.c, c-typeck.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/cp/ * call.c, class.c, decl.c, error.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/objc/ * objc-encoding.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ * alias.c, asan.c, builtins.c, cfgexpand.c, cgraph.c, config/aarch64/aarch64.c, config/alpha/predicates.md, config/arm/arm.c, config/darwin.c, config/epiphany/epiphany.c, config/i386/i386.c, config/iq2000/iq2000.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/mips/mips.c, config/picochip/picochip.c, config/rs6000/rs6000.c, cppbuiltin.c, dbxout.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, fold-const.c, function.c, gimple-fold.c, godump.c, ipa-cp.c, ipa-prop.c, omp-low.c, predict.c, sdbout.c, stor-layout.c, trans-mem.c, tree-object-size.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-forwprop.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-strlen.c, tree-stdarg.c, tree-switch-conversion.c, tree-vect-generic.c, tree-vect-loop.c, tree-vect-patterns.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, varasm.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. From-SVN: r204961
2013-11-18 15:52:19 +01:00
int size = tree_to_uhwi (DECL_SIZE (field_decl));
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
if (flag_next_runtime)
encode_next_bitfield (size);
else
encode_gnu_bitfield (int_bit_position (field_decl),
DECL_BIT_FIELD_TYPE (field_decl), size);
}
else
encode_type (TREE_TYPE (field_decl), curtype, format);
}
In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * objc-encoding.h (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (encode_field_decl): Updated prototype to return a tree and take a single tree argument. Updated comments. * objc-encoding.c (util_obstack, util_firstobj): Made static. (objc_encoding_init): New. (encode_field_decl): Existing function renamed to encode_field and made static. New encode_field_decl wrapper function added. (encode_aggregate_fields): Update call to encode_field_decl to call encode_field. * objc-next-runtime-abi-02.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_v2_ivar_list_initializer): Updated call to encode_field_decl. * objc-runtime-shared-support.c (obstack.h): Do not include. (util_obstack, util_firstobj): Do not declare. (build_ivar_list_initializer): Updated call to encode_field_decl. * objc-act.c (objc_init): Use objc_encoding_init. * Make-lang.in (objc/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Likewise. In gcc/objcp/: 2011-07-11 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (objcp/objc-runtime-shared-support.o): Do not depend on OBSTACK_H. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Likewise. From-SVN: r176139
2011-07-11 11:42:23 +02:00
tree
encode_field_decl (tree field_decl)
{
tree result;
encode_field (field_decl,
obstack_object_size (&util_obstack),
OBJC_ENCODE_DONT_INLINE_DEFS);
/* Null terminate string. */
obstack_1grow (&util_obstack, 0);
/* Get identifier for the string. */
result = get_identifier (XOBFINISH (&util_obstack, char *));
obstack_free (&util_obstack, util_firstobj);
return result;
}
In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> In gcc/objc/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> Refactored encoding code into objc-encoding.h and objc-encoding.c. * objc-act.c (util_obstack, util_firstobj, encode_type_qualifiers, encode_type, generating_instance_variables, objc_method_parm_type, objc_encoded_type_size, encode_method_prototype, objc_build_encode_expr, pointee_is_readonly, encode_pointer, encode_array, encode_vector, encode_aggregate_fields, encode_aggregate_within, encode_next_bitfield, encode_gnu_bitfield, encode_field_decl, objc_v2_encode_property_attr): Moved to objc-encoding.h and objc-encoding.c. No change in the actual code. Include objc-encoding.h. (objc_init): Added TODO. (objc_build_property_setter_name): Made non-static so it can be called from objc-encoding.c. * objc-act.h (OBJC_ENCODE_INLINE_DEFS, OBJC_ENCODE_DONT_INLINE_DEFS): Moved to objc-encoding.h. * objc-runtime-shared-support.h (objc_v2_encode_property_attr, encode_method_prototype, encode_field_decl, generating_instance_variables): Moved to objc-encoding.h. (objc_build_property_setter_name): Declare. * objc-encoding.c: New. * objc-encoding.h: New. * objc-gnu-runtime-abi-01.c: Include objc-encoding.h. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. * Make-lang.in (OBJC_OBJS): Added objc-encoding.o. (objc/objc-lang.o): Reordered dependencies. (objc/objc-runtime-shared-support.o): Reordered dependencies. Added dependencies on objc-encoding.h and on $(GGC_H), $(DIAGNOSTIC_CORE_H), $(FLAGS_H) and input.h. (objc/objc-gnu-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-01.o): Likewise. (objc/objc-next-runtime-abi-02.o): Likewise. (objc/objc-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objc/objc-encoding.o): New rule. * objc-encoding.c (encode_type): Use "%<%T%>" format when printing warning "unknown type %<%T%> found during Objective-C encoding" instead of using gen_type_name. In gcc/objcp/: 2011-07-04 Nicola Pero <nicola.pero@meta-innovation.com> * Make-lang.in (OBJCXX_OBJS): Added objc-encoding.o. (objcp/objcp-lang.o): Reordered dependencies. Depend on GGC_H. (objcp/objcp-decl.o): Reordered dependencies. (objcp/objc-runtime-shared-support.o): Reordered dependencies. Updated them to be identical to the corresponding new objc/ ones, with the addition of objcp-decl.h. (objcp/objc-runtime-shared-support.o): Likewise. (objcp/objc-gnu-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-01.o): Likewise. (objcp/objc-next-runtime-abi-02.o): Likewise. (objcp/objcp-act.o): Reordered dependencies. Added dependency on objc-encoding.h. (objcp/objc-encoding.o): New rule. From-SVN: r175797
2011-07-04 10:02:50 +02:00
/* This routine encodes the attribute of the input PROPERTY according
to following formula:
Property attributes are stored as a comma-delimited C string.
Simple attributes such as readonly are encoded as single
character. The parametrized attributes, getter=name and
setter=name, are encoded as a single character followed by an
identifier. Property types are also encoded as a parametrized
attribute. The characters used to encode these attributes are
defined by the following enumeration:
enum PropertyAttributes {
kPropertyReadOnly = 'R',
kPropertyBycopy = 'C',
kPropertyByref = '&',
kPropertyDynamic = 'D',
kPropertyGetter = 'G',
kPropertySetter = 'S',
kPropertyInstanceVariable = 'V',
kPropertyType = 'T',
kPropertyWeak = 'W',
kPropertyStrong = 'P',
kPropertyNonAtomic = 'N'
}; */
tree
objc_v2_encode_prop_attr (tree property)
{
const char *string;
tree type = TREE_TYPE (property);
obstack_1grow (&util_obstack, 'T');
encode_type (type, obstack_object_size (&util_obstack),
OBJC_ENCODE_INLINE_DEFS);
if (PROPERTY_READONLY (property))
obstack_grow (&util_obstack, ",R", 2);
switch (PROPERTY_ASSIGN_SEMANTICS (property))
{
case OBJC_PROPERTY_COPY:
obstack_grow (&util_obstack, ",C", 2);
break;
case OBJC_PROPERTY_RETAIN:
obstack_grow (&util_obstack, ",&", 2);
break;
case OBJC_PROPERTY_ASSIGN:
default:
break;
}
if (PROPERTY_DYNAMIC (property))
obstack_grow (&util_obstack, ",D", 2);
if (PROPERTY_NONATOMIC (property))
obstack_grow (&util_obstack, ",N", 2);
/* Here we want to encode the getter name, but only if it's not the
standard one. */
if (PROPERTY_GETTER_NAME (property) != PROPERTY_NAME (property))
{
obstack_grow (&util_obstack, ",G", 2);
string = IDENTIFIER_POINTER (PROPERTY_GETTER_NAME (property));
obstack_grow (&util_obstack, string, strlen (string));
}
if (!PROPERTY_READONLY (property))
{
/* Here we want to encode the setter name, but only if it's not
the standard one. */
tree standard_setter = get_identifier (objc_build_property_setter_name (PROPERTY_NAME (property)));
if (PROPERTY_SETTER_NAME (property) != standard_setter)
{
obstack_grow (&util_obstack, ",S", 2);
string = IDENTIFIER_POINTER (PROPERTY_SETTER_NAME (property));
obstack_grow (&util_obstack, string, strlen (string));
}
}
/* TODO: Encode strong ('P'), weak ('W') for garbage collection. */
if (!PROPERTY_DYNAMIC (property))
{
obstack_grow (&util_obstack, ",V", 2);
if (PROPERTY_IVAR_NAME (property))
string = IDENTIFIER_POINTER (PROPERTY_IVAR_NAME (property));
else
string = IDENTIFIER_POINTER (PROPERTY_NAME (property));
obstack_grow (&util_obstack, string, strlen (string));
}
/* NULL-terminate string. */
obstack_1grow (&util_obstack, 0);
string = XOBFINISH (&util_obstack, char *);
obstack_free (&util_obstack, util_firstobj);
return get_identifier (string);
}