summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-03 09:01:56 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-03 09:01:56 +0000
commit75bd5a1db9c6c967878fc8a466ce504a1f6ee96b (patch)
tree7ebdbe10606d582163269a093592c719d2192347
parent19854ff430ae0ea2882baa0775221bfb58b8719a (diff)
downloadgcc-75bd5a1db9c6c967878fc8a466ce504a1f6ee96b.tar.gz
2013-01-03 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 194833 using svnmerge.py git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@194835 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.MELT4
-rw-r--r--MAINTAINERS2
-rwxr-xr-xconfig.guess82
-rwxr-xr-xconfig.sub33
-rw-r--r--gcc/ChangeLog252
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog448
-rw-r--r--gcc/ada/a-exctra.ads11
-rw-r--r--gcc/ada/a-nlcefu.ads1
-rw-r--r--gcc/ada/a-nllcef.ads1
-rw-r--r--gcc/ada/a-nscefu.ads1
-rw-r--r--gcc/ada/a-ststio.adb28
-rw-r--r--gcc/ada/adaint.c56
-rw-r--r--gcc/ada/adaint.h1
-rw-r--r--gcc/ada/argv.c10
-rw-r--r--gcc/ada/back_end.adb5
-rw-r--r--gcc/ada/checks.adb121
-rw-r--r--gcc/ada/cio.c10
-rw-r--r--gcc/ada/cstreams.c37
-rw-r--r--gcc/ada/einfo.adb14
-rw-r--r--gcc/ada/einfo.ads47
-rw-r--r--gcc/ada/env.c8
-rw-r--r--gcc/ada/err_vars.ads10
-rw-r--r--gcc/ada/errout.adb63
-rw-r--r--gcc/ada/errout.ads24
-rw-r--r--gcc/ada/erroutc.adb166
-rw-r--r--gcc/ada/erroutc.ads14
-rw-r--r--gcc/ada/errutil.adb1
-rw-r--r--gcc/ada/exit.c10
-rw-r--r--gcc/ada/exp_aggr.adb13
-rw-r--r--gcc/ada/exp_ch11.adb14
-rw-r--r--gcc/ada/exp_ch3.adb9
-rw-r--r--gcc/ada/exp_ch4.adb49
-rw-r--r--gcc/ada/exp_ch6.adb21
-rw-r--r--gcc/ada/exp_ch7.adb3
-rw-r--r--gcc/ada/exp_ch9.adb6
-rw-r--r--gcc/ada/exp_disp.adb6
-rw-r--r--gcc/ada/exp_dist.adb1
-rw-r--r--gcc/ada/exp_intr.adb34
-rw-r--r--gcc/ada/exp_prag.adb36
-rw-r--r--gcc/ada/exp_util.adb9
-rw-r--r--gcc/ada/fe.h10
-rw-r--r--gcc/ada/freeze.adb160
-rw-r--r--gcc/ada/g-excact.ads8
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in124
-rw-r--r--gcc/ada/gcc-interface/Makefile.in6
-rw-r--r--gcc/ada/gcc-interface/misc.c4
-rw-r--r--gcc/ada/gcc-interface/trans.c10
-rw-r--r--gcc/ada/get_scos.adb10
-rw-r--r--gcc/ada/gnat1drv.adb6
-rw-r--r--gcc/ada/gnat_rm.texi77
-rw-r--r--gcc/ada/gnat_ugn.texi22
-rw-r--r--gcc/ada/i-cstrea.ads10
-rw-r--r--gcc/ada/init.c317
-rw-r--r--gcc/ada/initialize.c8
-rw-r--r--gcc/ada/inline.adb16
-rw-r--r--gcc/ada/layout.adb8
-rw-r--r--gcc/ada/lib-xref.adb6
-rw-r--r--gcc/ada/opt.adb6
-rw-r--r--gcc/ada/opt.ads100
-rw-r--r--gcc/ada/osint.ads2
-rw-r--r--gcc/ada/par-ch10.adb5
-rw-r--r--gcc/ada/par-labl.adb5
-rw-r--r--gcc/ada/par-load.adb4
-rw-r--r--gcc/ada/par-prag.adb1
-rw-r--r--gcc/ada/par-util.adb6
-rw-r--r--gcc/ada/par_sco.adb313
-rw-r--r--gcc/ada/raise.c10
-rw-r--r--gcc/ada/restrict.adb14
-rw-r--r--gcc/ada/s-crtl.ads9
-rw-r--r--gcc/ada/s-direio.adb32
-rw-r--r--gcc/ada/s-except.ads1
-rw-r--r--gcc/ada/s-rannum.adb5
-rw-r--r--gcc/ada/scn.adb12
-rw-r--r--gcc/ada/scos.ads4
-rw-r--r--gcc/ada/seh_init.c8
-rw-r--r--gcc/ada/sem_aggr.adb76
-rw-r--r--gcc/ada/sem_attr.adb94
-rw-r--r--gcc/ada/sem_case.adb4
-rw-r--r--gcc/ada/sem_cat.adb7
-rw-r--r--gcc/ada/sem_ch10.adb20
-rw-r--r--gcc/ada/sem_ch11.adb21
-rw-r--r--gcc/ada/sem_ch12.adb56
-rw-r--r--gcc/ada/sem_ch13.adb227
-rw-r--r--gcc/ada/sem_ch3.adb145
-rw-r--r--gcc/ada/sem_ch4.adb34
-rw-r--r--gcc/ada/sem_ch5.adb29
-rw-r--r--gcc/ada/sem_ch6.adb90
-rw-r--r--gcc/ada/sem_ch6.ads23
-rw-r--r--gcc/ada/sem_ch7.adb51
-rw-r--r--gcc/ada/sem_ch8.adb79
-rw-r--r--gcc/ada/sem_ch9.adb32
-rw-r--r--gcc/ada/sem_dim.adb2
-rw-r--r--gcc/ada/sem_disp.adb18
-rw-r--r--gcc/ada/sem_dist.adb7
-rw-r--r--gcc/ada/sem_elab.adb60
-rw-r--r--gcc/ada/sem_eval.adb39
-rw-r--r--gcc/ada/sem_intr.adb2
-rw-r--r--gcc/ada/sem_mech.adb2
-rw-r--r--gcc/ada/sem_prag.adb188
-rw-r--r--gcc/ada/sem_prag.ads3
-rw-r--r--gcc/ada/sem_res.adb136
-rw-r--r--gcc/ada/sem_util.adb44
-rw-r--r--gcc/ada/sem_warn.adb184
-rw-r--r--gcc/ada/sinput-l.adb2
-rw-r--r--gcc/ada/snames.ads-tmpl2
-rw-r--r--gcc/ada/sprint.adb38
-rw-r--r--gcc/ada/switch-c.adb7
-rw-r--r--gcc/ada/switch-m.adb6
-rw-r--r--gcc/ada/targext.c10
-rw-r--r--gcc/ada/targparm.adb2
-rw-r--r--gcc/ada/targparm.ads2
-rw-r--r--gcc/ada/tracebak.c21
-rw-r--r--gcc/ada/tree_io.ads3
-rw-r--r--gcc/ada/ug_words7
-rw-r--r--gcc/ada/usage.adb19
-rw-r--r--gcc/ada/vms_data.ads46
-rw-r--r--gcc/ada/warnsw.adb10
-rw-r--r--gcc/ada/warnsw.ads7
-rw-r--r--gcc/builtins.c84
-rw-r--r--gcc/c-family/c-common.c6
-rw-r--r--gcc/cfgloop.c52
-rw-r--r--gcc/cfgloop.h1
-rw-r--r--gcc/cgraph.c4
-rw-r--r--gcc/cgraph.h6
-rw-r--r--gcc/config/aarch64/aarch64-cores.def2
-rw-r--r--gcc/config/aarch64/aarch64-tune.md2
-rw-r--r--gcc/config/i386/i386.c115
-rw-r--r--gcc/config/ia64/ia64.c21
-rw-r--r--gcc/config/pa/pa.md6
-rw-r--r--gcc/config/rs6000/rs6000.c124
-rw-r--r--gcc/config/rs6000/rs6000.md1
-rw-r--r--gcc/config/rs6000/xcoff.h7
-rwxr-xr-xgcc/configure4
-rw-r--r--gcc/configure.ac4
-rw-r--r--gcc/cp/ChangeLog21
-rw-r--r--gcc/cp/call.c3
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/rtti.c10
-rw-r--r--gcc/cp/tree.c36
-rw-r--r--gcc/cprop.c34
-rw-r--r--gcc/doc/contrib.texi3
-rw-r--r--gcc/doc/tm.texi5
-rw-r--r--gcc/doc/tm.texi.in5
-rw-r--r--gcc/double-int.h4
-rw-r--r--gcc/dumpfile.c4
-rw-r--r--gcc/expr.c3
-rw-r--r--gcc/fortran/ChangeLog53
-rw-r--r--gcc/fortran/check.c23
-rw-r--r--gcc/fortran/gfortran.h4
-rw-r--r--gcc/fortran/interface.c13
-rw-r--r--gcc/fortran/io.c5
-rw-r--r--gcc/fortran/ioparm.def1
-rw-r--r--gcc/fortran/match.c3
-rw-r--r--gcc/fortran/module.c4
-rw-r--r--gcc/fortran/resolve.c29
-rw-r--r--gcc/fortran/trans-expr.c9
-rw-r--r--gcc/fortran/trans-intrinsic.c54
-rw-r--r--gcc/fortran/trans-io.c3
-rw-r--r--gcc/go/ChangeLog5
-rw-r--r--gcc/go/go-system.h9
-rw-r--r--gcc/go/gofrontend/expressions.cc2
-rw-r--r--gcc/go/gofrontend/expressions.h1
-rw-r--r--gcc/go/gofrontend/gogo-tree.cc2
-rw-r--r--gcc/go/gofrontend/gogo.cc37
-rw-r--r--gcc/go/gofrontend/gogo.h13
-rw-r--r--gcc/go/gofrontend/lex.h1
-rw-r--r--gcc/go/gofrontend/runtime.cc2
-rw-r--r--gcc/go/gofrontend/statements.cc2
-rw-r--r--gcc/go/gofrontend/types.cc2
-rw-r--r--gcc/ipa-inline-analysis.c1079
-rw-r--r--gcc/ira.c4
-rw-r--r--gcc/loop-unroll.c96
-rw-r--r--gcc/lra-assigns.c2
-rw-r--r--gcc/lra-constraints.c27
-rw-r--r--gcc/lra-int.h19
-rw-r--r--gcc/lto-streamer-out.c24
-rw-r--r--gcc/output.h2
-rw-r--r--gcc/realmpfr.h1
-rw-r--r--gcc/rtlanal.c7
-rw-r--r--gcc/system.h2
-rw-r--r--gcc/target.def10
-rw-r--r--gcc/targhooks.c6
-rw-r--r--gcc/testsuite/ChangeLog188
-rw-r--r--gcc/testsuite/c-c++-common/pr43942.c1
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-protected.C23
-rw-r--r--gcc/testsuite/g++.dg/init/array33.C22
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-9.C1
-rw-r--r--gcc/testsuite/g++.dg/mv1.C2
-rw-r--r--gcc/testsuite/g++.dg/mv2.C2
-rw-r--r--gcc/testsuite/g++.dg/mv3.C2
-rw-r--r--gcc/testsuite/g++.dg/mv4.C2
-rw-r--r--gcc/testsuite/g++.dg/mv5.C2
-rw-r--r--gcc/testsuite/g++.dg/overload/defarg7.C12
-rw-r--r--gcc/testsuite/g++.dg/torture/pr55355.C23
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr44707.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr55430.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr55831.c39
-rw-r--r--gcc/testsuite/gcc.dg/pthread-init-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-2.c18
-rw-r--r--gcc/testsuite/gcc.dg/torture/tls/tls-reload-1.c48
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-23.c2
-rw-r--r--gcc/testsuite/gcc.dg/unroll_1.c2
-rw-r--r--gcc/testsuite/gcc.dg/unroll_2.c2
-rw-r--r--gcc/testsuite/gcc.dg/unroll_3.c2
-rw-r--r--gcc/testsuite/gcc.dg/unroll_4.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/builtin_target.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr55775.c56
-rw-r--r--gcc/testsuite/gcc.target/mips/pr55315.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/r10k-cache-barrier-10.c6
-rw-r--r--gcc/testsuite/gfortran.dg/associated_7.f909
-rw-r--r--gcc/testsuite/gfortran.dg/eof_4.f90130
-rw-r--r--gcc/testsuite/gfortran.dg/inquire_15.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/newunit_3.f907
-rw-r--r--gcc/testsuite/gfortran.dg/nosigned_zero_3.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/public_private_module_8.f9049
-rw-r--r--gcc/testsuite/gfortran.dg/unlimited_polymorphic_4.f0341
-rw-r--r--gcc/testsuite/gfortran.dg/unlimited_polymorphic_5.f9041
-rw-r--r--gcc/testsuite/gfortran.dg/unlimited_polymorphic_6.f9037
-rw-r--r--gcc/testsuite/lib/c-compat.exp24
-rw-r--r--gcc/testsuite/lib/target-supports.exp10
-rw-r--r--gcc/tree-sra.c7
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c42
-rw-r--r--gcc/tree-ssa-loop-niter.c1
-rw-r--r--gcc/tree-vect-loop.c6
-rw-r--r--gcc/tree-vect-stmts.c24
-rw-r--r--gcc/tree-vrp.c8
-rw-r--r--gcc/tree.c5
-rw-r--r--gcc/varasm.c2
-rw-r--r--gcc/xcoffout.c1
-rw-r--r--gcc/xcoffout.h1
-rw-r--r--libbacktrace/ChangeLog15
-rw-r--r--libbacktrace/Makefile.am2
-rw-r--r--libbacktrace/Makefile.in2
-rw-r--r--libbacktrace/mmap.c24
-rw-r--r--libffi/ChangeLog331
-rw-r--r--libffi/ChangeLog.libffi584
-rw-r--r--libffi/Makefile.am119
-rw-r--r--libffi/Makefile.in626
-rw-r--r--libffi/README114
-rw-r--r--libffi/aclocal.m41
-rwxr-xr-xlibffi/configure322
-rw-r--r--libffi/configure.ac157
-rw-r--r--libffi/doc/stamp-vti8
-rw-r--r--libffi/doc/version.texi8
-rw-r--r--libffi/fficonfig.h.in3
-rw-r--r--libffi/generate-ios-source-and-headers.py160
-rw-r--r--libffi/generate-osx-source-and-headers.py153
-rw-r--r--libffi/include/Makefile.in5
-rw-r--r--libffi/libffi.xcodeproj/project.pbxproj579
-rw-r--r--libffi/man/Makefile.am4
-rw-r--r--libffi/man/Makefile.in9
-rw-r--r--libffi/mdate-sh205
-rw-r--r--libffi/src/aarch64/ffi.c1076
-rw-r--r--libffi/src/aarch64/ffitarget.h59
-rw-r--r--libffi/src/aarch64/sysv.S307
-rw-r--r--libffi/src/arm/ffi.c4
-rw-r--r--libffi/src/arm/sysv.S13
-rw-r--r--libffi/src/arm/trampoline.S2
-rw-r--r--libffi/src/bfin/ffi.c195
-rw-r--r--libffi/src/bfin/ffitarget.h43
-rw-r--r--libffi/src/bfin/sysv.S177
-rw-r--r--libffi/src/closures.c27
-rw-r--r--libffi/src/m68k/ffi.c83
-rw-r--r--libffi/src/m68k/sysv.S53
-rw-r--r--libffi/src/powerpc/ffi_darwin.c6
-rw-r--r--libffi/src/prep_cif.c13
-rw-r--r--libffi/src/tile/ffi.c355
-rw-r--r--libffi/src/tile/ffitarget.h65
-rw-r--r--libffi/src/tile/tile.S360
-rw-r--r--libffi/src/x86/ffi.c29
-rw-r--r--libffi/src/x86/ffi64.c8
-rw-r--r--libffi/src/x86/ffitarget.h7
-rw-r--r--libffi/src/x86/win32.S168
-rw-r--r--libffi/testsuite/Makefile.am69
-rw-r--r--libffi/testsuite/Makefile.in74
-rw-r--r--libffi/testsuite/lib/libffi.exp6
-rw-r--r--libffi/testsuite/libffi.call/closure_stdcall.c8
-rw-r--r--libffi/testsuite/libffi.call/closure_thiscall.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_12byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_16byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_18byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_19byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_1_1byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_20byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_20byte1.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_24byte.c10
-rw-r--r--libffi/testsuite/libffi.call/cls_2byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_3_1byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_3byte1.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_3byte2.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_4_1byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_4byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_5_1_byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_5byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_64byte.c10
-rw-r--r--libffi/testsuite/libffi.call/cls_6_1_byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_6byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_7_1_byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_7byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_8byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_9byte1.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_9byte2.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_double.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_float.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_longdouble.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_longdouble_split.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_longdouble_split2.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_pointer.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_sint16.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_sint32.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_sint64.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_uint16.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_uint32.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_align_uint64.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_dbls_struct.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_double_va.c1
-rw-r--r--libffi/testsuite/libffi.call/cls_longdouble_va.c1
-rw-r--r--libffi/testsuite/libffi.call/cls_pointer_stack.c6
-rw-r--r--libffi/testsuite/libffi.call/cls_struct_va1.c114
-rw-r--r--libffi/testsuite/libffi.call/cls_uchar_va.c44
-rw-r--r--libffi/testsuite/libffi.call/cls_uint_va.c45
-rw-r--r--libffi/testsuite/libffi.call/cls_ulong_va.c45
-rw-r--r--libffi/testsuite/libffi.call/cls_ushort_va.c44
-rw-r--r--libffi/testsuite/libffi.call/err_bad_typedef.c4
-rw-r--r--libffi/testsuite/libffi.call/fastthis1_win32.c2
-rw-r--r--libffi/testsuite/libffi.call/fastthis2_win32.c2
-rw-r--r--libffi/testsuite/libffi.call/fastthis3_win32.c2
-rw-r--r--libffi/testsuite/libffi.call/ffitest.h17
-rw-r--r--libffi/testsuite/libffi.call/float_va.c14
-rw-r--r--libffi/testsuite/libffi.call/huge_struct.c26
-rw-r--r--libffi/testsuite/libffi.call/nested_struct.c12
-rw-r--r--libffi/testsuite/libffi.call/nested_struct1.c14
-rw-r--r--libffi/testsuite/libffi.call/nested_struct10.c12
-rw-r--r--libffi/testsuite/libffi.call/nested_struct11.c121
-rw-r--r--libffi/testsuite/libffi.call/nested_struct2.c10
-rw-r--r--libffi/testsuite/libffi.call/nested_struct3.c10
-rw-r--r--libffi/testsuite/libffi.call/nested_struct4.c10
-rw-r--r--libffi/testsuite/libffi.call/nested_struct5.c10
-rw-r--r--libffi/testsuite/libffi.call/nested_struct6.c12
-rw-r--r--libffi/testsuite/libffi.call/nested_struct7.c10
-rw-r--r--libffi/testsuite/libffi.call/nested_struct8.c12
-rw-r--r--libffi/testsuite/libffi.call/nested_struct9.c12
-rw-r--r--libffi/testsuite/libffi.call/stret_large.c10
-rw-r--r--libffi/testsuite/libffi.call/stret_large2.c10
-rw-r--r--libffi/testsuite/libffi.call/stret_medium.c10
-rw-r--r--libffi/testsuite/libffi.call/stret_medium2.c10
-rw-r--r--libffi/testsuite/libffi.call/strlen2_win32.c3
-rw-r--r--libffi/testsuite/libffi.call/struct1.c12
-rw-r--r--libffi/testsuite/libffi.call/struct1_win32.c14
-rw-r--r--libffi/testsuite/libffi.call/struct2.c10
-rw-r--r--libffi/testsuite/libffi.call/struct2_win32.c12
-rw-r--r--libffi/testsuite/libffi.call/struct3.c9
-rw-r--r--libffi/testsuite/libffi.call/struct4.c13
-rw-r--r--libffi/testsuite/libffi.call/struct5.c13
-rw-r--r--libffi/testsuite/libffi.call/struct6.c14
-rw-r--r--libffi/testsuite/libffi.call/struct7.c14
-rw-r--r--libffi/testsuite/libffi.call/struct8.c13
-rw-r--r--libffi/testsuite/libffi.call/struct9.c13
-rw-r--r--libffi/testsuite/libffi.call/testclosure.c4
-rw-r--r--libffi/testsuite/libffi.call/uninitialized.c61
-rw-r--r--libffi/testsuite/libffi.call/va_1.c196
-rw-r--r--libffi/testsuite/libffi.call/va_struct1.c121
-rw-r--r--libffi/testsuite/libffi.call/va_struct2.c123
-rw-r--r--libffi/testsuite/libffi.call/va_struct3.c125
-rw-r--r--libgfortran/ChangeLog37
-rw-r--r--libgfortran/io/inquire.c24
-rw-r--r--libgfortran/io/io.h2
-rw-r--r--libgfortran/io/list_read.c39
-rw-r--r--libgfortran/io/open.c11
-rw-r--r--libgfortran/io/unix.c10
-rw-r--r--libgfortran/io/write_float.def9
-rw-r--r--libgo/MERGE2
-rw-r--r--libgo/Makefile.am9
-rw-r--r--libgo/Makefile.in27
-rw-r--r--libgo/go/builtin/builtin.go4
-rw-r--r--libgo/go/compress/flate/deflate.go2
-rw-r--r--libgo/go/crypto/cipher/example_test.go4
-rw-r--r--libgo/go/crypto/x509/x509_test.go4
-rw-r--r--libgo/go/database/sql/fakedb_test.go32
-rw-r--r--libgo/go/database/sql/sql.go4
-rw-r--r--libgo/go/database/sql/sql_test.go33
-rw-r--r--libgo/go/debug/elf/file.go7
-rw-r--r--libgo/go/debug/elf/file_test.go59
-rw-r--r--libgo/go/debug/elf/testdata/hello-world-core.gzbin0 -> 12678 bytes
-rw-r--r--libgo/go/encoding/csv/writer.go7
-rw-r--r--libgo/go/encoding/csv/writer_test.go28
-rw-r--r--libgo/go/encoding/gob/decode.go6
-rw-r--r--libgo/go/encoding/json/decode.go36
-rw-r--r--libgo/go/exp/gotype/gotype_test.go54
-rw-r--r--libgo/go/exp/locale/collate/build/trie.go2
-rw-r--r--libgo/go/exp/norm/iter.go2
-rw-r--r--libgo/go/exp/norm/normalize_test.go2
-rw-r--r--libgo/go/exp/norm/triegen.go2
-rw-r--r--libgo/go/exp/types/builtins.go51
-rw-r--r--libgo/go/exp/types/const.go126
-rw-r--r--libgo/go/exp/types/errors.go11
-rw-r--r--libgo/go/exp/types/expr.go156
-rw-r--r--libgo/go/exp/types/operand.go9
-rw-r--r--libgo/go/exp/types/predicates.go15
-rw-r--r--libgo/go/exp/types/stmt.go72
-rw-r--r--libgo/go/exp/types/testdata/builtins.src31
-rw-r--r--libgo/go/exp/types/testdata/decls1.src5
-rw-r--r--libgo/go/exp/types/testdata/expr0.src4
-rw-r--r--libgo/go/exp/types/testdata/expr2.src11
-rw-r--r--libgo/go/exp/types/testdata/expr3.src61
-rw-r--r--libgo/go/exp/types/testdata/stmt0.src26
-rw-r--r--libgo/go/exp/types/types.go10
-rw-r--r--libgo/go/exp/types/types_test.go2
-rw-r--r--libgo/go/fmt/fmt_test.go5
-rw-r--r--libgo/go/fmt/format.go6
-rw-r--r--libgo/go/fmt/scan.go5
-rw-r--r--libgo/go/go/ast/ast.go2
-rw-r--r--libgo/go/go/build/build.go32
-rw-r--r--libgo/go/go/doc/comment.go3
-rw-r--r--libgo/go/go/doc/example.go35
-rw-r--r--libgo/go/go/format/format.go2
-rw-r--r--libgo/go/go/printer/nodes.go2
-rw-r--r--libgo/go/go/token/position.go18
-rw-r--r--libgo/go/go/token/position_test.go51
-rw-r--r--libgo/go/image/image_test.go10
-rw-r--r--libgo/go/io/io.go5
-rw-r--r--libgo/go/io/io_test.go32
-rw-r--r--libgo/go/log/syslog/syslog_test.go10
-rw-r--r--libgo/go/math/all_test.go7
-rw-r--r--libgo/go/math/big/int.go20
-rw-r--r--libgo/go/math/big/int_test.go30
-rw-r--r--libgo/go/math/big/nat.go2
-rw-r--r--libgo/go/math/log10.go3
-rw-r--r--libgo/go/net/cgo_openbsd.go14
-rw-r--r--libgo/go/net/cgo_unix.go2
-rw-r--r--libgo/go/net/conn_test.go16
-rw-r--r--libgo/go/net/dial.go2
-rw-r--r--libgo/go/net/dial_test.go3
-rw-r--r--libgo/go/net/http/client.go34
-rw-r--r--libgo/go/net/http/client_test.go118
-rw-r--r--libgo/go/net/http/pprof/pprof.go5
-rw-r--r--libgo/go/net/http/readrequest_test.go48
-rw-r--r--libgo/go/net/http/serve_test.go70
-rw-r--r--libgo/go/net/http/server.go44
-rw-r--r--libgo/go/net/http/transport.go4
-rw-r--r--libgo/go/net/http/transport_test.go53
-rw-r--r--libgo/go/net/packetconn_test.go21
-rw-r--r--libgo/go/net/protoconn_test.go43
-rw-r--r--libgo/go/net/smtp/smtp.go65
-rw-r--r--libgo/go/net/smtp/smtp_test.go229
-rw-r--r--libgo/go/net/unixsock_plan9.go21
-rw-r--r--libgo/go/net/unixsock_posix.go147
-rw-r--r--libgo/go/net/url/url.go19
-rw-r--r--libgo/go/net/url/url_test.go14
-rw-r--r--libgo/go/os/env.go2
-rw-r--r--libgo/go/os/file_posix.go10
-rw-r--r--libgo/go/os/user/lookup_unix.go2
-rw-r--r--libgo/go/regexp/all_test.go47
-rw-r--r--libgo/go/regexp/syntax/parse.go8
-rw-r--r--libgo/go/strconv/ftoa.go4
-rw-r--r--libgo/go/syscall/env_plan9.go36
-rw-r--r--libgo/go/syscall/libcall_linux_utimesnano.go29
-rw-r--r--libgo/go/syscall/libcall_posix_utimesnano.go24
-rw-r--r--libgo/go/syscall/syscall.go13
-rw-r--r--libgo/go/testing/example.go12
-rw-r--r--libgo/go/time/format.go15
-rw-r--r--libgo/go/time/time_test.go14
-rw-r--r--libgo/go/time/zoneinfo_read.go2
-rwxr-xr-xlibgo/merge.sh2
-rw-r--r--libgo/runtime/env_posix.c37
-rw-r--r--libgo/runtime/go-trampoline.c4
-rw-r--r--libgo/runtime/malloc.goc22
-rw-r--r--libgo/runtime/malloc.h15
-rw-r--r--libgo/runtime/mfinal.c6
-rw-r--r--libgo/runtime/mgc0.c550
-rw-r--r--libgo/runtime/mgc0.h42
-rw-r--r--libgo/runtime/mprof.goc22
-rw-r--r--libgo/runtime/proc.c8
-rw-r--r--libgo/runtime/runtime.c27
-rw-r--r--libgo/runtime/runtime.h3
-rw-r--r--libgo/runtime/time.goc4
-rw-r--r--libiberty/ChangeLog8
-rw-r--r--libiberty/Makefile.in11
-rw-r--r--libiberty/simple-object-common.h1
-rw-r--r--libiberty/simple-object-xcoff.c898
-rw-r--r--libiberty/simple-object.c3
490 files changed, 16429 insertions, 4084 deletions
diff --git a/ChangeLog b/ChangeLog
index fc8f60b8377..7d6edd8d399 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-01-01 Maxim Kuvyrkov <maxim.kuvyrkov@gmail.com>
+
+ * MAINTAINERS: Update my email.
+
+2012-12-29 Ben Elliston <bje@gnu.org>
+
+ * config.guess: Update to 2012-12-29 version.
+ * config.sub: Likewise.
+
2012-12-20 Matthias Klose <doko@ubuntu.com>
* Makefile.def (install-target-libgfortran): Depend on
diff --git a/ChangeLog.MELT b/ChangeLog.MELT
index 01b12497be1..149692dbbdd 100644
--- a/ChangeLog.MELT
+++ b/ChangeLog.MELT
@@ -1,4 +1,8 @@
+2013-01-03 Basile Starynkevitch <basile@starynkevitch.net>
+
+ MELT branch merged with trunk rev 194833 using svnmerge.py
+
2012-12-22 Basile Starynkevitch <basile@starynkevitch.net>
{{MELT plugin 0.9.8 release}}
* INSTALL/README-MELT-PLUGIN: Update.
diff --git a/MAINTAINERS b/MAINTAINERS
index 8488d4950d8..57f457898ad 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -426,7 +426,7 @@ Michael Koch konqueror@gmx.de
Matt Kraai kraai@ftbfs.org
Jan Kratochvil jan.kratochvil@redhat.com
Venkataramanan Kumar venkataramanan.kumar@amd.com
-Maxim Kuvyrkov maxim@codesourcery.com
+Maxim Kuvyrkov maxim.kuvyrkov@gmail.com
Doug Kwan dougkwan@google.com
Scott Robert Ladd scott.ladd@coyotegulch.com
Razya Ladelsky razya@gcc.gnu.org
diff --git a/config.guess b/config.guess
index b02565c7b2f..1804e9fcdcb 100755
--- a/config.guess
+++ b/config.guess
@@ -2,13 +2,13 @@
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# 2011, 2012, 2013 Free Software Foundation, Inc.
-timestamp='2011-06-03'
+timestamp='2012-12-29'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -17,26 +17,22 @@ timestamp='2011-06-03'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
+# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -57,8 +53,8 @@ GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+2012, 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -145,7 +141,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@@ -202,6 +198,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -304,7 +304,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -792,21 +792,26 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
- case ${UNAME_MACHINE} in
- pc98)
- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
+ i*:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
@@ -861,6 +866,13 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@@ -895,13 +907,16 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
- echo cris-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
- echo frv-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
@@ -943,7 +958,7 @@ EOF
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
- echo or32-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
@@ -984,7 +999,7 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -1191,6 +1206,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1246,7 +1264,7 @@ EOF
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1315,11 +1333,11 @@ EOF
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
esac
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
diff --git a/config.sub b/config.sub
index 8df5511094a..802a224de60 100755
--- a/config.sub
+++ b/config.sub
@@ -2,23 +2,19 @@
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# 2011, 2012, 2013 Free Software Foundation, Inc.
-timestamp='2012-12-06'
+timestamp='2012-12-29'
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# This file 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 of the License, or
# (at your option) any later version.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
@@ -26,11 +22,12 @@ timestamp='2012-12-06'
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@@ -74,8 +71,8 @@ version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+2012, 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 90ecae0e034..b1dda601096 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,217 @@
+2013-01-02 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * doc/contrib.texi: Note years as release manager for Mark Mitchell.
+
+2013-01-02 Teresa Johnson <tejohnson@google.com>
+
+ * dumpfile.c (dump_loc): Print filename with location.
+ * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Use
+ new location_t parameter to emit complete unroll message with
+ new dump framework.
+ (canonicalize_loop_induction_variables): Compute loops location
+ and pass to try_unroll_loop_completely.
+ * loop-unroll.c (report_unroll_peel): New function.
+ (peel_loops_completely): Use new dump format with location
+ for main dumpfile message, and invoke report_unroll_peel on success.
+ (decide_unrolling_and_peeling): Ditto.
+ (decide_peel_once_rolling): Remove old dumpfile message subsumed
+ by report_unroll_peel.
+ (decide_peel_completely): Ditto.
+ (decide_unroll_constant_iterations): Ditto.
+ (decide_unroll_runtime_iterations): Ditto.
+ (decide_peel_simple): Ditto.
+ (decide_unroll_stupid): Ditto.
+ * cfgloop.c (get_loop_location): New function.
+ * cfgloop.h (get_loop_location): Declare.
+
+ testsuite/
+ * gcc.dg/tree-ssa/loop-1.c: Update expected dump message.
+ * gcc.dg/tree-ssa/loop-23.c: Ditto.
+ * gcc.dg/tree-ssa/cunroll-1.c: Ditto.
+ * gcc.dg/tree-ssa/cunroll-2.c: Ditto.
+ * gcc.dg/tree-ssa/cunroll-3.c: Ditto.
+ * gcc.dg/tree-ssa/cunroll-4.c: Ditto.
+ * gcc.dg/tree-ssa/cunroll-5.c: Ditto.
+ * gcc.dg/unroll_1.c: Ditto.
+ * gcc.dg/unroll_2.c: Ditto.
+ * gcc.dg/unroll_3.c: Ditto.
+ * gcc.dg/unroll_4.c: Ditto.
+
+2013-01-02 Sriraman Tallam <tmsriram@google.com>
+
+ * config/i386/i386.c (fold_builtin_cpu): Remove unnecessary checks for
+ NULL.
+
+2013-01-02 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR middle-end/55198
+ * expr.c (expand_expr_real_1): Don't use bitfield extraction for non
+ BLKmode objects when EXPAND_MEMORY is specified.
+
+2013-01-02 Sriraman Tallam <tmsriram@google.com>
+
+ * config/i386/i386.c (ix86_get_function_versions_dispatcher): Fix bug
+ in loop predicate.
+ (fold_builtin_cpu): Do not share cpu model decls across statements.
+
+2013-01-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/55804
+ * tree.c (build_array_type_1): Revert earlier change.
+
+2013-01-02 Yufeng Zhang <yufeng.zhang@arm.com>
+
+ * config/aarch64/aarch64-cores.def: Add entries for "cortex-a53" and
+ "cortex-a57".
+ * config/aarch64/aarch64-tune.md: Re-generate.
+
+2013-01-02 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-stmts.c (vectorizable_load): When vectorizing an
+ invariant load do not generate a vector load from the scalar
+ location.
+
+2013-01-02 Richard Biener <rguenther@suse.de>
+
+ PR bootstrap/55784
+ * configure.ac: Add $GMPINC to CFLAGS/CXXFLAGS.
+ * configure: Regenerate.
+
+2013-01-02 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * builtins.c (expand_builtin_mathfn, expand_builtin_mathfn_2)
+ (expand_builtin_mathfn_ternary, expand_builtin_mathfn_3)
+ (expand_builtin_int_roundingfn_2): Keep the original target around
+ for the fallback case.
+
+2013-01-02 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * tree-vrp.c (range_fits_type_p): Require the MSB of the double_int
+ to be clear for sign changes.
+
+2013-01-01 Jan Hubicka <jh@suse.cz>
+
+ * ipa-inline-analysis.c: Fix formatting.
+
+2013-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/55831
+ * tree-vect-loop.c (get_initial_def_for_induction): Use
+ gsi_after_labels instead of gsi_start_bb.
+
+2012-12-27 David Edelsohn <dje.gcc@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_deligitimze_address): Do not
+ delegitimize TLS addresses on AIX.
+ (rs6000_legitimize_tls_address_aix): Append TLS symbol qualifier.
+ Set SYMBOL_FLAG_LOCAL on module symbol.
+ (output_toc): Do not append TLS symbol qualifier here.
+ * config/rs6000/rs6000.md (tls_get_addr_internal): Add GPR 4 to
+ clobbers.
+
+2012-12-27 Andreas Schwab <schwab@linux-m68k.org>
+
+ * target.def (supports_function_versions): Fix typo.
+
+2012-12-26 Sriraman Tallam <tmsriram@google.com>
+
+ * doc/tm.texi.in (TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS): Document
+ new target hook.
+ * doc/tm.texi: Regenerate.
+ * c-family/c-common.c (handle_target_attribute): Retain target attribute
+ for targets that support versioning.
+ * target.def (supports_function_versions): New hook.
+ * cp/class.c (add_method): Remove calls
+ to DECL_FUNCTION_SPECIFIC_TARGET.
+ * config/i386/i386.c (ix86_function_versions): Use target string
+ to check for function versions instead of target flags.
+ * (ix86_supports_function_versions): New function.
+ * (is_function_default_version): Check target string.
+ * TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS: New macro.
+
+2012-12-27 Steven Bosscher <steven@gcc.gnu.org>
+
+ * cgraph.c (verify_cgraph_node): Don't allocate/free visited_nodes set.
+
+2012-12-25 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR target/53789
+ * config/pa/pa.md (movsi): Reject expansion of TLS symbol references
+ after reload starts.
+
+2012-12-22 Jan Hubicka <jh@suse.cz>
+
+ PR lto/54728
+ * cgraph.h (symtab_real_symbol_p): Drop code looking for external functions.
+ * lto-streamer-out.c (output_symbol_p): New function.
+ (produce_symtab) Use it.
+
+2012-12-21 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/55355
+ * tree-sra.c (type_internals_preclude_sra_p): Also check that
+ bit_position is small enough to fit a single HOST_WIDE_INT.
+
+2012-12-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * rtlanal.c (volatile_insn_p): Delete commented out code.
+ (side_effects_p): Likewise.
+ (may_trap_p_1) <UNSPEC_VOLATILE>: Return 1 again.
+ * target.def (unspec_may_trap_p): Adjust comment.
+ * targhooks.c (default_unspec_may_trap_p): Don't handle UNSPEC_VOLATILE.
+ * config/ia64/ia64.c (ia64_unspec_may_trap_p): Adjust to above change.
+
+2012-12-21 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR middle-end/55775
+ * lra-assigns.c (improve_inheritance): Do nothing after
+ LRA_MAX_INHERITANCE_PASSES pass.
+ * lra-constraints.c (MAX_CONSTRAINT_ITERATION_NUMBER): Rename to
+ LRA_MAX_CONSTRAINT_ITERATION_NUMBER. Move to lra-int.h.
+ (MAX_INHERITANCE_PASSES): Rename to LRA_MAX_INHERITANCE_PASSES.
+ Move to lra-int.h.
+ * lra-int.h (LRA_MAX_CONSTRAINT_ITERATION_NUMBER): Move from
+ lra-constraints.c.
+ (LRA_MAX_INHERITANCE_PASSES): Ditto.
+
+2012-12-21 Steve Ellcey <sellcey@mips.com>
+
+ PR bootstrap/54128
+ * ira.c (build_insn_chain): Check only NONDEBUG instructions for
+ register usage.
+
+2012-12-21 David Edelsohn <dje.gcc@gmail.com>
+
+ * varasm.c (bss_initializer_p): Remove static.
+ * output.h (bss_initializer_p): Declare.
+ * xcoffout.c (xcoff_tbss_section_name): Define.
+ * xcoffout.h (xcoff_tbss_section_name): Declare.
+ * config/rs6000/xcoff.h (TARGET_ENCODE_SECTION_INFO): Define.
+ (ASM_OUTPUT_TLS_COMMON): Merge strings.
+ * config/rs6000/rs6000.c (tls_private_data_section): New.
+ (output_toc): Only output CSECT decoration for TLS.
+ Output appropriate CSECT for data or bss.
+ (rs6000_xcoff_asm_init_sections) Define tls_private_data_section.
+ (rs6000_xcoff_select_section): Handle TLS bss and private data.
+ (rs6000_xcoff_file_start): Generate xcoff_tbss_section_name.
+ (rs6000_xcoff_encode_section_info): Strip SYMBOL_FLAG_HAS_BLOCK_INFO
+ from native TLS symbols.
+
+2012-12-21 Richard Biener <rguenther@suse.de>
+
+ PR rtl-optimization/52996
+ * cprop.c (bypass_block): When loops are to be preserved
+ do not bypass loop headers. Revert earlier kludge to remove
+ loops when doing that.
+
+2012-12-21 Richard Biener <rguenther@suse.de>
+
+ PR bootstrap/54659
+ * system.h: Include gmp.h.
+ * tree-ssa-loop-niter.c: Do not include gmp.h here.
+ * double-int.h: Likewise.
+ * realmpfr.h: Likewise.
+
2012-12-21 Greta Yorsh <Greta.Yorsh@arm.com>
* config/arm/cortex-a7.md: New file.
@@ -12762,18 +12976,14 @@
2012-08-22 H.J. Lu <hongjiu.lu@intel.com>
* doc/invoke.texi: Document -mlong-double-64/-mlong-double-80.
-
* config/i386/i386.c (flag_opts): Add -mlong-double-64.
(TARGET_HAS_BIONIC): Default long double to 64-bit for Bionic.
-
* config/i386/i386.h (LONG_DOUBLE_TYPE_SIZE): Use 64 if
TARGET_LONG_DOUBLE_64 is true.
(LIBGCC2_LONG_DOUBLE_TYPE_SIZE): New macro.
(WIDEST_HARDWARE_FP_SIZE): Defined to 80.
-
* config/i386/i386.opt (mlong-double-80): New option.
(mlong-double-64): Likewise.
-
* config/i386/i386-c.c (ix86_target_macros): Define
__LONG_DOUBLE_64__ for TARGET_LONG_DOUBLE_64.
@@ -13185,7 +13395,6 @@
PR target/20020
* config/i386/i386.c (ix86_member_type_forces_blk): New function.
(TARGET_MEMBER_TYPE_FORCES_BLK): New macro.
-
* config/i386/i386.h (MAX_FIXED_MODE_SIZE): New macro.
2012-08-17 Marc Glisse <marc.glisse@inria.fr>
@@ -13198,31 +13407,21 @@
* stor-layout.c (compute_record_mode): Replace
MEMBER_TYPE_FORCES_BLK with targetm.member_type_forces_blk.
(layout_type): Likewise.
-
* system.h: Poison MEMBER_TYPE_FORCES_BLK.
-
* target.def (member_type_forces_blk): New target hook.
-
* targhooks.c (default_member_type_forces_blk): New.
* targhooks.h (default_member_type_forces_blk): Likewise.
-
* doc/tm.texi.in (MEMBER_TYPE_FORCES_BLK): Removed.
(TARGET_MEMBER_TYPE_FORCES_BLK): New hook.
* doc/tm.texi: Regenerated.
-
* config/ia64/hpux.h (MEMBER_TYPE_FORCES_BLK): Removed.
-
* config/ia64/ia64.c (ia64_member_type_forces_blk): New function.
(TARGET_MEMBER_TYPE_FORCES_BLK): New macro.
-
* config/rs6000/rs6000.c (TARGET_MEMBER_TYPE_FORCES_BLK): New macro.
(rs6000_member_type_forces_blk): New function.
-
* config/rs6000/rs6000.h (MEMBER_TYPE_FORCES_BLK): Removed.
-
* config/xtensa/xtensa.c (xtensa_member_type_forces_blk): New function.
(TARGET_MEMBER_TYPE_FORCES_BLK): New macro.
-
* config/xtensa/xtensa.h (MEMBER_TYPE_FORCES_BLK): Removed.
2012-08-17 Diego Novillo <dnovillo@google.com>
@@ -15899,20 +16098,15 @@
PR middle-end/53865
* ipa-inline-analysis.c (inline_free_summary): Return if
inline_edge_summary_vec is NULL.
-
* ipa-split.c (execute_split_functions): Check if a function
is inlinable only if inline_edge_summary_vec != NULL.
-
* ipa.c (symtab_remove_unreachable_nodes): Restore
cgraph_propagate_frequency call when something was changed.
(free_inline_summary): New function.
(pass_ipa_free_inline_summary): New pass.
-
* passes.c (init_optimization_passes): Add
pass_ipa_free_inline_summary before pass_ipa_tree_profile.
-
* timevar.def (TV_IPA_FREE_INLINE_SUMMARY): New.
-
* tree-pass.h (pass_ipa_free_inline_summary): New.
2012-08-02 Richard Earnshaw <rearnsha@arm.com>
@@ -20788,10 +20982,8 @@
PR target/53383
* doc/invoke.texi: Add a warning for -mpreferred-stack-boundary=3.
-
* config/i386/i386.c (ix86_option_override_internal): Allow
-mpreferred-stack-boundary=3 for 64-bit if SSE is disabled.
-
* config/i386/i386.h (MIN_STACK_BOUNDARY): Set to 64 for 64-bit
if SSE is disabled.
@@ -22384,7 +22576,7 @@
2012-06-04 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/53555
- * config/i386/i386.c (ix86_sched_reorder) Skip debug insns.
+ * config/i386/i386.c (ix86_sched_reorder): Skip debug insns.
2012-06-04 Jason Merrill <jason@redhat.com>
@@ -28675,7 +28867,6 @@
PR rtl-optimization/52876
* emit-rtl.c (set_reg_attrs_from_value): Handle arbitrary value.
Don't call mark_reg_pointer for incompatible pointer sign extension.
-
* reginfo.c (reg_scan_mark_refs): Call set_reg_attrs_from_value
directly.
@@ -29524,21 +29715,17 @@
* config/i386/biarch64.h (TARGET_64BIT_DEFAULT): Add
OPTION_MASK_ABI_64.
-
* config/i386/gnu-user64.h (SPEC_64): Support TARGET_BI_ARCH == 2.
(SPEC_X32): Likewise.
(MULTILIB_DEFAULTS): Likewise.
-
* config/i386/i386.c (isa_opts): Remove -m64.
(ix86_target_string): Properly handle -m32/-m64/-mx32.
(ix86_option_override_internal): Properly
set OPTION_MASK_ISA_64BIT and OPTION_MASK_ISA_X32 as well as
handle -m32, -m64 and -mx32.
-
* config/i386/i386.h (TARGET_X32): Replace OPTION_ISA_X32
with OPTION_ABI_X32. Moved after TARGET_LP64.
(TARGET_LP64): Changed to OPTION_ABI_64.
-
* config/i386/i386.opt (m64): Replace ISA_64BIT with ABI_64.
(mx32): Replace ISA_X32 with ABI_X32.
@@ -30236,7 +30423,6 @@
if Pmode != word_mode.
(legitimize_tls_address): Call gen_tls_initial_exec_x32 if
Pmode == SImode for TARGET_X32.
-
* config/i386/i386.md (UNSPEC_TLS_IE_X32): New.
(tls_initial_exec_x32): Likewise.
@@ -30543,14 +30729,10 @@
PR target/50797
* config/i386/i386-opts.h (pmode): New.
-
* config/i386/i386.c (ix86_option_override_internal): Properly
check and set ix86_pmode.
-
* config/i386/i386.h (Pmode): Check ix86_pmode instead of TARGET_64BIT.
-
* config/i386/i386.opt (maddress-mode=): New.
-
* doc/invoke.texi: Document -maddress-mode=short|long for x86.
2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
@@ -30925,7 +31107,6 @@
and ix86_gen_tls_local_dynamic_base_64.
(legitimize_tls_address): Use ix86_gen_tls_global_dynamic_64 and
ix86_gen_tls_local_dynamic_base_64.
-
* config/i386/i386.md (*tls_global_dynamic_64): Renamed to ...
(*tls_global_dynamic_64_<mode>): This.
(tls_global_dynamic_64): Renamed to ...
@@ -30942,7 +31123,6 @@
instead of TARGET_64BIT, to set ix86_gen_add3, ix86_gen_sub3,
ix86_gen_one_cmpl2, ix86_gen_andsp, ix86_gen_allocate_stack_worker,
ix86_gen_adjust_stack_and_probe and ix86_gen_probe_stack_range.
-
* config/i386/sse.md (sse3_monitor64): Renamed to ...
(sse3_monitor64_<mode>): This.
@@ -31207,7 +31387,6 @@
if Pmode != word_mode.
(legitimize_tls_address): Call gen_tls_initial_exec_x32 if
Pmode == SImode for TARGET_X32.
-
* config/i386/i386.md (UNSPEC_TLS_IE_X32): New.
(tls_initial_exec_x32): Likewise.
@@ -31333,7 +31512,6 @@
word_mode.
(ix86_split_to_parts): Use word_mode with PUT_MODE for push.
(ix86_split_long_move): Likewise.
-
* config/i386/i386.md (W): New.
(*push<mode>2_prologue): Replace :P with :W.
(*pop<mode>1): Likewise.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 5b7b28b8e3e..5cf5bfb717e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20121221
+20130103
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 0c902a825ff..d9e91b6826e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,451 @@
+2013-01-02 Richard Biener <rguenther@suse.de>
+
+ PR bootstrap/55784
+ * gcc-interface/Makefile.in: Add $(GMPINC) to includes.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * exp_intr.adb (Expand_Dispatching_Constructor_Call): Remove
+ side effects from Tag_Arg early, doing it too late may cause a
+ crash due to inconsistent Parent link.
+ * sem_ch8.adb, einfo.ads: Minor reformatting.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * einfo.ads, einfo.adb (Has_Independent_Components): New flag.
+ * freeze.adb (Size_Known): We do not know the size of a packed
+ record if it has atomic components, by reference type components,
+ or independent components.
+ * sem_prag.adb (Analyze_Pragma, case Independent_Components): Set new
+ flag Has_Independent_Components.
+
+2013-01-02 Yannick Moy <moy@adacore.com>
+
+ * opt.ads (Warn_On_Suspicious_Contract): Set to True by default.
+ * usage.adb (Usage): Update usage message.
+
+2013-01-02 Pascal Obry <obry@adacore.com>
+
+ * adaint.c (__gnat_is_module_name_supported): New constant.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb (Check_Array_Type): Reject an attribute reference on an
+ array whose component type does not have a completion.
+
+2013-01-02 Geert Bosch <bosch@adacore.com>
+
+ * a-nllcef.ads, a-nlcefu.ads, a-nscefu.ads: Make Pure.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * par_sco.adb: Minor reformatting.
+
+2013-01-02 Javier Miranda <miranda@adacore.com>
+
+ * sem_aggr.adb (Resolve_Array_Aggregate): Remove dead code.
+
+2013-01-02 Olivier Hainque <hainque@adacore.com>
+
+ * a-exctra.ads (Get_PC): New function.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch8.adb: Minor reformatting.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch7.adb: Minor reformatting.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * freeze.adb (Check_Component_Storage_Order): Do not crash on
+ _Tag component.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * gnat1drv.adb, targparm.adb, targparm.ads: Minor name change: add
+ On_Target to Atomic_Sync_Default.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.adb (Warn_On_Known_Condition): Suppress warning for
+ comparison of attribute result with constant
+ * a-ststio.adb, s-direio.adb, s-rannum.adb: Remove unnecessary pragma
+ Warnings (Off, "..");
+
+2013-01-02 Yannick Moy <moy@adacore.com>
+
+ * sem_prag.ads: Minor correction of comment.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * par_sco.adb (Traverse_Package_Declaration): The first
+ declaration in a nested package is dominated by the preceding
+ declaration in the enclosing scope.
+
+2013-01-02 Pascal Obry <obry@adacore.com>
+
+ * adaint.c, adaint.h (__gnat_get_module_name): Return the actual
+ module containing a given address.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch3.adb: Minor reformatting.
+
+2013-01-02 Pascal Obry <obry@adacore.com>
+
+ * cstreams.c (__gnat_ftell64): New routine. Use _ftelli64 on
+ Win64 and default to ftell on other platforms.
+ (__gnat_fsek64): Likewise.
+ * i-cstrea.ads: Add fssek64 and ftell64 specs.
+ * s-crtl.ads: Likewise.
+ * a-ststio.adb, s-direio.adb (Size): Use 64 bits version when required.
+ (Set_Position): Likewise.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * par_sco.adb: Generate X SCOs for default expressions in
+ subprogram body stubs. Do not generate any SCO for package,
+ task, or protected body stubs.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb: Further improvement to ASIS mode for anonymous
+ access to protected subprograms.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * par_sco.adb, vms_data.ads: Minor reformatting.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * par_sco.adb (Traverse_Declarations_Or_Statement): Function
+ form, returning value of Current_Dominant upon exit, for chaining
+ purposes.
+ (Traverse_Declarations_Or_Statement.Traverse_One, case
+ N_Block_Statement): First statement is dominated by last declaration.
+ (Traverse_Subprogram_Or_Task_Body): Ditto.
+ (Traverse_Package_Declaration): First private
+ declaration is dominated by last visible declaration.
+ (Traverse_Sync_Definition): Ditto.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * gnat_rm.texi: Restrict the requirement for Scalar_Storage_Order
+ matching Bit_Order to record types only, since array types do not
+ have a Bit_Order.
+
+2013-01-02 Vincent Celier <celier@adacore.com>
+
+ * gnat_ugn.texi: Remove documentation of -gnateO, which is an
+ internal switch.
+ * usage.adb: Indicate that -gnateO is an internal switch.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * par_sco.adb: Add SCO generation for task types and single
+ task declarations.
+ * get_scos.adb: When adding an instance table entry for a
+ non-nested instantiation, make sure the Enclosing_Instance is
+ correctly set to 0.
+
+2013-01-02 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_attr.adb (Analyze_Attribute): Skip the special _Parent
+ scope generated for subprogram inlining purposes while trying
+ to locate the enclosing function.
+ * sem_prag.adb (Analyze_Pragma): Preanalyze the boolean
+ expression of pragma Postcondition when the pragma comes from
+ source and appears inside a subprogram body.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * switch-c.adb, fe.h, back_end.adb: Enable generation of instantiation
+ information in debug info unconditionally when using -fdump-scos,
+ instead of relying on a separate command line switch -fdebug-instances.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb: Additional refinement of predicate.
+
+2013-01-02 Vincent Celier <celier@adacore.com>
+
+ * vms_data.ads: Remove incorrect spaces at end of descriptions
+ of qualifiers for single switch.
+
+2013-01-02 Ben Brosgol <brosgol@adacore.com>
+
+ * gnat_rm.texi: Minor edits / wordsmithing in section on pragma
+ Check_Float_Overflow.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * sprint.adb (Sprint_Node_Actual): Do not add extra parens for
+ a conditional expression (CASE or IF expression) that already
+ has parens. Also omit ELSE keyword for an IF expression without
+ an ELSE part.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * gnat1drv.adb (Adjust_Global_Switches): Adjust back-end
+ flag_debug_instances here, after front-end switches have been
+ processed.
+
+2013-01-02 Vincent Celier <celier@adacore.com>
+
+ * usage.adb: Minor reformatting.
+
+2013-01-02 Arnaud Charlet <charlet@adacore.com>
+
+ * opt.ads: Fix typo.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * par_sco.adb: Generate P decision SCOs for SPARK pragmas
+ Assume and Loop_Invariant.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * vms_data.ads: Add entry for Float_Check_Valid (-gnateF).
+ * ug_words: Add entry for Float_Check_Overflow.
+ * usage.adb: Minor reformatting.
+ * gnat_ugn.texi: Add documentation for -gnateF (Check_Float_Overflow).
+
+2013-01-02 Vincent Celier <celier@adacore.com>
+
+ * gnat_ugn.texi: Add documentation for switches -gnateA, -gnated,
+ -gnateO=, -gnatet and -gnateV.
+ * ug_words: Add qualifiers equivalent to -gnateA, -gnated,
+ -gnatet and -gnateV.
+ * usage.adb: Add lines for -gnatea, -gnateO and -gnatez.
+ * vms_data.ads: Add new compiler qualifiers /ALIASING_CHECK
+ (-gnateA), /DISABLE_ATOMIC_SYNCHRONIZATION (-gnated),
+ /PARAMETER_VALIDITY_CHECK (-gnateV) and /TARGET_DEPENDENT_INFO
+ (-gnatet).
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * checks.adb (Apply_Scalar_Range_Check): Implement Check_Float_Overflow.
+ * opt.ads, opt.adb: Handle flags Check_Float_Overflow[_Config].
+ * par-prag.adb: Add dummy entry for pragma Check_Float_Overflow.
+ * sem_prag.adb: Implement pragma Check_Float_Overflow.
+ * snames.ads-tmpl: Add entries for pragma Check_Float_Overflow.
+ * switch-c.adb: Recognize -gnateF switch.
+ * tree_io.ads: Update ASIS version number.
+ * gnat_rm.texi: Add documentation of pragma Check_Float_Overflow.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * checks.adb, exp_ch4.adb, exp_ch6.adb, exp_ch7.adb, exp_ch9.adb,
+ exp_disp.adb, exp_dist.adb, exp_intr.adb, exp_prag.adb, exp_util.adb,
+ freeze.adb, gnat1drv.adb, inline.adb, layout.adb, lib-xref.adb,
+ par-ch10.adb, par-labl.adb, par-load.adb, par-util.adb, restrict.adb,
+ sem_ch13.adb, sem_ch4.adb, sem_ch6.adb, sem_dim.adb, sem_elab.adb,
+ sem_res.adb, sem_warn.adb, sinput-l.adb: Add tags to warning messages.
+ * sem_ch6.ads, warnsw.ads, opt.ads: Minor comment updates.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * err_vars.ads: Minor comment fix.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb: Refine predicate.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * errout.ads: Minor comment fixes.
+ * opt.ads: Minor comment additions.
+ * exp_aggr.adb: Add tags to warning messages
+ * exp_ch11.adb, exp_ch3.adb, exp_ch4.adb, exp_util.adb, sem_aggr.adb,
+ sem_attr.adb, sem_case.adb, sem_cat.adb, sem_ch3.adb, sem_ch4.adb,
+ sem_ch5.adb, sem_disp.adb, sem_dist.adb, sem_elab.adb, sem_eval.adb,
+ sem_intr.adb, sem_mech.adb, sem_prag.adb, sem_res.adb, sem_util.adb,
+ sem_warn.adb: Add tags to warning messages
+
+2013-01-02 Doug Rupp <rupp@adacore.com>
+
+ * init.c [VMS] Remove subtest on reason mask for ACCVIO that is a C_E.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb: Recover source name for renamed packagea.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * errout.adb (Set_Msg_Insertion_Warning): Correct typo causing
+ tests to fail if insertion sequence is at end of message string.
+ * opt.ads: Minor comment fixes and additions.
+ * sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_ch10.adb, sem_ch11.adb,
+ sem_ch12.adb, sem_ch13.adb: Add tags to warning messages.
+ * sem_ch6.ads, sem_ch6.adb (Cannot_Inline): Deal with warning message
+ tags. Add tags to warning messages.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * err_vars.ads (Warning_Doc_Switch): New flag.
+ * errout.adb (Error_Msg_Internal): Implement new warning flag
+ doc tag stuff (Set_Msg_Insertion_Warning): New procedure.
+ * errout.ads: Document new insertion sequences ?? ?x? ?.x?
+ * erroutc.adb (Output_Msg_Text): Handle ?? and ?x? warning doc
+ tag stuff.
+ * erroutc.ads (Warning_Msg_Char): New variable.
+ (Warn_Chr): New field in error message object.
+ * errutil.adb (Error_Msg): Set Warn_Chr in error message object.
+ * sem_ch13.adb: Minor reformatting.
+ * warnsw.adb: Add handling for -gnatw.d and -gnatw.D
+ (Warning_Doc_Switch).
+ * warnsw.ads: Add handling of -gnatw.d/.D switches (warning
+ doc tag).
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * opt.ads: Minor reformatting.
+
+2013-01-02 Doug Rupp <rupp@adacore.com>
+
+ * init.c: Reorganize VMS section.
+ (scan_condtions): New function for scanning condition tables.
+ (__gnat_handle_vms_condtion): Use actual exception name for imported
+ exceptions vice IMPORTED_EXCEPTION.
+ Move condition table scanning into separate function. Move formerly
+ special handled conditions to system condition table. Use SYS$PUTMSG
+ output to fill exception message field for formally special handled
+ condtions, in particular HPARITH to provide more clues about cause and
+ location then raised from the translated image.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch13.adb (Analyze_Aspect_Specifications): For a Pre/Post
+ aspect that applies to a library subprogram, prepend corresponding
+ pragma to the Pragmas_After list, in order for split AND THEN
+ sections to be processed in the expected order.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * exp_prag.adb (Expand_Pragma_Check): The statements generated
+ for the pragma must have the sloc of the pragma, not the
+ sloc of the condition, otherwise this creates anomalies in the
+ generated debug information that confuse coverage analysis tools.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch13.adb: Minor reformatting.
+
+2013-01-02 Arnaud Charlet <charlet@adacore.com>
+
+ * g-excact.ads (Core_Dump): Clarify that this subprogram does
+ not dump cores under Windows.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Primitive_Renamed_Operation): The prefixed
+ view of a subprogram has convention Intrnnsic, and a renaming
+ of a prefixed view cannot be the prefix of an Access attribute.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * restrict.adb: Minor reformatting.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * exp_prag.adb: Minor reformatting.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Get_Associated_Node): If the node is an
+ identifier that denotes an unconstrained array in an object
+ declaration, it is rewritten as the name of an anonymous
+ subtype whose bounds are given by the initial expression in the
+ declaration. When checking whether that identifier is global
+ reference, use the original node, not the local generated subtype.
+
+2013-01-02 Olivier Hainque <hainque@adacore.com>
+
+ * tracebak.c: Revert previous change, incomplete.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch13.adb (Analyze_Aspect_Specifications): If the aspect
+ appears on a subprogram body that acts as a spec, place the
+ corresponding pragma in the declarations of the body, so that
+ e.g. pre/postcondition checks can be generated appropriately.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb: Minor reformatting and code reorganization.
+
+2013-01-02 Vincent Celier <celier@adacore.com>
+
+ * switch-m.adb (Normalize_Compiler_Switches): Record the
+ complete switch -fstack-check=specific instead of its shorter
+ alias -fstack-check.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Derive_Subprogram): Enforce RM 6.3.1 (8):
+ if the derived type is a tagged generic formal type with
+ unknown discriminants, the inherited operation has convention
+ Intrinsic. As such, the 'Access attribute cannot be applied to it.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * sem_attr.adb: Minor reformatting.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * par_sco.adb: Add SCO generation for S of protected types and
+ single protected object declarations.
+
+2013-01-02 Robert Dewar <dewar@adacore.com>
+
+ * sem_eval.adb, osint.ads: Minor reformatting.
+
+2013-01-02 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma): Check the legality of pragma Assume.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * sem_eval.adb (Compile_Time_Compare): For static operands, we
+ can perform a compile time comparison even if in preanalysis mode.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * par_sco.adb (SCO_Record): Always use
+ Traverse_Declarations_Or_Statements to process the library level
+ declaration, so that SCOs are properly generated for its aspects.
+
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * scos.ads (In_Decision): Add missing entry for 'a'.
+ * sem_prag.adb (Analyze_Pragma, case pragma Check): Omit
+ call to Set_SCO_Pragma_Enabled for Invariant and Predicate.
+ * sem_ch13.adb: Minor comment update.
+
+2012-12-21 Ed Schonberg <schonberg@adacore.com>
+
+ PR ada/53737
+ * sem_ch12.adb (Analyze_Associations): Do not check the legality of
+ actuals for RACW types if this is an internal instantiation for a formal
+ package with defaulted parameters.
+
+2012-12-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * adaint.c: Move directive around.
+ * argv.c: Likewise.
+ * cio.c: Likewise.
+ * cstreams.c: Likewise.
+ * env.c: Likewise.
+ * exit.c: Likewise.
+ * init.c: Likewise.
+ * initialize.c: Likewise.
+ * raise.c: Likewise.
+ * seh_init.c: Likewise.
+ * targext.c: Likewise.
+
2012-12-15 Eric Botcazou <ebotcazou@adacore.com>
Martin Ettl <ettl.martin@gmx.de>
diff --git a/gcc/ada/a-exctra.ads b/gcc/ada/a-exctra.ads
index 8bb956248f8..6d22c1c746b 100644
--- a/gcc/ada/a-exctra.ads
+++ b/gcc/ada/a-exctra.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2012, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -39,12 +39,12 @@ with System.Traceback_Entries;
package Ada.Exceptions.Traceback is
- package TBE renames System.Traceback_Entries;
+ package STBE renames System.Traceback_Entries;
subtype Code_Loc is System.Address;
-- Code location in executing program
- type Tracebacks_Array is array (Positive range <>) of TBE.Traceback_Entry;
+ type Tracebacks_Array is array (Positive range <>) of STBE.Traceback_Entry;
-- A traceback array is an array of traceback entries
function Tracebacks (E : Exception_Occurrence) return Tracebacks_Array;
@@ -52,4 +52,9 @@ package Ada.Exceptions.Traceback is
-- occurrence, and returns it formatted in the manner required for
-- processing in GNAT.Traceback. See g-traceb.ads for further details.
+ function Get_PC (TBE : STBE.Traceback_Entry) return Code_Loc
+ renames STBE.PC_For;
+ -- Returns the code address held by a given traceback entry, typically the
+ -- address of a call instruction.
+
end Ada.Exceptions.Traceback;
diff --git a/gcc/ada/a-nlcefu.ads b/gcc/ada/a-nlcefu.ads
index 9e985dfca6a..083f6a990e3 100644
--- a/gcc/ada/a-nlcefu.ads
+++ b/gcc/ada/a-nlcefu.ads
@@ -19,3 +19,4 @@ with Ada.Numerics.Generic_Complex_Elementary_Functions;
package Ada.Numerics.Long_Complex_Elementary_Functions is
new Ada.Numerics.Generic_Complex_Elementary_Functions
(Ada.Numerics.Long_Complex_Types);
+pragma Pure (Ada.Numerics.Long_Complex_Elementary_Functions);
diff --git a/gcc/ada/a-nllcef.ads b/gcc/ada/a-nllcef.ads
index 2867e1dbb03..7a1f4b17ac3 100644
--- a/gcc/ada/a-nllcef.ads
+++ b/gcc/ada/a-nllcef.ads
@@ -19,3 +19,4 @@ with Ada.Numerics.Generic_Complex_Elementary_Functions;
package Ada.Numerics.Long_Long_Complex_Elementary_Functions is
new Ada.Numerics.Generic_Complex_Elementary_Functions
(Ada.Numerics.Long_Long_Complex_Types);
+pragma Pure (Ada.Numerics.Long_Long_Complex_Elementary_Functions);
diff --git a/gcc/ada/a-nscefu.ads b/gcc/ada/a-nscefu.ads
index ac89d051c87..0d0aa154878 100644
--- a/gcc/ada/a-nscefu.ads
+++ b/gcc/ada/a-nscefu.ads
@@ -19,3 +19,4 @@ with Ada.Numerics.Generic_Complex_Elementary_Functions;
package Ada.Numerics.Short_Complex_Elementary_Functions is
new Ada.Numerics.Generic_Complex_Elementary_Functions
(Ada.Numerics.Short_Complex_Types);
+pragma Pure (Ada.Numerics.Short_Complex_Elementary_Functions);
diff --git a/gcc/ada/a-ststio.adb b/gcc/ada/a-ststio.adb
index c5da571495f..ef8af62d206 100644
--- a/gcc/ada/a-ststio.adb
+++ b/gcc/ada/a-ststio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -367,7 +367,11 @@ package body Ada.Streams.Stream_IO is
FIO.Append_Set (AP (File));
if File.Mode = FCB.Append_File then
- File.Index := Count (ftell (File.Stream)) + 1;
+ if Standard'Address_Size = 64 then
+ File.Index := Count (ftell64 (File.Stream)) + 1;
+ else
+ File.Index := Count (ftell (File.Stream)) + 1;
+ end if;
end if;
File.Last_Op := Op_Other;
@@ -379,10 +383,18 @@ package body Ada.Streams.Stream_IO is
procedure Set_Position (File : File_Type) is
use type System.CRTL.long;
+ use type System.CRTL.ssize_t;
+ R : int;
begin
- if fseek (File.Stream,
- System.CRTL.long (File.Index) - 1, SEEK_SET) /= 0
- then
+ if Standard'Address_Size = 64 then
+ R := fseek64 (File.Stream,
+ System.CRTL.ssize_t (File.Index) - 1, SEEK_SET);
+ else
+ R := fseek (File.Stream,
+ System.CRTL.long (File.Index) - 1, SEEK_SET);
+ end if;
+
+ if R /= 0 then
raise Use_Error;
end if;
end Set_Position;
@@ -402,7 +414,11 @@ package body Ada.Streams.Stream_IO is
raise Device_Error;
end if;
- File.File_Size := Stream_Element_Offset (ftell (File.Stream));
+ if Standard'Address_Size = 64 then
+ File.File_Size := Stream_Element_Offset (ftell64 (File.Stream));
+ else
+ File.File_Size := Stream_Element_Offset (ftell (File.Stream));
+ end if;
end if;
return Count (File.File_Size);
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index eab3ea5fbae..d95b6615b77 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -34,10 +34,6 @@
package Osint. Many of the subprograms in OS_Lib import standard
library calls directly. This file contains all other routines. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef __vxworks
/* No need to redefine exit here. */
@@ -107,6 +103,10 @@ extern "C" {
#include "version.h"
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if defined (__MINGW32__)
#if defined (RTX)
@@ -2960,6 +2960,54 @@ __gnat_locate_exec_on_path (char *exec_name)
#endif
}
+/* __gnat_get_module_name returns the module name (executable or shared
+ library) in which the code at addr is. This is used to properly
+ report the symbolic tracebacks. If the module cannot be located
+ it returns the empty string. The returned value must not be freed.
+
+ If this routine is fully implemented the value for
+ __gnat_is_module_name_supported should be set to 1. */
+
+char *__gnat_get_module_name (void *addr ATTRIBUTE_UNUSED)
+{
+ extern char **gnat_argv;
+
+#ifdef _WIN32
+ static char lpFilename[MAX_PATH];
+ HMODULE hModule;
+
+ lpFilename[0] = '\0';
+
+ /* Get the module handle in which the code running at the specified
+ address is contained. */
+
+ if (GetModuleHandleEx
+ (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, addr, &hModule) == FALSE)
+ return __gnat_locate_exec_on_path (gnat_argv[0]);
+
+ /* Get the corresponding module full path name. We really want the
+ standard ASCII version of this routine as the name is passed to
+ the BFD library. */
+
+ if (GetModuleFileNameA (hModule, lpFilename, MAX_PATH) == 0)
+ return __gnat_locate_exec_on_path (gnat_argv[0]);
+
+ return lpFilename;
+
+#else
+ /* On all other platforms we just return the full path name of the
+ main executable. */
+
+ return __gnat_locate_exec_on_path (gnat_argv[0]);
+#endif
+}
+
+#ifdef _WIN32
+int __gnat_is_module_name_supported = 1;
+#else
+int __gnat_is_module_name_supported = 0;
+#endif
+
#ifdef VMS
/* These functions are used to translate to and from VMS and Unix syntax
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 7956e27a709..217ce6c48e1 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -186,6 +186,7 @@ extern int __gnat_portable_wait (int *);
extern char *__gnat_locate_exec (char *, char *);
extern char *__gnat_locate_exec_on_path (char *);
extern char *__gnat_locate_regular_file (char *, char *);
+extern char *__gnat_get_module_name (void *);
extern void __gnat_maybe_glob_args (int *, char ***);
extern void __gnat_os_exit (int);
extern char *__gnat_get_libraries_from_registry (void);
diff --git a/gcc/ada/argv.c b/gcc/ada/argv.c
index 29f163972ea..430404e3aa4 100644
--- a/gcc/ada/argv.c
+++ b/gcc/ada/argv.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2011, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2012, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -42,10 +42,6 @@
main program, and these routines are accessed from the
Ada.Command_Line.Environment package. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef IN_RTS
#include "tconfig.h"
#include "tsystem.h"
@@ -57,6 +53,10 @@ extern "C" {
#include "adaint.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* argc and argv of the main program are saved under gnat_argc and gnat_argv,
envp of the main program is saved under gnat_envp. */
diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb
index aa398ff31c3..f23230ecf9d 100644
--- a/gcc/ada/back_end.adb
+++ b/gcc/ada/back_end.adb
@@ -244,11 +244,6 @@ package body Back_End is
elsif Switch_Chars (First .. Last) = "fdump-scos" then
Opt.Generate_SCO := True;
-
- -- Back end switch -fdebug-instances also enables instance table
- -- SCO generation.
-
- elsif Switch_Chars (First .. Last) = "fdebug-instances" then
Opt.Generate_SCO_Instance_Table := True;
end if;
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 8a73e25e6c9..38b6ea4d7e2 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -599,10 +599,10 @@ package body Checks is
begin
if Address_Clause_Overlay_Warnings then
Error_Msg_FE
- ("?specified address for& may be inconsistent with alignment ",
+ ("?o?specified address for& may be inconsistent with alignment",
Aexp, E);
Error_Msg_FE
- ("\?program execution may be erroneous (RM 13.3(27))",
+ ("\?o?program execution may be erroneous (RM 13.3(27))",
Aexp, E);
Set_Address_Warning_Posted (AC);
end if;
@@ -1624,7 +1624,7 @@ package body Checks is
exit;
else
Apply_Compile_Time_Constraint_Error
- (N, "incorrect value for discriminant&?",
+ (N, "incorrect value for discriminant&??",
CE_Discriminant_Check_Failed, Ent => Discr);
return;
end if;
@@ -2467,9 +2467,9 @@ package body Checks is
elsif S = Predicate_Function (Typ) then
Error_Msg_N
("predicate check includes a function call that "
- & "requires a predicate check?", Parent (N));
+ & "requires a predicate check??", Parent (N));
Error_Msg_N
- ("\this will result in infinite recursion?", Parent (N));
+ ("\this will result in infinite recursion??", Parent (N));
Insert_Action (N,
Make_Raise_Storage_Error (Sloc (N),
Reason => SE_Infinite_Recursion));
@@ -2558,7 +2558,7 @@ package body Checks is
procedure Bad_Value is
begin
Apply_Compile_Time_Constraint_Error
- (Expr, "value not in range of}?", CE_Range_Check_Failed,
+ (Expr, "value not in range of}??", CE_Range_Check_Failed,
Ent => Target_Typ,
Typ => Target_Typ);
end Bad_Value;
@@ -2692,15 +2692,24 @@ package body Checks is
Is_Unconstrained_Subscr_Ref :=
Is_Subscr_Ref and then not Is_Constrained (Arr_Typ);
- -- Always do a range check if the source type includes infinities and
- -- the target type does not include infinities. We do not do this if
- -- range checks are killed.
+ -- Special checks for floating-point type
- if Is_Floating_Point_Type (S_Typ)
- and then Has_Infinities (S_Typ)
- and then not Has_Infinities (Target_Typ)
- then
- Enable_Range_Check (Expr);
+ if Is_Floating_Point_Type (S_Typ) then
+
+ -- Always do a range check if the source type includes infinities and
+ -- the target type does not include infinities. We do not do this if
+ -- range checks are killed.
+
+ if Has_Infinities (S_Typ)
+ and then not Has_Infinities (Target_Typ)
+ then
+ Enable_Range_Check (Expr);
+
+ -- Always do a range check for operators if option set
+
+ elsif Check_Float_Overflow and then Nkind (Expr) in N_Op then
+ Enable_Range_Check (Expr);
+ end if;
end if;
-- Return if we know expression is definitely in the range of the target
@@ -2780,15 +2789,14 @@ package body Checks is
-- only if this is not a conversion between integer and real types.
if not Is_Unconstrained_Subscr_Ref
- and then
- Is_Discrete_Type (S_Typ) = Is_Discrete_Type (Target_Typ)
+ and then Is_Discrete_Type (S_Typ) = Is_Discrete_Type (Target_Typ)
and then
(In_Subrange_Of (S_Typ, Target_Typ, Fixed_Int)
or else
Is_In_Range (Expr, Target_Typ,
Assume_Valid => True,
- Fixed_Int => Fixed_Int,
- Int_Real => Int_Real))
+ Fixed_Int => Fixed_Int,
+ Int_Real => Int_Real))
then
return;
@@ -2800,12 +2808,18 @@ package body Checks is
Bad_Value;
return;
+ -- Floating-point case
-- In the floating-point case, we only do range checks if the type is
-- constrained. We definitely do NOT want range checks for unconstrained
-- types, since we want to have infinities
elsif Is_Floating_Point_Type (S_Typ) then
- if Is_Constrained (S_Typ) then
+
+ -- Normally, we only do range checks if the type is constrained. We do
+ -- NOT want range checks for unconstrained types, since we want to have
+ -- infinities. Override this decision in Check_Float_Overflow mode.
+
+ if Is_Constrained (S_Typ) or else Check_Float_Overflow then
Enable_Range_Check (Expr);
end if;
@@ -2904,7 +2918,7 @@ package body Checks is
and then Entity (Cond) = Standard_True
then
Apply_Compile_Time_Constraint_Error
- (Ck_Node, "wrong length for array of}?",
+ (Ck_Node, "wrong length for array of}??",
CE_Length_Check_Failed,
Ent => Target_Typ,
Typ => Target_Typ);
@@ -2984,7 +2998,7 @@ package body Checks is
if Nkind (Ck_Node) = N_Range then
Apply_Compile_Time_Constraint_Error
- (Low_Bound (Ck_Node), "static range out of bounds of}?",
+ (Low_Bound (Ck_Node), "static range out of bounds of}??",
CE_Range_Check_Failed,
Ent => Target_Typ,
Typ => Target_Typ);
@@ -3539,11 +3553,11 @@ package body Checks is
case Check is
when Access_Check =>
Error_Msg_N
- ("Constraint_Error may be raised (access check)?",
+ ("Constraint_Error may be raised (access check)??",
Parent (Nod));
when Division_Check =>
Error_Msg_N
- ("Constraint_Error may be raised (zero divide)?",
+ ("Constraint_Error may be raised (zero divide)??",
Parent (Nod));
when others =>
@@ -3552,10 +3566,10 @@ package body Checks is
if K = N_Op_And then
Error_Msg_N -- CODEFIX
- ("use `AND THEN` instead of AND?", P);
+ ("use `AND THEN` instead of AND??", P);
else
Error_Msg_N -- CODEFIX
- ("use `OR ELSE` instead of OR?", P);
+ ("use `OR ELSE` instead of OR??", P);
end if;
-- If not short-circuited, we need the check
@@ -3694,7 +3708,8 @@ package body Checks is
Apply_Compile_Time_Constraint_Error
(N => Expression (N),
- Msg => "(Ada 2005) null-excluding objects must be initialized?",
+ Msg =>
+ "(Ada 2005) null-excluding objects must be initialized??",
Reason => CE_Null_Not_Allowed);
end if;
@@ -3712,7 +3727,7 @@ package body Checks is
Apply_Compile_Time_Constraint_Error
(N => Expr,
Msg => "(Ada 2005) null not allowed " &
- "in null-excluding components?",
+ "in null-excluding components??",
Reason => CE_Null_Not_Allowed);
when N_Object_Declaration =>
@@ -3726,7 +3741,7 @@ package body Checks is
Apply_Compile_Time_Constraint_Error
(N => Expr,
Msg => "(Ada 2005) null not allowed " &
- "in null-excluding formals?",
+ "in null-excluding formals??",
Reason => CE_Null_Not_Allowed);
when others =>
@@ -5649,22 +5664,24 @@ package body Checks is
-- First special case, if the source type is already within the range
-- of the target type, then no check is needed (probably we should have
-- stopped Do_Range_Check from being set in the first place, but better
- -- late than later in preventing junk code!
-
- -- We do NOT apply this if the source node is a literal, since in this
- -- case the literal has already been labeled as having the subtype of
- -- the target.
+ -- late than never in preventing junk code!
if In_Subrange_Of (Source_Type, Target_Type)
+
+ -- We do NOT apply this if the source node is a literal, since in this
+ -- case the literal has already been labeled as having the subtype of
+ -- the target.
+
and then not
- (Nkind (N) = N_Integer_Literal
- or else
- Nkind (N) = N_Real_Literal
+ (Nkind_In (N, N_Integer_Literal, N_Real_Literal, N_Character_Literal)
or else
- Nkind (N) = N_Character_Literal
- or else
- (Is_Entity_Name (N)
- and then Ekind (Entity (N)) = E_Enumeration_Literal))
+ (Is_Entity_Name (N)
+ and then Ekind (Entity (N)) = E_Enumeration_Literal))
+
+ -- Also do not apply this for floating-point if Check_Float_Overflow
+
+ and then not
+ (Is_Floating_Point_Type (Source_Type) and Check_Float_Overflow)
then
return;
end if;
@@ -5674,9 +5691,7 @@ package body Checks is
-- reference). Such a double evaluation is always a potential source
-- of inefficiency, and is functionally incorrect in the volatile case.
- if not Is_Entity_Name (N)
- or else Treat_As_Volatile (Entity (N))
- then
+ if not Is_Entity_Name (N) or else Treat_As_Volatile (Entity (N)) then
Force_Evaluation (N);
end if;
@@ -6466,7 +6481,7 @@ package body Checks is
if not Inside_Init_Proc then
Apply_Compile_Time_Constraint_Error
(N,
- "null value not allowed here?",
+ "null value not allowed here??",
CE_Access_Check_Failed);
else
Insert_Action (N,
@@ -8251,12 +8266,12 @@ package body Checks is
if L_Length > R_Length then
Add_Check
(Compile_Time_Constraint_Error
- (Wnode, "too few elements for}?", T_Typ));
+ (Wnode, "too few elements for}??", T_Typ));
elsif L_Length < R_Length then
Add_Check
(Compile_Time_Constraint_Error
- (Wnode, "too many elements for}?", T_Typ));
+ (Wnode, "too many elements for}??", T_Typ));
end if;
-- The comparison for an individual index subtype
@@ -8802,13 +8817,13 @@ package body Checks is
Add_Check
(Compile_Time_Constraint_Error
(Low_Bound (Ck_Node),
- "static value out of range of}?", T_Typ));
+ "static value out of range of}??", T_Typ));
else
Add_Check
(Compile_Time_Constraint_Error
(Wnode,
- "static range out of bounds of}?", T_Typ));
+ "static range out of bounds of}??", T_Typ));
end if;
end if;
@@ -8817,13 +8832,13 @@ package body Checks is
Add_Check
(Compile_Time_Constraint_Error
(High_Bound (Ck_Node),
- "static value out of range of}?", T_Typ));
+ "static value out of range of}??", T_Typ));
else
Add_Check
(Compile_Time_Constraint_Error
(Wnode,
- "static range out of bounds of}?", T_Typ));
+ "static range out of bounds of}??", T_Typ));
end if;
end if;
end if;
@@ -8944,13 +8959,13 @@ package body Checks is
Add_Check
(Compile_Time_Constraint_Error
(Ck_Node,
- "static value out of range of}?", T_Typ));
+ "static value out of range of}??", T_Typ));
else
Add_Check
(Compile_Time_Constraint_Error
(Wnode,
- "static value out of range of}?", T_Typ));
+ "static value out of range of}??", T_Typ));
end if;
end if;
@@ -9132,7 +9147,7 @@ package body Checks is
then
Add_Check
(Compile_Time_Constraint_Error
- (Wnode, "value out of range of}?", T_Typ));
+ (Wnode, "value out of range of}??", T_Typ));
else
Evolve_Or_Else
diff --git a/gcc/ada/cio.c b/gcc/ada/cio.c
index 2564e4d3c47..ac23519ae9b 100644
--- a/gcc/ada/cio.c
+++ b/gcc/ada/cio.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2011, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2012, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -29,10 +29,6 @@
* *
****************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef IN_RTS
#include "tconfig.h"
#include "tsystem.h"
@@ -44,6 +40,10 @@ extern "C" {
#include "adaint.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Don't use macros on GNU/Linux since they cause incompatible changes between
glibc 2.0 and 2.1 */
#ifdef linux
diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c
index 894b056eaba..25a867a768f 100644
--- a/gcc/ada/cstreams.c
+++ b/gcc/ada/cstreams.c
@@ -31,10 +31,6 @@
/* Routines required for implementing routines in Interfaces.C.Streams. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef __vxworks
#include "vxWorks.h"
#endif
@@ -50,6 +46,10 @@ extern "C" {
#include "adaint.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef VMS
#include <unixlib.h>
#endif
@@ -257,6 +257,35 @@ __gnat_full_name (char *nam, char *buffer)
return buffer;
}
+#ifdef _WIN64
+ /* On Windows 64 we want to use the fseek/fteel supporting large files. This
+ issue is due to the fact that a long on Win64 is still a 32 bits value */
+__int64
+__gnat_ftell64 (FILE *stream)
+{
+ return _ftelli64 (stream);
+}
+
+int
+__gnat_fseek64 (FILE *stream, __int64 offset, int origin)
+{
+ return _fseeki64 (stream, offset, origin);
+}
+
+#else
+long
+__gnat_ftell64 (FILE *stream)
+{
+ return ftell (stream);
+}
+
+int
+__gnat_fseek64 (FILE *stream, long offset, int origin)
+{
+ return fseek (stream, offset, origin);
+}
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index 212849791fb..34f61b9f25e 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -285,6 +285,7 @@ package body Einfo is
-- Checks_May_Be_Suppressed Flag31
-- Kill_Elaboration_Checks Flag32
-- Kill_Range_Checks Flag33
+ -- Has_Independent_Components Flag34
-- Is_Class_Wide_Equivalent_Type Flag35
-- Referenced_As_LHS Flag36
-- Is_Known_Non_Null Flag37
@@ -527,7 +528,6 @@ package body Einfo is
-- Has_Anonymous_Master Flag253
-- Is_Implementation_Defined Flag254
- -- (unused) Flag34
-- (unused) Flag201
-----------------------
@@ -1338,6 +1338,12 @@ package body Einfo is
return Flag251 (Id);
end Has_Implicit_Dereference;
+ function Has_Independent_Components (Id : E) return B is
+ begin
+ pragma Assert (Is_Object (Id) or else Is_Type (Id));
+ return Flag34 (Id);
+ end Has_Independent_Components;
+
function Has_Inheritable_Invariants (Id : E) return B is
begin
pragma Assert (Is_Type (Id));
@@ -3853,6 +3859,12 @@ package body Einfo is
Set_Flag251 (Id, V);
end Set_Has_Implicit_Dereference;
+ procedure Set_Has_Independent_Components (Id : E; V : B := True) is
+ begin
+ pragma Assert (Is_Object (Id) or else Is_Type (Id));
+ Set_Flag34 (Id, V);
+ end Set_Has_Independent_Components;
+
procedure Set_Has_Inheritable_Invariants (Id : E; V : B := True) is
begin
pragma Assert (Is_Type (Id));
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index e4af8cf23fb..1b412e51d88 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -528,7 +528,7 @@ package Einfo is
--
-- Setting this False in all cases corresponds to the traditional back
-- end strategy, where all access-to-subprogram types are represented the
--- same way, independent of the Convention. See also
+-- same way, independent of the Convention. For further details, see also
-- Always_Compatible_Rep in Targparm.
--
-- Efficiency note: On targets that use dynamically generated
@@ -536,11 +536,11 @@ package Einfo is
-- subprograms, whereas True generally favors efficiency of nested
-- ones. On other targets, this flag has little or no effect on
-- efficiency. The front end should take this into account. In
--- particular, pragma Favor_Top_Level gives a hint that the flag should
--- be False.
+-- particular, pragma Favor_Top_Level gives a hint that the flag
+-- should be False.
--
-- Note: We considered using Convention-C for this purpose, but we need
--- this separate flag, because Convention-C implies that for
+-- this separate flag, because Convention-C implies that in the case of
-- P'[Unrestricted_]Access, P also have convention C. Sometimes we want
-- to have Can_Use_Internal_Rep False for an access type, but allow P to
-- have convention Ada.
@@ -902,11 +902,11 @@ package Einfo is
-- DTC_Entity (Node16)
-- Defined in function and procedure entities. Set to Empty unless
-- the subprogram is dispatching in which case it references the
--- Dispatch Table pointer Component. That is to say the component _tag
--- for regular Ada tagged types, for CPP_Class types and their
--- descendants this field points to the component entity in the record
--- that is the Vtable pointer for the Vtable containing the entry that
--- references the subprogram.
+-- Dispatch Table pointer Component. For regular Ada tagged this, this
+-- is the _Tag component. For CPP_Class types and their descendants,
+-- this points to the component entity in the record that holds the
+-- Vtable pointer for the Vtable containing the entry referencing the
+-- subprogram.
-- DT_Entry_Count (Uint15)
-- Defined in E_Component entities. Only used for component marked
@@ -1547,6 +1547,19 @@ package Einfo is
-- Implicit_Dereference. Set also on the discriminant named in the aspect
-- clause, to simplify type resolution.
+-- Has_Independent_Components (Flag34)
+-- Defined in objects and types. Set if the aspect Independent_Components
+-- applies (as set by coresponding pragma or aspect specification).
+
+-- Has_Inheritable_Invariants (Flag248)
+-- Defined in all type entities. Set True in private types from which one
+-- or more Invariant'Class aspects will be inherited if a another type is
+-- derived from the type (i.e. those types which have an Invariant'Class
+-- aspect, or which inherit one or more Invariant'Class aspects). Also
+-- set in the corresponding full types. Note that it might be the full
+-- type which has inheritable invariants, and in this case the flag will
+-- also be set in the private type.
+
-- Has_Initial_Value (Flag219)
-- Defined in entities for variables and out parameters. Set if there
-- is an explicit initial value expression in the declaration of the
@@ -1573,15 +1586,6 @@ package Einfo is
-- the invariant procedure entity, to distinguish it among entries in the
-- Subprograms_For_Type.
--- Has_Inheritable_Invariants (Flag248)
--- Defined in all type entities. Set True in private types from which one
--- or more Invariant'Class aspects will be inherited if a another type is
--- derived from the type (i.e. those types which have an Invariant'Class
--- aspect, or which inherit one or more Invariant'Class aspects). Also
--- set in the corresponding full types. Note that it might be the full
--- type which has inheritable invariants, and in this case the flag will
--- also be set in the private type.
-
-- Has_Machine_Radix_Clause (Flag83)
-- Defined in decimal types and subtypes, set if a Machine_Radix
-- representation clause is present. This flag is used to detect
@@ -4902,6 +4906,7 @@ package Einfo is
-- Has_Controlled_Component (Flag43) (base type only)
-- Has_Default_Aspect (Flag39) (base type only)
-- Has_Discriminants (Flag5)
+ -- Has_Independent_Components (Flag34) (base type only)
-- Has_Inheritable_Invariants (Flag248)
-- Has_Invariants (Flag232)
-- Has_Non_Standard_Rep (Flag75) (base type only)
@@ -5102,6 +5107,7 @@ package Einfo is
-- Has_Atomic_Components (Flag86)
-- Has_Biased_Representation (Flag139)
-- Has_Completion (Flag26) (constants only)
+ -- Has_Independent_Components (Flag34) (base type only)
-- Has_Thunks (Flag228) (constants only)
-- Has_Size_Clause (Flag29)
-- Has_Up_Level_Access (Flag215)
@@ -5769,6 +5775,7 @@ package Einfo is
-- Has_Alignment_Clause (Flag46)
-- Has_Atomic_Components (Flag86)
-- Has_Biased_Representation (Flag139)
+ -- Has_Independent_Components (Flag34) (base type only)
-- Has_Initial_Value (Flag219)
-- Has_Size_Clause (Flag29)
-- Has_Up_Level_Access (Flag215)
@@ -6154,6 +6161,7 @@ package Einfo is
function Has_Gigi_Rep_Item (Id : E) return B;
function Has_Homonym (Id : E) return B;
function Has_Implicit_Dereference (Id : E) return B;
+ function Has_Independent_Components (Id : E) return B;
function Has_Inheritable_Invariants (Id : E) return B;
function Has_Initial_Value (Id : E) return B;
function Has_Interrupt_Handler (Id : E) return B;
@@ -6745,6 +6753,7 @@ package Einfo is
procedure Set_Has_Gigi_Rep_Item (Id : E; V : B := True);
procedure Set_Has_Homonym (Id : E; V : B := True);
procedure Set_Has_Implicit_Dereference (Id : E; V : B := True);
+ procedure Set_Has_Independent_Components (Id : E; V : B := True);
procedure Set_Has_Inheritable_Invariants (Id : E; V : B := True);
procedure Set_Has_Initial_Value (Id : E; V : B := True);
procedure Set_Has_Invariants (Id : E; V : B := True);
@@ -7424,6 +7433,7 @@ package Einfo is
pragma Inline (Has_Gigi_Rep_Item);
pragma Inline (Has_Homonym);
pragma Inline (Has_Implicit_Dereference);
+ pragma Inline (Has_Independent_Components);
pragma Inline (Has_Inheritable_Invariants);
pragma Inline (Has_Initial_Value);
pragma Inline (Has_Invariants);
@@ -7870,6 +7880,7 @@ package Einfo is
pragma Inline (Set_Has_Gigi_Rep_Item);
pragma Inline (Set_Has_Homonym);
pragma Inline (Set_Has_Implicit_Dereference);
+ pragma Inline (Set_Has_Independent_Components);
pragma Inline (Set_Has_Inheritable_Invariants);
pragma Inline (Set_Has_Initial_Value);
pragma Inline (Set_Has_Invariants);
diff --git a/gcc/ada/env.c b/gcc/ada/env.c
index 78328dc371b..800d20748ec 100644
--- a/gcc/ada/env.c
+++ b/gcc/ada/env.c
@@ -29,10 +29,6 @@
* *
****************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef IN_RTS
#include "tconfig.h"
#include "tsystem.h"
@@ -76,6 +72,10 @@ extern "C" {
#include "system.h"
#endif /* IN_RTS */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if defined (__APPLE__)
#include <crt_externs.h>
#endif
diff --git a/gcc/ada/err_vars.ads b/gcc/ada/err_vars.ads
index 64d68e0630c..ecfbc54ce81 100644
--- a/gcc/ada/err_vars.ads
+++ b/gcc/ada/err_vars.ads
@@ -88,6 +88,12 @@ package Err_Vars is
-- Source_Reference line, then this is initialized to No_Source_File,
-- to force an initial reference to the real source file name.
+ Warning_Doc_Switch : Boolean := False;
+ -- If this is set True, then the ??/?x?/?x? sequences in error messages
+ -- are active (see errout.ads for details). If this switch is False, then
+ -- these sequences are ignored (i.e. simply equivalent to a single ?). The
+ -- -gnatw.d switch sets this flag True, -gnatw.D sets this flag False.
+
----------------------------------------
-- Error Message Insertion Parameters --
----------------------------------------
@@ -133,7 +139,9 @@ package Err_Vars is
-- before any call to Error_Msg_xxx with a < insertion character present.
-- Setting is irrelevant if no < insertion character is present. Note
-- that it is not necessary to reset this after using it, since the proper
- -- procedure is always to set it before issuing such a message.
+ -- procedure is always to set it before issuing such a message. Note that
+ -- the warning documentation tag is always [enabled by default] in the
+ -- case where this flag is True.
Error_Msg_String : String (1 .. 4096);
Error_Msg_Strlen : Natural;
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 6f450200ef9..052b43f8dab 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -821,9 +821,7 @@ package body Errout is
-- with a comma space separator (eliminating a possible (style) or
-- info prefix).
- if Error_Msg_Line_Length /= 0
- and then Continuation
- then
+ if Error_Msg_Line_Length /= 0 and then Continuation then
Cur_Msg := Errors.Last;
declare
@@ -894,12 +892,24 @@ package body Errout is
Msg_Buffer (M .. Msglen);
Newl := Newl + Msglen - M + 1;
Errors.Table (Cur_Msg).Text := new String'(Newm (1 .. Newl));
+
+ -- Update warning msg flag and message doc char if needed
+
+ if Is_Warning_Msg then
+ if not Errors.Table (Cur_Msg).Warn then
+ Errors.Table (Cur_Msg).Warn := True;
+ Errors.Table (Cur_Msg).Warn_Chr := Warning_Msg_Char;
+
+ elsif Warning_Msg_Char /= ' ' then
+ Errors.Table (Cur_Msg).Warn_Chr := Warning_Msg_Char;
+ end if;
+ end if;
end;
return;
end if;
- -- Otherwise build error message object for new message
+ -- Here we build a new error object
Errors.Append
((Text => new String'(Msg_Buffer (1 .. Msglen)),
@@ -911,6 +921,7 @@ package body Errout is
Line => Get_Physical_Line_Number (Sptr),
Col => Get_Column_Number (Sptr),
Warn => Is_Warning_Msg,
+ Warn_Chr => Warning_Msg_Char,
Style => Is_Style_Msg,
Serious => Is_Serious_Error,
Uncond => Is_Unconditional_Msg,
@@ -2655,6 +2666,40 @@ package body Errout is
C : Character; -- Current character
P : Natural; -- Current index;
+ procedure Set_Msg_Insertion_Warning;
+ -- Deal with ? ?? ?x? ?X? insertion sequences
+
+ -------------------------------
+ -- Set_Msg_Insertion_Warning --
+ -------------------------------
+
+ procedure Set_Msg_Insertion_Warning is
+ begin
+ Warning_Msg_Char := ' ';
+
+ if P <= Text'Last and then Text (P) = '?' then
+ if Warning_Doc_Switch then
+ Warning_Msg_Char := '?';
+ end if;
+
+ P := P + 1;
+
+ elsif P + 1 <= Text'Last
+ and then (Text (P) in 'a' .. 'z'
+ or else
+ Text (P) in 'A' .. 'Z')
+ and then Text (P + 1) = '?'
+ then
+ if Warning_Doc_Switch then
+ Warning_Msg_Char := Text (P);
+ end if;
+
+ P := P + 2;
+ end if;
+ end Set_Msg_Insertion_Warning;
+
+ -- Start of processing for Set_Msg_Text
+
begin
Manual_Quote_Mode := False;
Is_Unconditional_Msg := False;
@@ -2725,10 +2770,16 @@ package body Errout is
Is_Unconditional_Msg := True;
when '?' =>
- null; -- already dealt with
+ Set_Msg_Insertion_Warning;
when '<' =>
- null; -- already dealt with
+
+ -- If tagging of messages is enabled, and this is a warning,
+ -- then it is treated as being [enabled by default].
+
+ if Error_Msg_Warn and Warning_Doc_Switch then
+ Warning_Msg_Char := '?';
+ end if;
when '|' =>
null; -- already dealt with
diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads
index 0f746d989cc..f8d1fdadb26 100644
--- a/gcc/ada/errout.ads
+++ b/gcc/ada/errout.ads
@@ -59,6 +59,12 @@ package Errout is
Error_Msg_Exception : exception renames Err_Vars.Error_Msg_Exception;
-- Exception raised if Raise_Exception_On_Error is true
+ Warning_Doc_Switch : Boolean renames Err_Vars.Warning_Doc_Switch;
+ -- If this is set True, then the ??/?x?/?X? sequences in error messages
+ -- are active (see errout.ads for details). If this switch is False, then
+ -- these sequences are ignored (i.e. simply equivalent to a single ?). The
+ -- -gnatw.d switch sets this flag True, -gnatw.D sets this flag False.
+
-----------------------------------
-- Suppression of Error Messages --
-----------------------------------
@@ -275,6 +281,24 @@ package Errout is
-- messages, and the usual style is to include it, since it makes it
-- clear that the continuation is part of a warning message.
+ -- Insertion character ?? (two question marks)
+ -- Like ?, but if the flag Warn_Doc_Switch is True, adds the string
+ -- "[enabled by default]" at the end of the warning message. In the
+ -- case of continuations, use this in each continuation message.
+
+ -- Insertion character ?x? (warning with switch)
+ -- Like ?, but if the flag Warn_Doc_Switch is True, adds the string
+ -- "[-gnatwx]" at the end of the warning message. x is a lower case
+ -- letter. In the case of continuations, use this on each continuation
+ -- message.
+
+ -- Insertion character ?X? (warning with dot switch)
+ -- Like ?, but if the flag Warn_Doc_Switch is True, adds the string
+ -- "[-gnatw.x]" at the end of the warning message. X is an upper case
+ -- letter corresponding to the lower case letter x in the message. In
+ -- the case of continuations, use this on each continuation
+ -- message.
+
-- Insertion character < (Less Than: conditional warning message)
-- The character < appearing anywhere in a message is used for a
-- conditional error message. If Error_Msg_Warn is True, then the
diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb
index 56a4e3547fb..35f71a4a7cf 100644
--- a/gcc/ada/erroutc.adb
+++ b/gcc/ada/erroutc.adb
@@ -442,13 +442,37 @@ package body Erroutc is
Length : Nat;
-- Maximum total length of lines
- Txt : constant String_Ptr := Errors.Table (E).Text;
- Len : constant Natural := Txt'Length;
- Ptr : Natural;
- Split : Natural;
- Start : Natural;
+ Text : constant String_Ptr := Errors.Table (E).Text;
+ Warn : constant Boolean := Errors.Table (E).Warn;
+ Warn_Chr : constant Character := Errors.Table (E).Warn_Chr;
+ Warn_Tag : String_Ptr;
+ Ptr : Natural;
+ Split : Natural;
+ Start : Natural;
begin
+ -- Add warning doc tag if needed
+
+ if Warn and then Warn_Chr /= ' ' then
+ if Warn_Chr = '?' then
+ Warn_Tag := new String'(" [enabled by default]");
+
+ elsif Warn_Chr in 'a' .. 'z' then
+ Warn_Tag := new String'(" [-gnatw" & Warn_Chr & ']');
+
+ else pragma Assert (Warn_Chr in 'A' .. 'Z');
+ Warn_Tag :=
+ new String'(" [-gnatw."
+ & Character'Val (Character'Pos (Warn_Chr) + 32)
+ & ']');
+ end if;
+
+ else
+ Warn_Tag := new String'("");
+ end if;
+
+ -- Set error message line length
+
if Error_Msg_Line_Length = 0 then
Length := Nat'Last;
else
@@ -457,87 +481,95 @@ package body Erroutc is
Max := Integer (Length - Column + 1);
- -- For warning message, add "warning: " unless msg starts with "info: "
+ declare
+ Txt : constant String := Text.all & Warn_Tag.all;
+ Len : constant Natural := Txt'Length;
- if Errors.Table (E).Warn then
- if Len < 6 or else Txt (Txt'First .. Txt'First + 5) /= "info: " then
- Write_Str ("warning: ");
- Max := Max - 9;
- end if;
+ begin
+ -- For warning, add "warning: " unless msg starts with "info: "
- -- No prefix needed for style message, since "(style)" is there already
+ if Errors.Table (E).Warn then
+ if Len < 6
+ or else Txt (Txt'First .. Txt'First + 5) /= "info: "
+ then
+ Write_Str ("warning: ");
+ Max := Max - 9;
+ end if;
- elsif Errors.Table (E).Style then
- null;
+ -- No prefix needed for style message, "(style)" is there already
- -- All other cases, add "error: "
+ elsif Errors.Table (E).Style then
+ null;
- elsif Opt.Unique_Error_Tag then
- Write_Str ("error: ");
- Max := Max - 7;
- end if;
+ -- All other cases, add "error: "
- -- Here we have to split the message up into multiple lines
+ elsif Opt.Unique_Error_Tag then
+ Write_Str ("error: ");
+ Max := Max - 7;
+ end if;
- Ptr := 1;
- loop
- -- Make sure we do not have ludicrously small line
+ -- Here we have to split the message up into multiple lines
- Max := Integer'Max (Max, 20);
+ Ptr := 1;
+ loop
+ -- Make sure we do not have ludicrously small line
- -- If remaining text fits, output it respecting LF and we are done
+ Max := Integer'Max (Max, 20);
- if Len - Ptr < Max then
- for J in Ptr .. Len loop
- if Txt (J) = ASCII.LF then
- Write_Eol;
- Write_Spaces (Offs);
- else
- Write_Char (Txt (J));
- end if;
- end loop;
+ -- If remaining text fits, output it respecting LF and we are done
- return;
+ if Len - Ptr < Max then
+ for J in Ptr .. Len loop
+ if Txt (J) = ASCII.LF then
+ Write_Eol;
+ Write_Spaces (Offs);
+ else
+ Write_Char (Txt (J));
+ end if;
+ end loop;
+
+ return;
-- Line does not fit
- else
- Start := Ptr;
+ else
+ Start := Ptr;
- -- First scan forward looking for a hard end of line
+ -- First scan forward looking for a hard end of line
- for Scan in Ptr .. Ptr + Max - 1 loop
- if Txt (Scan) = ASCII.LF then
- Split := Scan - 1;
- Ptr := Scan + 1;
- goto Continue;
- end if;
- end loop;
+ for Scan in Ptr .. Ptr + Max - 1 loop
+ if Txt (Scan) = ASCII.LF then
+ Split := Scan - 1;
+ Ptr := Scan + 1;
+ goto Continue;
+ end if;
+ end loop;
- -- Otherwise scan backwards looking for a space
+ -- Otherwise scan backwards looking for a space
- for Scan in reverse Ptr .. Ptr + Max - 1 loop
- if Txt (Scan) = ' ' then
- Split := Scan - 1;
- Ptr := Scan + 1;
- goto Continue;
- end if;
- end loop;
+ for Scan in reverse Ptr .. Ptr + Max - 1 loop
+ if Txt (Scan) = ' ' then
+ Split := Scan - 1;
+ Ptr := Scan + 1;
+ goto Continue;
+ end if;
+ end loop;
- -- If we fall through, no space, so split line arbitrarily
+ -- If we fall through, no space, so split line arbitrarily
- Split := Ptr + Max - 1;
- Ptr := Split + 1;
- end if;
+ Split := Ptr + Max - 1;
+ Ptr := Split + 1;
+ end if;
- <<Continue>>
- if Start <= Split then
- Write_Line (Txt (Start .. Split));
- Write_Spaces (Offs);
- end if;
+ <<Continue>>
+ if Start <= Split then
+ Write_Line (Txt (Start .. Split));
+ Write_Spaces (Offs);
+ end if;
- Max := Integer (Length - Column + 1);
- end loop;
+ Max := Integer (Length - Column + 1);
+ end loop;
+ end;
end Output_Msg_Text;
--------------------
@@ -846,9 +878,7 @@ package body Erroutc is
-- Remove upper case letter at end, again, we should not be getting
-- such names, and what we hope is that the remainder makes sense.
- if Name_Len > 1
- and then Name_Buffer (Name_Len) in 'A' .. 'Z'
- then
+ if Name_Len > 1 and then Name_Buffer (Name_Len) in 'A' .. 'Z' then
Name_Len := Name_Len - 1;
end if;
@@ -1217,11 +1247,13 @@ package body Erroutc is
and then (J = Msg'First or else Msg (J - 1) /= ''')
then
Is_Warning_Msg := True;
+ Warning_Msg_Char := ' ';
elsif Msg (J) = '<'
and then (J = Msg'First or else Msg (J - 1) /= ''')
then
Is_Warning_Msg := Error_Msg_Warn;
+ Warning_Msg_Char := ' ';
elsif Msg (J) = '|'
and then (J = Msg'First or else Msg (J - 1) /= ''')
diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads
index fc5cfa9fc21..4e38fbd30fb 100644
--- a/gcc/ada/erroutc.ads
+++ b/gcc/ada/erroutc.ads
@@ -50,6 +50,13 @@ package Erroutc is
Is_Warning_Msg : Boolean := False;
-- Set True to indicate if current message is warning message
+ Warning_Msg_Char : Character;
+ -- Warning character, valid only if Is_Warning_Msg is True
+ -- ' ' -- ? appeared on its own in message
+ -- '?' -- ?? appeared in message
+ -- 'x' -- ?x? appeared in message
+ -- 'X' -- ?x? appeared in message (X is upper case of x)
+
Is_Style_Msg : Boolean := False;
-- Set True to indicate if the current message is a style message
-- (i.e. a message whose text starts with the characters "(style)").
@@ -182,6 +189,13 @@ package Erroutc is
Warn : Boolean;
-- True if warning message (i.e. insertion character ? appeared)
+ Warn_Chr : Character;
+ -- Warning character, valid only if Warn is True
+ -- ' ' -- ? appeared on its own in message
+ -- '?' -- ?? appeared in message
+ -- 'x' -- ?x? appeared in message
+ -- 'X' -- ?x? appeared in message (X is upper case of x)
+
Style : Boolean;
-- True if style message (starts with "(style)")
diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb
index d6fa960a7a4..3a087caac66 100644
--- a/gcc/ada/errutil.adb
+++ b/gcc/ada/errutil.adb
@@ -211,6 +211,7 @@ package body Errutil is
Errors.Table (Cur_Msg).Col := Get_Column_Number (Sptr);
Errors.Table (Cur_Msg).Style := Is_Style_Msg;
Errors.Table (Cur_Msg).Warn := Is_Warning_Msg;
+ Errors.Table (Cur_Msg).Warn_Chr := Warning_Msg_Char;
Errors.Table (Cur_Msg).Serious := Is_Serious_Error;
Errors.Table (Cur_Msg).Uncond := Is_Unconditional_Msg;
Errors.Table (Cur_Msg).Msg_Cont := Continuation;
diff --git a/gcc/ada/exit.c b/gcc/ada/exit.c
index 47983e87ef7..7dc9105fb4e 100644
--- a/gcc/ada/exit.c
+++ b/gcc/ada/exit.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2011, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2012, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -29,10 +29,6 @@
* *
****************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef __alpha_vxworks
#include "vxWorks.h"
#endif
@@ -48,6 +44,10 @@ extern "C" {
#include "adaint.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Routine used by Ada.Command_Line.Set_Exit_Status. */
int gnat_exit_status = 0;
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 1d42bf89948..10a4a560984 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -431,13 +431,14 @@ package body Exp_Aggr is
if Present (Component_Associations (N)) then
Indx :=
First (Choices (First (Component_Associations (N))));
+
if Is_Entity_Name (Indx)
and then not Is_Type (Entity (Indx))
then
Error_Msg_N
- ("single component aggregate in non-static context?",
- Indx);
- Error_Msg_N ("\maybe subtype name was meant?", Indx);
+ ("single component aggregate in "
+ & "non-static context??", Indx);
+ Error_Msg_N ("\maybe subtype name was meant??", Indx);
end if;
end if;
@@ -3057,7 +3058,7 @@ package body Exp_Aggr is
elsif Expr_Value (Val1) /= Expr_Value (Val2) then
Apply_Compile_Time_Constraint_Error (Aggr,
- Msg => "incorrect value for discriminant&?",
+ Msg => "incorrect value for discriminant&??",
Reason => CE_Discriminant_Check_Failed,
Ent => D);
return False;
@@ -3767,7 +3768,7 @@ package body Exp_Aggr is
else
Error_Msg_N
- ("non-static object requires elaboration code?", N);
+ ("non-static object requires elaboration code??", N);
exit;
end if;
@@ -3775,7 +3776,7 @@ package body Exp_Aggr is
end loop;
if Present (Component_Associations (N)) then
- Error_Msg_N ("object requires elaboration code?", N);
+ Error_Msg_N ("object requires elaboration code??", N);
end if;
end if;
end;
diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index 56cf190e2a8..07b631de6eb 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -1005,8 +1005,8 @@ package body Exp_Ch11 is
then
Warn_No_Exception_Propagation_Active (Handler);
Error_Msg_N
- ("\?this handler can never be entered, and has been removed",
- Handler);
+ ("\?X?this handler can never be entered, "
+ & "and has been removed", Handler);
end if;
if No_Exception_Propagation_Active then
@@ -1808,10 +1808,10 @@ package body Exp_Ch11 is
if Configurable_Run_Time_Mode then
Error_Msg_NE
- ("\?& may call Last_Chance_Handler", N, E);
+ ("\?X?& may call Last_Chance_Handler", N, E);
else
Error_Msg_NE
- ("\?& may result in unhandled exception", N, E);
+ ("\?X?& may result in unhandled exception", N, E);
end if;
end if;
end;
@@ -2147,10 +2147,10 @@ package body Exp_Ch11 is
if Configurable_Run_Time_Mode then
Error_Msg_N
- ("\?Last_Chance_Handler will be called on exception", N);
+ ("\?X?Last_Chance_Handler will be called on exception", N);
else
Error_Msg_N
- ("\?execution may raise unhandled exception", N);
+ ("\?X?execution may raise unhandled exception", N);
end if;
end if;
end Warn_If_No_Propagation;
@@ -2162,7 +2162,7 @@ package body Exp_Ch11 is
procedure Warn_No_Exception_Propagation_Active (N : Node_Id) is
begin
Error_Msg_N
- ("?pragma Restrictions (No_Exception_Propagation) in effect", N);
+ ("?X?pragma Restrictions (No_Exception_Propagation) in effect", N);
end Warn_No_Exception_Propagation_Active;
end Exp_Ch11;
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 2434d5b7d95..096d14e7503 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -7132,7 +7132,7 @@ package body Exp_Ch3 is
if Is_Ancestor (RSPWS, Etype (Pool)) then
Error_Msg_N
- ("?subpool access type has deeper accessibility " &
+ ("??subpool access type has deeper accessibility " &
"level than pool", Def_Id);
Append_Freeze_Action (Def_Id,
@@ -7744,14 +7744,13 @@ package body Exp_Ch3 is
if Warning_Needed then
Error_Msg_N
- ("Objects of the type cannot be initialized " &
- "statically by default?",
- Parent (E));
+ ("Objects of the type cannot be initialized "
+ & "statically by default??", Parent (E));
end if;
end if;
else
- Error_Msg_N ("Object cannot be initialized statically?", E);
+ Error_Msg_N ("Object cannot be initialized statically??", E);
end if;
end if;
end Initialization_Warning;
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index b7ecd830048..446a310345b 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -3686,7 +3686,7 @@ package body Exp_Ch4 is
Kill_Dead_Code (Declaration_Node (Entity (High_Bound)));
Apply_Compile_Time_Constraint_Error
(N => Cnode,
- Msg => "concatenation result upper bound out of range?",
+ Msg => "concatenation result upper bound out of range??",
Reason => CE_Range_Check_Failed);
end Expand_Concatenate;
@@ -5501,9 +5501,10 @@ package body Exp_Ch4 is
-- actually eliminated the danger of optimization above.
if Overflow_Check_Mode not in Minimized_Or_Eliminated then
- Error_Msg_N ("?explicit membership test may be optimized away", N);
+ Error_Msg_N
+ ("??explicit membership test may be optimized away", N);
Error_Msg_N -- CODEFIX
- ("\?use ''Valid attribute instead", N);
+ ("\??use ''Valid attribute instead", N);
end if;
return;
@@ -5684,8 +5685,8 @@ package body Exp_Ch4 is
if Lcheck = LT or else Ucheck = GT then
if Warn1 then
- Error_Msg_N ("?range test optimized away", N);
- Error_Msg_N ("\?value is known to be out of range", N);
+ Error_Msg_N ("?c?range test optimized away", N);
+ Error_Msg_N ("\?c?value is known to be out of range", N);
end if;
Rewrite (N, New_Reference_To (Standard_False, Loc));
@@ -5698,8 +5699,8 @@ package body Exp_Ch4 is
elsif Lcheck in Compare_GE and then Ucheck in Compare_LE then
if Warn1 then
- Error_Msg_N ("?range test optimized away", N);
- Error_Msg_N ("\?value is known to be in range", N);
+ Error_Msg_N ("?c?range test optimized away", N);
+ Error_Msg_N ("\?c?value is known to be in range", N);
end if;
Rewrite (N, New_Reference_To (Standard_True, Loc));
@@ -5713,8 +5714,8 @@ package body Exp_Ch4 is
elsif Lcheck in Compare_GE then
if Warn2 and then not In_Instance then
- Error_Msg_N ("?lower bound test optimized away", Lo);
- Error_Msg_N ("\?value is known to be in range", Lo);
+ Error_Msg_N ("??lower bound test optimized away", Lo);
+ Error_Msg_N ("\??value is known to be in range", Lo);
end if;
Rewrite (N,
@@ -5730,8 +5731,8 @@ package body Exp_Ch4 is
elsif Ucheck in Compare_LE then
if Warn2 and then not In_Instance then
- Error_Msg_N ("?upper bound test optimized away", Hi);
- Error_Msg_N ("\?value is known to be in range", Hi);
+ Error_Msg_N ("??upper bound test optimized away", Hi);
+ Error_Msg_N ("\??value is known to be in range", Hi);
end if;
Rewrite (N,
@@ -5755,25 +5756,25 @@ package body Exp_Ch4 is
if Lcheck = LT or else Ucheck = GT then
Error_Msg_N
- ("?value can only be in range if it is invalid", N);
+ ("?c?value can only be in range if it is invalid", N);
-- Result is in range for valid value
elsif Lcheck in Compare_GE and then Ucheck in Compare_LE then
Error_Msg_N
- ("?value can only be out of range if it is invalid", N);
+ ("?c?value can only be out of range if it is invalid", N);
-- Lower bound check succeeds if value is valid
elsif Warn2 and then Lcheck in Compare_GE then
Error_Msg_N
- ("?lower bound check only fails if it is invalid", Lo);
+ ("?c?lower bound check only fails if it is invalid", Lo);
-- Upper bound check succeeds if value is valid
elsif Warn2 and then Ucheck in Compare_LE then
Error_Msg_N
- ("?upper bound check only fails for invalid values", Hi);
+ ("?c?upper bound check only fails for invalid values", Hi);
end if;
end if;
end;
@@ -9665,9 +9666,10 @@ package body Exp_Ch4 is
Reason => PE_Accessibility_Check_Failed));
Set_Etype (N, Target_Type);
- Error_Msg_N ("?accessibility check failure", N);
+ Error_Msg_N
+ ("??accessibility check failure", N);
Error_Msg_NE
- ("\?& will be raised at run time", N, Standard_Program_Error);
+ ("\??& will be raised at run time", N, Standard_Program_Error);
end Raise_Accessibility_Error;
----------------------
@@ -10632,7 +10634,7 @@ package body Exp_Ch4 is
end if;
-- Otherwise force evaluation unless Assignment_OK flag is set (this
- -- flag indicates ??? -- more comments needed here)
+ -- flag indicates ??? More comments needed here)
if Assignment_OK (N) then
null;
@@ -12061,7 +12063,7 @@ package body Exp_Ch4 is
if Constant_Condition_Warnings
and then Comes_From_Source (Original_Node (N))
then
- Error_Msg_N ("could replace by ""'=""?", N);
+ Error_Msg_N ("could replace by ""'=""?c?", N);
end if;
Op := N_Op_Eq;
@@ -12254,7 +12256,8 @@ package body Exp_Ch4 is
and then not Has_Warnings_Off (Etype (Left_Opnd (N)))
then
Error_Msg_N
- ("can never be greater than, could replace by ""'=""?", N);
+ ("can never be greater than, could replace by ""'=""?c?",
+ N);
Warning_Generated := True;
end if;
@@ -12279,7 +12282,7 @@ package body Exp_Ch4 is
and then not Has_Warnings_Off (Etype (Left_Opnd (N)))
then
Error_Msg_N
- ("can never be less than, could replace by ""'=""?", N);
+ ("can never be less than, could replace by ""'=""?c?", N);
Warning_Generated := True;
end if;
@@ -12312,11 +12315,11 @@ package body Exp_Ch4 is
then
if True_Result then
Error_Msg_N
- ("condition can only be False if invalid values present?",
+ ("condition can only be False if invalid values present??",
N);
elsif False_Result then
Error_Msg_N
- ("condition can only be True if invalid values present?",
+ ("condition can only be True if invalid values present??",
N);
end if;
end if;
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index c3cf8c8e70b..cd83d45bddc 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -1450,7 +1450,7 @@ package body Exp_Ch6 is
and then Is_Valued_Procedure (Scope (Formal))
then
Error_Msg_N
- ("by_reference actual may be misaligned?", Actual);
+ ("by_reference actual may be misaligned??", Actual);
return False;
else
@@ -1527,8 +1527,9 @@ package body Exp_Ch6 is
and then In_Open_Scopes (Entity (Actual))
then
if Scope (Subp) /= Entity (Actual) then
- Error_Msg_N ("operation outside protected type may not "
- & "call back its protected operations?", Actual);
+ Error_Msg_N
+ ("operation outside protected type may not "
+ & "call back its protected operations??", Actual);
end if;
Rewrite (Actual,
@@ -2002,8 +2003,7 @@ package body Exp_Ch6 is
(Loc, Sloc (Body_To_Inline (Spec)))
then
Error_Msg_NE
- ("cannot inline& (body not seen yet)?",
- Call_Node, Subp);
+ ("cannot inline& (body not seen yet)??", Call_Node, Subp);
else
declare
@@ -2122,7 +2122,7 @@ package body Exp_Ch6 is
if not In_Same_Extended_Unit (Call_Node, Subp) then
Cannot_Inline
- ("cannot inline& (body not seen yet)", Call_Node, Subp,
+ ("cannot inline& (body not seen yet)?", Call_Node, Subp,
Is_Serious => True);
elsif In_Open_Scopes (Subp) then
@@ -2136,7 +2136,7 @@ package body Exp_Ch6 is
and then Optimization_Level = 0
then
Error_Msg_N
- ("call to recursive subprogram cannot be inlined?",
+ ("call to recursive subprogram cannot be inlined?p?",
N);
-- Do not emit error compiling runtime packages
@@ -2145,7 +2145,7 @@ package body Exp_Ch6 is
(Unit_File_Name (Get_Source_Unit (Subp)))
then
Error_Msg_N
- ("call to recursive subprogram cannot be inlined?",
+ ("call to recursive subprogram cannot be inlined??",
N);
else
@@ -3790,7 +3790,8 @@ package body Exp_Ch6 is
and then In_Same_Extended_Unit (Sloc (Spec), Loc)
then
Cannot_Inline
- ("cannot inline& (body not seen yet)?", Call_Node, Subp);
+ ("cannot inline& (body not seen yet)?",
+ Call_Node, Subp);
end if;
end if;
end Inlined_Subprogram;
@@ -4644,7 +4645,7 @@ package body Exp_Ch6 is
-- subprograms this must be done explicitly.
if In_Open_Scopes (Subp) then
- Error_Msg_N ("call to recursive subprogram cannot be inlined?", N);
+ Error_Msg_N ("call to recursive subprogram cannot be inlined??", N);
Set_Is_Inlined (Subp, False);
return;
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 78ad5d27d67..72892828b61 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -148,6 +148,7 @@ package body Exp_Ch7 is
-- Set the field Node_To_Be_Wrapped of the current scope
-- ??? The entire comment needs to be rewritten
+ -- ??? which entire comment?
-----------------------------
-- Finalization Management --
@@ -3379,7 +3380,7 @@ package body Exp_Ch7 is
-- with the array case and non-discriminated record cases.
Error_Msg_N
- ("task/protected object in variant record will not be freed?", N);
+ ("task/protected object in variant record will not be freed??", N);
return New_List (Make_Null_Statement (Loc));
end if;
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 781de8695dc..49e7efeba6e 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -8812,9 +8812,7 @@ package body Exp_Ch9 is
if Present (Private_Declarations (Pdef)) then
Priv := First (Private_Declarations (Pdef));
-
while Present (Priv) loop
-
if Nkind (Priv) = N_Component_Declaration then
if not Static_Component_Size (Defining_Identifier (Priv)) then
@@ -8827,10 +8825,10 @@ package body Exp_Ch9 is
Check_Restriction (No_Implicit_Heap_Allocations, Priv);
elsif Restriction_Active (No_Implicit_Heap_Allocations) then
- Error_Msg_N ("component has non-static size?", Priv);
+ Error_Msg_N ("component has non-static size??", Priv);
Error_Msg_NE
("\creation of protected object of type& will violate"
- & " restriction No_Implicit_Heap_Allocations?",
+ & " restriction No_Implicit_Heap_Allocations??",
Priv, Prot_Typ);
end if;
end if;
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index 23235d8db51..c0872ade55f 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -8431,11 +8431,11 @@ package body Exp_Disp is
if Is_Controlled (Typ) then
if not Finalized then
Error_Msg_N
- ("controlled type has no explicit Finalize method?", Typ);
+ ("controlled type has no explicit Finalize method??", Typ);
elsif not Adjusted then
Error_Msg_N
- ("controlled type has no explicit Adjust method?", Typ);
+ ("controlled type has no explicit Adjust method??", Typ);
end if;
end if;
@@ -8754,7 +8754,7 @@ package body Exp_Disp is
if Has_CPP_Constructors (Typ)
and then No (Init_Proc (Typ))
then
- Error_Msg_N ("?default constructor must be imported from C++", Typ);
+ Error_Msg_N ("??default constructor must be imported from C++", Typ);
end if;
end Set_CPP_Constructors;
diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb
index 7c7fbd06f5f..8649fafff54 100644
--- a/gcc/ada/exp_dist.adb
+++ b/gcc/ada/exp_dist.adb
@@ -7417,6 +7417,7 @@ package body Exp_Dist is
-- If the current parameter has a dynamic constrained status, then
-- this status is transmitted as well.
+
-- This should be done for accessibility as well ???
if Nkind (Parameter_Type (Current_Parameter)) /=
diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb
index bc43a4b4e06..b2c24c83101 100644
--- a/gcc/ada/exp_intr.adb
+++ b/gcc/ada/exp_intr.adb
@@ -210,6 +210,15 @@ package body Exp_Intr is
Result_Typ : Entity_Id;
begin
+ -- Remove side effects from tag argument early, before rewriting
+ -- the dispatching constructor call, as Remove_Side_Effects relies
+ -- on Tag_Arg's Parent link properly attached to the tree (once the
+ -- call is rewritten, the Parent is inconsistent as it points to the
+ -- rewritten node, which is not the syntactic parent of the Tag_Arg
+ -- anymore).
+
+ Remove_Side_Effects (Tag_Arg);
+
-- The subprogram is the third actual in the instantiation, and is
-- retrieved from the corresponding renaming declaration. However,
-- freeze nodes may appear before, so we retrieve the declaration
@@ -223,15 +232,10 @@ package body Exp_Intr is
Act_Constr := Entity (Name (Act_Rename));
Result_Typ := Class_Wide_Type (Etype (Act_Constr));
- -- Ada 2005 (AI-251): If the result is an interface type, the function
- -- returns a class-wide interface type (otherwise the resulting object
- -- would be abstract!)
-
if Is_Interface (Etype (Act_Constr)) then
- Set_Etype (Act_Constr, Result_Typ);
- -- If the result type is not parent of Tag_Arg then we need to
- -- locate the tag of the secondary dispatch table.
+ -- If the result type is not known to be a parent of Tag_Arg then we
+ -- need to locate the tag of the secondary dispatch table.
if not Is_Ancestor (Etype (Result_Typ), Etype (Tag_Arg),
Use_Full_View => True)
@@ -255,7 +259,7 @@ package body Exp_Intr is
New_Reference_To (RTE (RE_Tag), Loc),
Expression =>
Make_Function_Call (Loc,
- Name => Fname,
+ Name => Fname,
Parameter_Associations => New_List (
Relocate_Node (Tag_Arg),
New_Reference_To
@@ -283,9 +287,7 @@ package body Exp_Intr is
Set_Controlling_Argument (Cnstr_Call,
New_Occurrence_Of (Defining_Identifier (Iface_Tag), Loc));
else
- Remove_Side_Effects (Tag_Arg);
- Set_Controlling_Argument (Cnstr_Call,
- Relocate_Node (Tag_Arg));
+ Set_Controlling_Argument (Cnstr_Call, Relocate_Node (Tag_Arg));
end if;
-- Rewrite and analyze the call to the instance as a class-wide
@@ -314,7 +316,7 @@ package body Exp_Intr is
elsif not Is_Interface (Result_Typ) then
declare
- Obj_Tag_Node : Node_Id := Duplicate_Subexpr (Tag_Arg);
+ Obj_Tag_Node : Node_Id := New_Copy_Tree (Tag_Arg);
CW_Test_Node : Node_Id;
begin
@@ -348,7 +350,7 @@ package body Exp_Intr is
Name => New_Occurrence_Of (RTE (RE_IW_Membership), Loc),
Parameter_Associations => New_List (
Make_Attribute_Reference (Loc,
- Prefix => Duplicate_Subexpr (Tag_Arg),
+ Prefix => New_Copy_Tree (Tag_Arg),
Attribute_Name => Name_Address),
New_Reference_To (
@@ -1045,9 +1047,9 @@ package body Exp_Intr is
and then Is_Entity_Name (Nam2)
and then Entity (Prefix (Nam1)) = Entity (Nam2)
then
- Error_Msg_N ("abort may take time to complete?", N);
- Error_Msg_N ("\deallocation might have no effect?", N);
- Error_Msg_N ("\safer to wait for termination.?", N);
+ Error_Msg_N ("abort may take time to complete??", N);
+ Error_Msg_N ("\deallocation might have no effect??", N);
+ Error_Msg_N ("\safer to wait for termination??", N);
end if;
end if;
end;
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index d34322dc626..537fa01eafd 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -274,18 +274,18 @@ package body Exp_Prag is
--------------------------
procedure Expand_Pragma_Check (N : Node_Id) is
- Cond : constant Node_Id := Arg2 (N);
- Nam : constant Name_Id := Chars (Arg1 (N));
+ Loc : constant Source_Ptr := Sloc (N);
+ -- Location of the pragma node. Note: it is important to use this
+ -- location (and not the location of the expression) for the generated
+ -- statements, otherwise the implicit return statement in the body
+ -- of a pre/postcondition subprogram may inherit the source location
+ -- of part of the expression, which causes confusing debug information
+ -- to be generated, which interferes with coverage analysis tools.
+
+ Cond : constant Node_Id := Arg2 (N);
+ Nam : constant Name_Id := Chars (Arg1 (N));
Msg : Node_Id;
- Loc : constant Source_Ptr := Sloc (First_Node (Cond));
- -- Source location used in the case of a failed assertion. Note that
- -- the source location of the expression is not usually the best choice
- -- here. For example, it gets located on the last AND keyword in a
- -- chain of boolean expressiond AND'ed together. It is best to put the
- -- message on the first character of the assertion, which is the effect
- -- of the First_Node call here.
-
begin
-- We already know that this check is enabled, because otherwise the
-- semantic pass dealt with rewriting the assertion (see Sem_Prag)
@@ -362,7 +362,15 @@ package body Exp_Prag is
else
declare
- Msg_Loc : constant String := Build_Location_String (Loc);
+ Msg_Loc : constant String :=
+ Build_Location_String (Sloc (First_Node (Cond)));
+ -- Source location used in the case of a failed assertion:
+ -- point to the failing condition, not Loc. Note that the
+ -- source location of the expression is not usually the best
+ -- choice here. For example, it gets located on the last AND
+ -- keyword in a chain of boolean expressiond AND'ed together.
+ -- It is best to put the message on the first character of the
+ -- condition, which is the effect of the First_Node call here.
begin
Name_Len := 0;
@@ -440,10 +448,12 @@ package body Exp_Prag is
and then Entity (Original_Node (Cond)) = Standard_False
then
return;
+
elsif Nam = Name_Assertion then
- Error_Msg_N ("?assertion will fail at run time", N);
+ Error_Msg_N ("?A?assertion will fail at run time", N);
else
- Error_Msg_N ("?check will fail at run time", N);
+
+ Error_Msg_N ("?A?check will fail at run time", N);
end if;
end if;
end Expand_Pragma_Check;
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 3a9f81db0fc..29d8182ff83 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -224,9 +224,11 @@ package body Exp_Util is
end case;
if Present (Msg_Node) then
- Error_Msg_N ("?info: atomic synchronization set for &", Msg_Node);
+ Error_Msg_N
+ ("?N?info: atomic synchronization set for &", Msg_Node);
else
- Error_Msg_N ("?info: atomic synchronization set", N);
+ Error_Msg_N
+ ("?N?info: atomic synchronization set", N);
end if;
end if;
end Activate_Atomic_Synchronization;
@@ -5125,7 +5127,8 @@ package body Exp_Util is
if W then
Error_Msg_F
- ("?this code can never be executed and has been deleted!", N);
+ ("?t?this code can never be executed and has been deleted!",
+ N);
end if;
end if;
diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
index fe52233202b..552a8bf1ae9 100644
--- a/gcc/ada/fe.h
+++ b/gcc/ada/fe.h
@@ -178,19 +178,21 @@ extern Boolean In_Same_Source_Unit (Node_Id, Node_Id);
/* opt: */
-#define Global_Discard_Names opt__global_discard_names
+#define Back_Annotate_Rep_Info opt__back_annotate_rep_info
#define Exception_Extra_Info opt__exception_extra_info
#define Exception_Locations_Suppressed opt__exception_locations_suppressed
#define Exception_Mechanism opt__exception_mechanism
-#define Back_Annotate_Rep_Info opt__back_annotate_rep_info
+#define Generate_SCO_Instance_Table opt__generate_sco_instance_table
+#define Global_Discard_Names opt__global_discard_names
typedef enum {Setjmp_Longjmp, Back_End_Exceptions} Exception_Mechanism_Type;
-extern Boolean Global_Discard_Names;
+extern Boolean Back_Annotate_Rep_Info;
extern Boolean Exception_Extra_Info;
extern Boolean Exception_Locations_Suppressed;
extern Exception_Mechanism_Type Exception_Mechanism;
-extern Boolean Back_Annotate_Rep_Info;
+extern Boolean Generate_SCO_Instance_Table;
+extern Boolean Global_Discard_Names;
/* restrict: */
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 6c647111627..5df4c727194 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -802,17 +802,22 @@ package body Freeze is
-- size of packed records if we can tell the size of the packed
-- record in the front end. Packed_Size_Known is True if so far
-- we can figure out the size. It is initialized to True for a
- -- packed record, unless the record has discriminants. The
- -- reason we eliminate the discriminated case is that we don't
- -- know the way the back end lays out discriminated packed
- -- records. If Packed_Size_Known is True, then Packed_Size is
- -- the size in bits so far.
+ -- packed record, unless the record has discriminants or atomic
+ -- components or independent components.
+
+ -- The reason we eliminate the discriminated case is that
+ -- we don't know the way the back end lays out discriminated
+ -- packed records. If Packed_Size_Known is True, then
+ -- Packed_Size is the size in bits so far.
Packed_Size_Known : Boolean :=
- Is_Packed (T)
- and then not Has_Discriminants (T);
+ Is_Packed (T)
+ and then not Has_Discriminants (T)
+ and then not Has_Atomic_Components (T)
+ and then not Has_Independent_Components (T);
Packed_Size : Uint := Uint_0;
+ -- SIze in bis so far
begin
-- Test for variant part present
@@ -856,6 +861,16 @@ package body Freeze is
Packed_Size_Known := False;
end if;
+ -- We do not know the packed size if we have a by reference
+ -- type, or an atomic type or an atomic component.
+
+ if Is_Atomic (Ctyp)
+ or else Is_Atomic (Comp)
+ or else Is_By_Reference_Type (Ctyp)
+ then
+ Packed_Size_Known := False;
+ end if;
+
-- We need to identify a component that is an array where
-- the index type is an enumeration type with non-standard
-- representation, and some bound of the type depends on a
@@ -934,10 +949,19 @@ package body Freeze is
and then Is_Modular_Integer_Type
(Packed_Array_Type (Ctyp)))
then
+ -- Packed size unknown if we have an atomic type
+ -- or a by reference type, since the back end
+ -- knows how these are layed out.
+
+ if Is_Atomic (Ctyp)
+ or else Is_By_Reference_Type (Ctyp)
+ then
+ Packed_Size_Known := False;
+
-- If RM_Size is known and static, then we can keep
- -- accumulating the packed size.
+ -- accumulating the packed size
- if Known_Static_RM_Size (Ctyp) then
+ elsif Known_Static_RM_Size (Ctyp) then
-- A little glitch, to be removed sometime ???
-- gigi does not understand zero sizes yet.
@@ -1040,11 +1064,18 @@ package body Freeze is
if Present (Comp) then
Err_Node := Comp;
Comp_Type := Etype (Comp);
- Comp_Def := Component_Definition (Parent (Comp));
- Comp_Byte_Aligned :=
- Present (Component_Clause (Comp))
- and then Normalized_First_Bit (Comp) mod System_Storage_Unit = 0;
+ if Is_Tag (Comp) then
+ Comp_Def := Empty;
+ Comp_Byte_Aligned := True;
+
+ else
+ Comp_Def := Component_Definition (Parent (Comp));
+ Comp_Byte_Aligned :=
+ Present (Component_Clause (Comp))
+ and then
+ Normalized_First_Bit (Comp) mod System_Storage_Unit = 0;
+ end if;
-- Array case
@@ -1080,7 +1111,7 @@ package body Freeze is
& "storage order as enclosing composite", Err_Node);
end if;
- elsif Aliased_Present (Comp_Def) then
+ elsif Present (Comp_Def) and then Aliased_Present (Comp_Def) then
Error_Msg_N
("aliased component not permitted for type with "
& "explicit Scalar_Storage_Order", Err_Node);
@@ -1817,6 +1848,10 @@ package body Freeze is
Decl : constant Node_Id := Declaration_Node (Underlying_Type (Utype));
begin
+ if not Warn_On_Suspicious_Modulus_Value then
+ return;
+ end if;
+
if Nkind (Decl) = N_Full_Type_Declaration then
declare
Tdef : constant Node_Id := Type_Definition (Decl);
@@ -1826,6 +1861,7 @@ package body Freeze is
declare
Modulus : constant Node_Id :=
Original_Node (Expression (Tdef));
+
begin
if Nkind (Modulus) = N_Integer_Literal then
declare
@@ -1870,7 +1906,7 @@ package body Freeze is
Error_Msg_Uint_1 := Modv;
Error_Msg_N
- ("?2 '*'*^' may have been intended here",
+ ("?M?2 '*'*^' may have been intended here",
Modulus);
end;
end if;
@@ -2285,7 +2321,7 @@ package body Freeze is
if not (Placed_Component or else Is_Packed (Rec)) then
Error_Msg_N
- ("?scalar storage order specified but no component clause",
+ ("??scalar storage order specified but no component clause",
ADC);
end if;
@@ -2304,9 +2340,9 @@ package body Freeze is
if Present (ADC) and then Base_Type (Rec) = Rec then
if not (Placed_Component or else Is_Packed (Rec)) then
- Error_Msg_N ("?bit order specification has no effect", ADC);
+ Error_Msg_N ("??bit order specification has no effect", ADC);
Error_Msg_N
- ("\?since no component clauses were specified", ADC);
+ ("\??since no component clauses were specified", ADC);
-- Here is where we do the processing for reversed bit order
@@ -2371,7 +2407,7 @@ package body Freeze is
if Warn_On_Redundant_Constructs then
Error_Msg_N -- CODEFIX
- ("?pragma Pack has no effect, no unplaced components",
+ ("??pragma Pack has no effect, no unplaced components",
Get_Rep_Pragma (Rec, Name_Pack));
end if;
end if;
@@ -2478,14 +2514,16 @@ package body Freeze is
if Convention (E) = Convention_C then
Error_Msg_N
- ("?variant record has no direct equivalent in C", A2);
+ ("?x?variant record has no direct equivalent in C",
+ A2);
else
Error_Msg_N
- ("?variant record has no direct equivalent in C++", A2);
+ ("?x?variant record has no direct equivalent in C++",
+ A2);
end if;
Error_Msg_NE
- ("\?use of convention for type& is dubious", A2, E);
+ ("\?x?use of convention for type& is dubious", A2, E);
end if;
end;
end if;
@@ -2689,6 +2727,7 @@ package body Freeze is
-- Case of entity being frozen is other than a type
if not Is_Type (E) then
+
-- If entity is exported or imported and does not have an external
-- name, now is the time to provide the appropriate default name.
-- Skip this if the entity is stubbed, since we don't need a name
@@ -2805,7 +2844,7 @@ package body Freeze is
and then Esize (F_Type) > Ttypes.System_Address_Size
then
Error_Msg_N
- ("?type of & does not correspond to C pointer!",
+ ("?x?type of & does not correspond to C pointer!",
Formal);
-- Check suspicious return of boolean
@@ -2816,10 +2855,11 @@ package body Freeze is
and then not Has_Size_Clause (F_Type)
and then VM_Target = No_VM
then
- Error_Msg_N ("& is an 8-bit Ada Boolean?", Formal);
+ Error_Msg_N
+ ("& is an 8-bit Ada Boolean?x?", Formal);
Error_Msg_N
("\use appropriate corresponding type in C "
- & "(e.g. char)?", Formal);
+ & "(e.g. char)?x?", Formal);
-- Check suspicious tagged type
@@ -2831,7 +2871,7 @@ package body Freeze is
and then Convention (E) = Convention_C
then
Error_Msg_N
- ("?& involves a tagged type which does not "
+ ("?x?& involves a tagged type which does not "
& "correspond to any C type!", Formal);
-- Check wrong convention subprogram pointer
@@ -2840,11 +2880,11 @@ package body Freeze is
and then not Has_Foreign_Convention (F_Type)
then
Error_Msg_N
- ("?subprogram pointer & should "
+ ("?x?subprogram pointer & should "
& "have foreign convention!", Formal);
Error_Msg_Sloc := Sloc (F_Type);
Error_Msg_NE
- ("\?add Convention pragma to declaration of &#",
+ ("\?x?add Convention pragma to declaration of &#",
Formal, F_Type);
end if;
@@ -2880,17 +2920,17 @@ package body Freeze is
if Formal = First_Formal (E) then
Error_Msg_NE
- ("?in inherited operation&", Warn_Node, E);
+ ("??in inherited operation&", Warn_Node, E);
end if;
else
Warn_Node := Formal;
end if;
Error_Msg_NE
- ("?type of argument& is unconstrained array",
+ ("?x?type of argument& is unconstrained array",
Warn_Node, Formal);
Error_Msg_NE
- ("?foreign caller must pass bounds explicitly",
+ ("?x?foreign caller must pass bounds explicitly",
Warn_Node, Formal);
Error_Msg_Qual_Level := 0;
end if;
@@ -2951,7 +2991,7 @@ package body Freeze is
and then not Has_Warnings_Off (R_Type)
then
Error_Msg_N
- ("?return type of& does not "
+ ("?x?return type of& does not "
& "correspond to C pointer!", E);
-- Check suspicious return of boolean
@@ -2968,11 +3008,11 @@ package body Freeze is
Result_Definition (Declaration_Node (E));
begin
Error_Msg_NE
- ("return type of & is an 8-bit Ada Boolean?",
+ ("return type of & is an 8-bit Ada Boolean?x?",
N, E);
Error_Msg_NE
("\use appropriate corresponding type in C "
- & "(e.g. char)?", N, E);
+ & "(e.g. char)?x?", N, E);
end;
-- Check suspicious return tagged type
@@ -2987,7 +3027,7 @@ package body Freeze is
and then not Has_Warnings_Off (R_Type)
then
Error_Msg_N
- ("?return type of & does not "
+ ("?x?return type of & does not "
& "correspond to C type!", E);
-- Check return of wrong convention subprogram pointer
@@ -2998,11 +3038,11 @@ package body Freeze is
and then not Has_Warnings_Off (R_Type)
then
Error_Msg_N
- ("?& should return a foreign "
+ ("?x?& should return a foreign "
& "convention subprogram pointer", E);
Error_Msg_Sloc := Sloc (R_Type);
Error_Msg_NE
- ("\?add Convention pragma to declaration of& #",
+ ("\?x?add Convention pragma to declaration of& #",
E, R_Type);
end if;
end if;
@@ -3037,7 +3077,7 @@ package body Freeze is
and then not Has_Warnings_Off (R_Type)
then
Error_Msg_N
- ("?foreign convention function& should not " &
+ ("?x?foreign convention function& should not " &
"return unconstrained array!", E);
end if;
end if;
@@ -3054,9 +3094,9 @@ package body Freeze is
and then Present (Contract (E))
and then Present (Spec_PPC_List (Contract (E)))
then
- Error_Msg_NE ("pre/post conditions on imported subprogram "
- & "are not enforced?",
- E, Spec_PPC_List (Contract (E)));
+ Error_Msg_NE
+ ("pre/post conditions on imported subprogram "
+ & "are not enforced??", E, Spec_PPC_List (Contract (E)));
end if;
end if;
@@ -3218,7 +3258,7 @@ package body Freeze is
then
Error_Msg_Uint_1 := UI_From_Int (Standard_Integer_Size);
Error_Msg_N
- ("?convention C enumeration object has size less than ^",
+ ("??convention C enumeration object has size less than ^",
E);
Error_Msg_N ("\?use explicit size clause to set size", E);
end if;
@@ -3595,10 +3635,10 @@ package body Freeze is
then
Error_Msg_Sloc := Sloc (Comp_Size_C);
Error_Msg_NE
- ("?pragma Pack for& ignored!",
+ ("?r?pragma Pack for& ignored!",
Pack_Pragma, Ent);
Error_Msg_N
- ("\?explicit component size given#!",
+ ("\?r?explicit component size given#!",
Pack_Pragma);
Set_Is_Packed (Base_Type (Ent), False);
Set_Is_Bit_Packed_Array (Base_Type (Ent), False);
@@ -3628,10 +3668,10 @@ package body Freeze is
if Present (Pack_Pragma) then
Error_Msg_N
- ("?pragma Pack causes component size "
+ ("??pragma Pack causes component size "
& "to be ^!", Pack_Pragma);
Error_Msg_N
- ("\?use Component_Size to set "
+ ("\??use Component_Size to set "
& "desired value!", Pack_Pragma);
end if;
end if;
@@ -3784,7 +3824,7 @@ package body Freeze is
then
Error_Msg_NE
("non-atomic components of type& may not be "
- & "accessible by separate tasks?", Clause, E);
+ & "accessible by separate tasks??", Clause, E);
if Has_Component_Size_Clause (E) then
Error_Msg_Sloc :=
@@ -3792,14 +3832,14 @@ package body Freeze is
(Get_Attribute_Definition_Clause
(FS, Attribute_Component_Size));
Error_Msg_N
- ("\because of component size clause#?",
+ ("\because of component size clause#??",
Clause);
elsif Has_Pragma_Pack (E) then
Error_Msg_Sloc :=
Sloc (Get_Rep_Pragma (FS, Name_Pack));
Error_Msg_N
- ("\because of pragma Pack#?", Clause);
+ ("\because of pragma Pack#??", Clause);
end if;
end if;
@@ -4273,16 +4313,16 @@ package body Freeze is
if Ada_Version >= Ada_2005 then
Error_Msg_N
- ("\would be legal if Storage_Size of 0 given?", E);
+ ("\would be legal if Storage_Size of 0 given??", E);
elsif No_Pool_Assigned (E) then
Error_Msg_N
- ("\would be legal in Ada 2005?", E);
+ ("\would be legal in Ada 2005??", E);
else
Error_Msg_N
("\would be legal in Ada 2005 if "
- & "Storage_Size of 0 given?", E);
+ & "Storage_Size of 0 given??", E);
end if;
end if;
end if;
@@ -4839,7 +4879,7 @@ package body Freeze is
and then not Is_Character_Type (Typ)
then
Error_Msg_N
- ("C enum types have the size of a C int?", Size_Clause (Typ));
+ ("C enum types have the size of a C int??", Size_Clause (Typ));
end if;
Adjust_Esize_For_Alignment (Typ);
@@ -6081,7 +6121,7 @@ package body Freeze is
and then Warn_On_Export_Import
then
Error_Msg_N
- ("?Valued_Procedure has no effect for convention Ada", E);
+ ("??Valued_Procedure has no effect for convention Ada", E);
Set_Is_Valued_Procedure (E, False);
end if;
@@ -6133,7 +6173,7 @@ package body Freeze is
and then VM_Target = No_VM
then
Error_Msg_N
- ("?foreign convention function& should not return " &
+ ("?x?foreign convention function& should not return " &
"unconstrained array", E);
return;
end if;
@@ -6150,7 +6190,7 @@ package body Freeze is
and then Present (Default_Value (F))
then
Error_Msg_N
- ("?parameter cannot be defaulted in non-Ada call",
+ ("?x?parameter cannot be defaulted in non-Ada call",
Default_Value (F));
end if;
@@ -6575,11 +6615,11 @@ package body Freeze is
if Present (Old) then
Error_Msg_Node_2 := Old;
Error_Msg_N
- ("default initialization of & may modify &?",
+ ("default initialization of & may modify &??",
Nam);
else
Error_Msg_N
- ("default initialization of & may modify overlaid storage?",
+ ("default initialization of & may modify overlaid storage??",
Nam);
end if;
@@ -6602,7 +6642,7 @@ package body Freeze is
then
Error_Msg_NE
("\packed array component& " &
- "will be initialized to zero?",
+ "will be initialized to zero??",
Nam, Comp);
exit;
else
@@ -6614,7 +6654,7 @@ package body Freeze is
Error_Msg_N
("\use pragma Import for & to " &
- "suppress initialization (RM B.1(24))?",
+ "suppress initialization (RM B.1(24))??",
Nam);
end if;
end Warn_Overlay;
diff --git a/gcc/ada/g-excact.ads b/gcc/ada/g-excact.ads
index 77abadac8fb..6111bc7fd02 100644
--- a/gcc/ada/g-excact.ads
+++ b/gcc/ada/g-excact.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -110,7 +110,9 @@ package GNAT.Exception_Actions is
-- is compiled with pragma Restrictions (No_Exception_Registration);
procedure Core_Dump (Occurrence : Exception_Occurrence);
- -- Dump memory (called a core dump in some systems), and abort execution
- -- of the application.
+ -- Dump memory (called a core dump in some systems) if supported by the
+ -- OS (most unix systems and VMS), and abort execution of the application.
+ -- Under Windows this procedure will not dump the memory, it will only
+ -- abort execution.
end GNAT.Exception_Actions;
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 0d83ab88208..0e0cd6d266f 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -2194,14 +2194,13 @@ ada/exp_vfpt.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/expander.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/debug_a.ads \
- ada/debug_a.adb ada/einfo.ads ada/elists.ads ada/err_vars.ads \
- ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_alfa.ads \
- ada/exp_attr.ads ada/exp_ch11.ads ada/exp_ch12.ads ada/exp_ch13.ads \
- ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch5.ads \
- ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch8.ads ada/exp_ch9.ads \
- ada/exp_prag.ads ada/exp_tss.ads ada/expander.ads ada/expander.adb \
- ada/fname.ads ada/hostparm.ads ada/inline.ads ada/lib.ads \
- ada/lib-load.ads ada/namet.ads ada/nlists.ads ada/opt.ads \
+ ada/debug_a.adb ada/einfo.ads ada/elists.ads ada/exp_aggr.ads \
+ ada/exp_alfa.ads ada/exp_attr.ads ada/exp_ch11.ads ada/exp_ch12.ads \
+ ada/exp_ch13.ads ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads \
+ ada/exp_ch5.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch8.ads \
+ ada/exp_ch9.ads ada/exp_prag.ads ada/exp_tss.ads ada/expander.ads \
+ ada/expander.adb ada/fname.ads ada/hostparm.ads ada/inline.ads \
+ ada/lib.ads ada/lib-load.ads ada/namet.ads ada/nlists.ads ada/opt.ads \
ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \
@@ -2734,25 +2733,25 @@ ada/par.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/warnsw.ads ada/widechar.ads
ada/par_sco.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
- ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
- ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_tss.ads \
- ada/fname.ads ada/gnat.ads ada/g-byorma.ads ada/g-hesorg.ads \
- ada/g-hesorg.adb ada/g-htable.ads ada/g-table.ads ada/g-table.adb \
- ada/hostparm.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-sort.adb ada/lib-util.ads ada/lib-util.adb ada/namet.ads \
- ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads ada/osint-c.ads \
- ada/output.ads ada/par_sco.ads ada/par_sco.adb ada/put_scos.ads \
- ada/put_scos.adb ada/scans.ads ada/scos.ads ada/scos.adb ada/sem.ads \
- ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-strhas.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/aspects.adb \
+ ada/atree.ads ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads \
+ ada/einfo.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
+ ada/exp_tss.ads ada/fname.ads ada/gnat.ads ada/g-byorma.ads \
+ ada/g-hesorg.ads ada/g-hesorg.adb ada/g-htable.ads ada/g-table.ads \
+ ada/g-table.adb ada/hostparm.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-sort.adb ada/lib-util.ads ada/lib-util.adb \
+ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads \
+ ada/osint-c.ads ada/output.ads ada/par_sco.ads ada/par_sco.adb \
+ ada/put_scos.ads ada/put_scos.adb ada/scans.ads ada/scos.ads \
+ ada/scos.adb ada/sem.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-htable.adb ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-strhas.ads ada/s-string.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/prep.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/casing.ads ada/csets.ads \
@@ -2795,12 +2794,12 @@ ada/put_alfa.o : ada/ada.ads ada/a-unccon.ads ada/alfa.ads ada/gnat.ads \
ada/put_scos.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \
ada/g-table.ads ada/g-table.adb ada/hostparm.ads ada/namet.ads \
- ada/opt.ads ada/output.ads ada/par_sco.ads ada/put_scos.ads \
- ada/put_scos.adb ada/scos.ads ada/snames.ads ada/system.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/opt.ads ada/output.ads ada/put_scos.ads ada/put_scos.adb \
+ ada/scos.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
+ ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
+ ada/unchdeal.ads
ada/repinfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3075,34 +3074,34 @@ ada/scng.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/scos.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \
ada/g-table.ads ada/g-table.adb ada/hostparm.ads ada/namet.ads \
- ada/opt.ads ada/output.ads ada/scos.ads ada/scos.adb ada/snames.ads \
- ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/opt.ads ada/output.ads ada/scos.ads ada/scos.adb ada/system.ads \
+ ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/sem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/alloc.ads ada/aspects.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/csets.ads ada/debug.ads ada/debug_a.ads \
ada/debug_a.adb ada/einfo.ads ada/einfo.adb ada/elists.ads \
- ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/exp_tss.ads ada/expander.ads ada/fname.ads ada/gnat.ads \
- ada/g-hesorg.ads ada/hostparm.ads ada/inline.ads ada/lib.ads \
- ada/lib.adb ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb \
- ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/sem.ads ada/sem.adb \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch11.ads \
- ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch2.adb \
- ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
- ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_dim.ads \
- ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/system.ads ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/elists.adb ada/exp_tss.ads ada/expander.ads ada/fname.ads \
+ ada/gnat.ads ada/g-hesorg.ads ada/hostparm.ads ada/inline.ads \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
+ ada/lib-sort.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \
+ ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads ada/sem.ads \
+ ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch10.ads \
+ ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
+ ada/sem_ch2.adb ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \
+ ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \
+ ada/sem_dim.ads ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/widechar.ads
ada/sem_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -4372,11 +4371,14 @@ ada/validsw.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/validsw.ads \
ada/validsw.adb
-ada/warnsw.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads \
- ada/hostparm.ads ada/opt.ads ada/system.ads ada/s-exctab.ads \
- ada/s-stalib.ads ada/s-string.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/warnsw.ads \
- ada/warnsw.adb
+ada/warnsw.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
+ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/err_vars.ads \
+ ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/warnsw.ads ada/warnsw.adb
ada/widechar.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/hostparm.ads ada/interfac.ads ada/opt.ads \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index d27a8136641..24c9966feb8 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -273,7 +273,7 @@ endif
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
# subdirectory rather than in the source directory.
-INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(srcdir)/../include
+INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(srcdir)/../include $(GMPINC)
ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
@@ -283,11 +283,11 @@ ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
ifneq ($(findstring vxworks,$(osys)),)
INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
-iquote $(fsrcdir)/ada \
- -I$(fsrcdir)/../include
+ -I$(fsrcdir)/../include $(GMPINC)
else
INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
-iquote $(fsrcdir)/ada -iquote $(fsrcdir) \
- -I$(fsrcdir)/../include
+ -I$(fsrcdir)/../include $(GMPINC)
endif
ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 3d3f16110ce..2fd2743bbe1 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -228,7 +228,9 @@ int optimize_size;
int flag_compare_debug;
enum stack_check_type flag_stack_check = NO_STACK_CHECK;
-/* Post-switch processing. */
+/* Settings adjustments after switches processing by the back-end.
+ Note that the front-end switches processing (Scan_Compiler_Arguments)
+ has not been done yet at this point! */
static bool
gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 74133a458b1..4d21d2c77ae 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -302,6 +302,16 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
type_annotate_only = (gigi_operating_mode == 1);
+#if 0
+ if (Generate_SCO_Instance_Table)
+ flag_debug_instances = 1;
+#else
+ /* Temporary compatibility shim: FSF head back-end does not support instance
+ based debug info discriminators, so disable the generation of the SCO
+ instance table. ??? */
+ Generate_SCO_Instance_Table = False;
+#endif
+
for (i = 0; i < number_file; i++)
{
/* Use the identifier table to make a permanent copy of the filename as
diff --git a/gcc/ada/get_scos.adb b/gcc/ada/get_scos.adb
index 170f5b5623b..ca90a85b4f7 100644
--- a/gcc/ada/get_scos.adb
+++ b/gcc/ada/get_scos.adb
@@ -205,7 +205,7 @@ procedure Get_SCOs is
Nam : Name_Id;
--- Start of processing for Get_Scos
+-- Start of processing for Get_SCOs
begin
SCOs.Initialize;
@@ -265,7 +265,9 @@ begin
pragma Assert (C = '|');
Get_Source_Location (SIE.Inst_Loc);
- if not At_EOL then
+ if At_EOL then
+ SIE.Enclosing_Instance := 0;
+ else
Skip_Spaces;
SIE.Enclosing_Instance :=
SCO_Instance_Index (Get_Int);
@@ -342,6 +344,10 @@ begin
Key := '>';
Typ := Getc;
+ -- Sanity check on dominance marker type indication
+
+ pragma Assert (Typ in 'A' .. 'Z');
+
when '1' .. '9' =>
Typ := ' ';
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index 4948e1bb9bb..4cfc3392f24 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -518,7 +518,7 @@ procedure Gnat1drv is
-- off. Note Atomic Synchronization is implemented as check.
Suppress_Options.Suppress (Atomic_Synchronization) :=
- not Atomic_Sync_Default;
+ not Atomic_Sync_Default_On_Target;
-- Set switch indicating if we can use N_Expression_With_Actions
@@ -677,9 +677,9 @@ procedure Gnat1drv is
and then not Compilation_Errors
then
Error_Msg_N
- ("package $$ does not require a body?", Main_Unit_Node);
+ ("package $$ does not require a body??", Main_Unit_Node);
Error_Msg_File_1 := Fname;
- Error_Msg_N ("body in file{? will be ignored", Main_Unit_Node);
+ Error_Msg_N ("body in file{ will be ignored??", Main_Unit_Node);
-- Ada 95 cases of a body file present when no body is
-- permitted. This we consider to be an error.
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index b0e9f32abe4..0a89386af57 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -111,6 +111,7 @@ Implementation Defined Pragmas
* Pragma Ast_Entry::
* Pragma C_Pass_By_Copy::
* Pragma Check::
+* Pragma Check_Float_Overflow::
* Pragma Check_Name::
* Pragma Check_Policy::
* Pragma Comment::
@@ -850,6 +851,7 @@ consideration, the use of these pragmas should be minimized.
* Pragma Ast_Entry::
* Pragma C_Pass_By_Copy::
* Pragma Check::
+* Pragma Check_Float_Overflow::
* Pragma Check_Name::
* Pragma Check_Policy::
* Pragma Comment::
@@ -1402,6 +1404,60 @@ Checks introduced by this pragma are normally deactivated by default. They can
be activated either by the command line option @option{-gnata}, which turns on
all checks, or individually controlled using pragma @code{Check_Policy}.
+@node Pragma Check_Float_Overflow
+@unnumberedsec Pragma Check_Float_Overflow
+@cindex Floating-point overflow
+@findex Check_Float_Overflow
+@noindent
+Syntax:
+@smallexample @c ada
+pragma Check_Float_Overflow;
+@end smallexample
+
+@noindent
+In Ada, the predefined floating-point types (@code{Short_Float},
+@code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
+defined to be @emph{unconstrained}. This means that even though each
+has a well-defined base range, an operation that delivers a result
+outside this base range is not required to raise an exception.
+This implementation permission accommodates the notion
+of infinities in IEEE floating-point, and corresponds to the
+efficient execution mode on most machines. GNAT will not raise
+overflow exceptions on these machines; instead it will generate
+infinities and NaN's as defined in the IEEE standard.
+
+Generating infinities, although efficient, is not always desirable.
+Often the preferable approach is to check for overflow, even at the
+(perhaps considerable) expense of run-time performance.
+This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
+range constraints -- and indeed such a subtype
+can have the same base range as its base type. For example:
+
+@smallexample @c ada
+subtype My_Float is Float range Float'Range;
+@end smallexample
+
+@noindent
+Here @code{My_Float} has the same range as
+@code{Float} but is constrained, so operations on
+@code{My_Float} values will be checked for overflow
+against this range.
+
+This style will achieve the desired goal, but
+it is often more convenient to be able to simply use
+the standard predefined floating-point types as long
+as overflow checking could be guaranteed.
+The @code{Check_Float_Overflow}
+configuration pragma achieves this effect. If a unit is compiled
+subject to this configuration pragma, then all operations
+on predefined floating-point types will be treated as
+though those types were constrained, and overflow checks
+will be generated. The @code{Constraint_Error}
+exception is raised if the result is out of range.
+
+This mode can also be set by use of the compiler
+switch @option{-gnateF}.
+
@node Pragma Check_Name
@unnumberedsec Pragma Check_Name
@cindex Defining check names
@@ -6790,13 +6846,13 @@ that make up scalar components are ordered within S. Other properties are
as for standard representation attribute @code{Bit_Order}, as defined by
Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
-If @code{@var{S}'Scalar_Storage_Order} is specified explicitly, it shall be
-equal to @code{@var{S}'Bit_Order}. Note: This means that if a
-@code{Scalar_Storage_Order} attribute definition clause is not confirming,
-then the type's @code{Bit_Order} shall be specified explicitly and set to
-the same value.
+For a record type @var{S}, if @code{@var{S}'Scalar_Storage_Order} is
+specified explicitly, it shall be equal to @code{@var{S}'Bit_Order}. Note:
+This means that if a @code{Scalar_Storage_Order} attribute definition
+clause is not confirming, then the type's @code{Bit_Order} shall be
+specified explicitly and set to the same value.
-If a component of S has itself a record or array type, then it shall also
+If a component of @var{S} has itself a record or array type, then it shall also
have a @code{Scalar_Storage_Order} attribute definition clause. In addition,
if the component does not start on a byte boundary, then the scalar storage
order specified for S and for the nested component type shall be identical.
@@ -6808,10 +6864,11 @@ A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
with a value equal to @code{System.Default_Bit_Order}) has no effect.
If the opposite storage order is specified, then whenever the value of
-a scalar component of S is read, the storage elements of the enclosing
-machine scalar are first reversed (before retrieving the component value,
-possibly applying some shift and mask operatings on the enclosing machine
-scalar), and the opposite operation is done for writes.
+a scalar component of an object of type @var{S} is read, the storage
+elements of the enclosing machine scalar are first reversed (before
+retrieving the component value, possibly applying some shift and mask
+operatings on the enclosing machine scalar), and the opposite operation
+is done for writes.
In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
are relaxed. Instead, the following rules apply:
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 176c01db3b7..d96a724df6d 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -4178,6 +4178,10 @@ Create expanded source files for source level debugging. This switch
also suppress generation of cross-reference information
(see @option{-gnatx}).
+@item ^-gnateA^/ALIASING_CHECK^
+@cindex @option{-gnateA} (@command{gcc})
+Check that there is no aliasing between two parameters of the same subprogram.
+
@item -gnatec=@var{path}
@cindex @option{-gnatec} (@command{gcc})
Specify a configuration pragma file
@@ -4186,6 +4190,10 @@ Specify a configuration pragma file
@end ifclear
(@pxref{The Configuration Pragmas Files}).
+@item ^-gnated^/DISABLE_ATOMIC_SYNCHRONIZATION^
+@cindex @option{-gnated} (@command{gcc})
+Disable atomic synchronization
+
@item ^-gnateD^/DATA_PREPROCESSING=^symbol@r{[}=@var{value}@r{]}
@cindex @option{-gnateD} (@command{gcc})
Defines a symbol, associated with @var{value}, for preprocessing.
@@ -4204,6 +4212,12 @@ produced at run time.
@cindex @option{-gnatef} (@command{gcc})
Display full source path name in brief error messages.
+@item -gnateF
+@cindex @option{-gnateF} (@command{gcc})
+Check for overflow on all floating-point operations, including those
+for unconstrained predefined types. See description of pragma
+@code{Check_Float_Overflow} in GNAT RM.
+
@item -gnateG
@cindex @option{-gnateG} (@command{gcc})
Save result of preprocessing in a text file.
@@ -4249,6 +4263,14 @@ temporary use of special test software.
@cindex @option{-gnateS} (@command{gcc})
Synonym of @option{-fdump-scos}, kept for backards compatibility.
+@item ^-gnatet^/TARGET_DEPENDENT_INFO^
+@cindex @option{-gnatet} (@command{gcc})
+Generate target dependent information.
+
+@item ^-gnateV^/PARAMETER_VALIDITY_CHECK^
+@cindex @option{-gnateV} (@command{gcc})
+Check validity of subprogram parameters.
+
@item -gnatE
@cindex @option{-gnatE} (@command{gcc})
Full dynamic elaboration checks.
diff --git a/gcc/ada/i-cstrea.ads b/gcc/ada/i-cstrea.ads
index 8882a7d3de6..1a7e76a713b 100644
--- a/gcc/ada/i-cstrea.ads
+++ b/gcc/ada/i-cstrea.ads
@@ -42,6 +42,7 @@ package Interfaces.C_Streams is
subtype int is System.CRTL.int;
subtype long is System.CRTL.long;
subtype size_t is System.CRTL.size_t;
+ subtype ssize_t is System.CRTL.ssize_t;
subtype voids is System.Address;
NULL_Stream : constant FILEs;
@@ -153,9 +154,18 @@ package Interfaces.C_Streams is
origin : int) return int
renames System.CRTL.fseek;
+ function fseek64
+ (stream : FILEs;
+ offset : ssize_t;
+ origin : int) return int
+ renames System.CRTL.fseek64;
+
function ftell (stream : FILEs) return long
renames System.CRTL.ftell;
+ function ftell64 (stream : FILEs) return ssize_t
+ renames System.CRTL.ftell64;
+
function fwrite
(buffer : voids;
size : size_t;
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 8a28bf68ab5..37c403b803e 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -38,10 +38,6 @@
installed by this file are used to catch the resulting signals that come
from these probes failing (i.e. touching protected pages). */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* This file should be kept synchronized with 2sinit.ads, 2sinit.adb,
s-init-ae653-cert.adb and s-init-xi-sparc.adb. All these files implement
the required functionality for different targets. */
@@ -71,6 +67,10 @@ extern "C" {
#include "adaint.h"
#include "raise.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void __gnat_raise_program_error (const char *, int);
/* Addresses of exception data blocks for predefined exceptions. Tasking_Error
@@ -821,34 +821,46 @@ int __gnat_features_set = 0;
#endif
/* Define macro symbols for the VMS conditions that become Ada exceptions.
- Most of these are also defined in the header file ssdef.h which has not
- yet been converted to be recognized by GNU C. */
+ It would be better to just include <ssdef.h> */
-/* Defining these as macros, as opposed to external addresses, allows
- them to be used in a case statement below. */
#define SS$_ACCVIO 12
#define SS$_HPARITH 1284
+#define SS$_INTDIV 1156
#define SS$_STKOVF 1364
#define SS$_RESIGNAL 2328
+#define MTH$_FLOOVEMAT 1475268 /* Some ACVC_21 CXA tests */
+
+/* The following codes must be resignalled, and not handled here. */
+
/* These codes are in standard message libraries. */
extern int C$_SIGKILL;
extern int SS$_DEBUG;
extern int LIB$_KEYNOTFOU;
extern int LIB$_ACTIMAGE;
-#define CMA$_EXIT_THREAD 4227492
-#define MTH$_FLOOVEMAT 1475268 /* Some ACVC_21 CXA tests */
-#define SS$_INTDIV 1156
/* These codes are non standard, which is to say the author is
not sure if they are defined in the standard message libraries
so keep them as macros for now. */
#define RDB$_STREAM_EOF 20480426
#define FDL$_UNPRIKW 11829410
+#define CMA$_EXIT_THREAD 4227492
+
+struct cond_sigargs {
+ unsigned int sigarg;
+ unsigned int sigargval;
+};
+
+struct cond_subtests {
+ unsigned int num;
+ const struct cond_sigargs sigargs[];
+};
struct cond_except {
unsigned int cond;
const struct Exception_Data *except;
+ unsigned int needs_adjust; /* 1 = adjust PC, 0 = no adjust */
+ const struct cond_subtests *subtests;
};
struct descriptor_s {
@@ -928,53 +940,72 @@ extern Exception_Code Base_Code_In (Exception_Code);
/* DEC Ada specific conditions. */
static const struct cond_except dec_ada_cond_except_table [] = {
- {ADA$_PROGRAM_ERROR, &program_error},
- {ADA$_USE_ERROR, &Use_Error},
- {ADA$_KEYSIZERR, &program_error},
- {ADA$_STAOVF, &storage_error},
- {ADA$_CONSTRAINT_ERRO, &constraint_error},
- {ADA$_IOSYSFAILED, &Device_Error},
- {ADA$_LAYOUT_ERROR, &Layout_Error},
- {ADA$_STORAGE_ERROR, &storage_error},
- {ADA$_DATA_ERROR, &Data_Error},
- {ADA$_DEVICE_ERROR, &Device_Error},
- {ADA$_END_ERROR, &End_Error},
- {ADA$_MODE_ERROR, &Mode_Error},
- {ADA$_NAME_ERROR, &Name_Error},
- {ADA$_STATUS_ERROR, &Status_Error},
- {ADA$_NOT_OPEN, &Use_Error},
- {ADA$_ALREADY_OPEN, &Use_Error},
- {ADA$_USE_ERROR, &Use_Error},
- {ADA$_UNSUPPORTED, &Use_Error},
- {ADA$_FAC_MODE_MISMAT, &Use_Error},
- {ADA$_ORG_MISMATCH, &Use_Error},
- {ADA$_RFM_MISMATCH, &Use_Error},
- {ADA$_RAT_MISMATCH, &Use_Error},
- {ADA$_MRS_MISMATCH, &Use_Error},
- {ADA$_MRN_MISMATCH, &Use_Error},
- {ADA$_KEY_MISMATCH, &Use_Error},
- {ADA$_MAXLINEXC, &constraint_error},
- {ADA$_LINEXCMRS, &constraint_error},
+ {ADA$_PROGRAM_ERROR, &program_error, 0, 0},
+ {ADA$_USE_ERROR, &Use_Error, 0, 0},
+ {ADA$_KEYSIZERR, &program_error, 0, 0},
+ {ADA$_STAOVF, &storage_error, 0, 0},
+ {ADA$_CONSTRAINT_ERRO, &constraint_error, 0, 0},
+ {ADA$_IOSYSFAILED, &Device_Error, 0, 0},
+ {ADA$_LAYOUT_ERROR, &Layout_Error, 0, 0},
+ {ADA$_STORAGE_ERROR, &storage_error, 0, 0},
+ {ADA$_DATA_ERROR, &Data_Error, 0, 0},
+ {ADA$_DEVICE_ERROR, &Device_Error, 0, 0},
+ {ADA$_END_ERROR, &End_Error, 0, 0},
+ {ADA$_MODE_ERROR, &Mode_Error, 0, 0},
+ {ADA$_NAME_ERROR, &Name_Error, 0, 0},
+ {ADA$_STATUS_ERROR, &Status_Error, 0, 0},
+ {ADA$_NOT_OPEN, &Use_Error, 0, 0},
+ {ADA$_ALREADY_OPEN, &Use_Error, 0, 0},
+ {ADA$_USE_ERROR, &Use_Error, 0, 0},
+ {ADA$_UNSUPPORTED, &Use_Error, 0, 0},
+ {ADA$_FAC_MODE_MISMAT, &Use_Error, 0, 0},
+ {ADA$_ORG_MISMATCH, &Use_Error, 0, 0},
+ {ADA$_RFM_MISMATCH, &Use_Error, 0, 0},
+ {ADA$_RAT_MISMATCH, &Use_Error, 0, 0},
+ {ADA$_MRS_MISMATCH, &Use_Error, 0, 0},
+ {ADA$_MRN_MISMATCH, &Use_Error, 0, 0},
+ {ADA$_KEY_MISMATCH, &Use_Error, 0, 0},
+ {ADA$_MAXLINEXC, &constraint_error, 0, 0},
+ {ADA$_LINEXCMRS, &constraint_error, 0, 0},
#if 0
/* Already handled by a pragma Import_Exception
in Aux_IO_Exceptions */
- {ADA$_LOCK_ERROR, &Lock_Error},
- {ADA$_EXISTENCE_ERROR, &Existence_Error},
- {ADA$_KEY_ERROR, &Key_Error},
+ {ADA$_LOCK_ERROR, &Lock_Error, 0, 0},
+ {ADA$_EXISTENCE_ERROR, &Existence_Error, 0, 0},
+ {ADA$_KEY_ERROR, &Key_Error, 0, 0},
#endif
- {0, 0}
+ {0, 0, 0, 0}
};
#endif /* IN_RTS */
-/* Non-DEC Ada specific conditions. We could probably also put
- SS$_HPARITH here and possibly SS$_ACCVIO, SS$_STKOVF. */
-static const struct cond_except cond_except_table [] = {
- {MTH$_FLOOVEMAT, &constraint_error},
- {SS$_INTDIV, &constraint_error},
- {0, 0}
+/* Non-DEC Ada specific conditions that map to Ada exceptions. */
+
+/* Subtest for ACCVIO Constraint_Error, kept for compatibility,
+ in hindsight should have just made ACCVIO == Storage_Error. */
+#define ACCVIO_VIRTUAL_ADDR 3
+static const struct cond_subtests accvio_c_e =
+ {1, /* number of subtests below */
+ {
+ {ACCVIO_VIRTUAL_ADDR, 0}
+ }
+ };
+
+/* Macro flag to adjust PC which gets off by one for some conditions,
+ not sure if this is reliably true, PC could be off by more for
+ HPARITH for example, unless a trapb is inserted. */
+#define NEEDS_ADJUST 1
+
+static const struct cond_except system_cond_except_table [] = {
+ {MTH$_FLOOVEMAT, &constraint_error, 0, 0},
+ {SS$_INTDIV, &constraint_error, 0, 0},
+ {SS$_HPARITH, &constraint_error, NEEDS_ADJUST, 0},
+ {SS$_ACCVIO, &constraint_error, NEEDS_ADJUST, &accvio_c_e},
+ {SS$_ACCVIO, &storage_error, NEEDS_ADJUST, 0},
+ {SS$_STKOVF, &storage_error, NEEDS_ADJUST, 0},
+ {0, 0, 0, 0}
};
/* To deal with VMS conditions and their mapping to Ada exceptions,
@@ -1039,7 +1070,7 @@ __gnat_default_resignal_p (int code)
for (i = 0, iexcept = 0;
cond_resignal_table [i]
- && !(iexcept = LIB$MATCH_COND (&code, &cond_resignal_table [i]));
+ && !(iexcept = LIB$MATCH_COND (&code, &cond_resignal_table [i]));
i++);
return iexcept;
@@ -1092,10 +1123,62 @@ copy_msg (struct descriptor_s *msgdesc, char *message)
return 0;
}
+/* Scan TABLE for a match for the condition contained in SIGARGS,
+ and return the entry, or the empty entry if no match found. */
+
+static const struct cond_except *
+ scan_conditions ( int *sigargs, const struct cond_except *table [])
+{
+ int i;
+ struct cond_except entry;
+
+ /* Scan the exception condition table for a match and fetch
+ the associated GNAT exception pointer. */
+ for (i = 0; (*table) [i].cond; i++)
+ {
+ unsigned int match = LIB$MATCH_COND (&sigargs [1], &(*table) [i].cond);
+ const struct cond_subtests *subtests = (*table) [i].subtests;
+
+ if (match)
+ {
+ if (!subtests)
+ {
+ return &(*table) [i];
+ }
+ else
+ {
+ unsigned int ii;
+ int num = (*subtests).num;
+
+ /* Perform subtests to differentiate exception. */
+ for (ii = 0; ii < num; ii++)
+ {
+ unsigned int arg = (*subtests).sigargs [ii].sigarg;
+ unsigned int argval = (*subtests).sigargs [ii].sigargval;
+
+ if (sigargs [arg] != argval)
+ {
+ num = 0;
+ break;
+ }
+ }
+
+ /* All subtests passed. */
+ if (num == (*subtests).num)
+ return &(*table) [i];
+ }
+ }
+ }
+
+ /* No match, return the null terminating entry. */
+ return &(*table) [i];
+}
+
long
__gnat_handle_vms_condition (int *sigargs, void *mechargs)
{
struct Exception_Data *exception = 0;
+ unsigned int needs_adjust = 0;
Exception_Code base_code;
struct descriptor_s gnat_facility = {4, 0, "GNAT"};
char message [Default_Exception_Msg_Max_Length];
@@ -1106,112 +1189,60 @@ __gnat_handle_vms_condition (int *sigargs, void *mechargs)
Import_Exception. */
if (__gnat_resignal_p (sigargs [1]))
return SS$_RESIGNAL;
+#ifndef IN_RTS
+ /* toplev.c handles this for compiler. */
+ if (sigargs [1] == SS$_HPARITH)
+ return SS$_RESIGNAL;
+#endif
#ifdef IN_RTS
/* See if it's an imported exception. Beware that registered exceptions
are bound to their base code, with the severity bits masked off. */
base_code = Base_Code_In ((Exception_Code) sigargs[1]);
exception = Coded_Exception (base_code);
-
- if (exception)
- {
- message[0] = 0;
-
- /* Subtract PC & PSL fields which messes with PUTMSG. */
- sigargs[0] -= 2;
- SYS$PUTMSG (sigargs, copy_msg, &gnat_facility, message);
- sigargs[0] += 2;
- msg = message;
-
- exception->Name_Length = 19;
- /* ??? The full name really should be get SYS$GETMSG returns. */
- exception->Full_Name = "IMPORTED_EXCEPTION";
- exception->Import_Code = base_code;
-
-#ifdef __IA64
- /* Do not adjust the program counter as already points to the next
- instruction (just after the call to LIB$STOP). */
- Raise_From_Signal_Handler (exception, msg);
-#endif
- }
#endif
if (exception == 0)
- switch (sigargs[1])
- {
- case SS$_ACCVIO:
- if (sigargs[3] == 0)
- {
- exception = &constraint_error;
- msg = "access zero";
- }
- else
- {
- exception = &storage_error;
- msg = "stack overflow or erroneous memory access";
- }
- __gnat_adjust_context_for_raise (SS$_ACCVIO, (void *)mechargs);
- break;
-
- case SS$_STKOVF:
- exception = &storage_error;
- msg = "stack overflow";
- __gnat_adjust_context_for_raise (SS$_STKOVF, (void *)mechargs);
- break;
-
- case SS$_HPARITH:
-#ifndef IN_RTS
- return SS$_RESIGNAL; /* toplev.c handles for compiler */
-#else
- exception = &constraint_error;
- msg = "arithmetic error";
- __gnat_adjust_context_for_raise (SS$_HPARITH, (void *)mechargs);
-#endif
- break;
-
- default:
#ifdef IN_RTS
+ {
+ int i;
+ struct cond_except cond;
+ const struct cond_except *cond_table;
+ const struct cond_except *cond_tables [] = {dec_ada_cond_except_table,
+ system_cond_except_table,
+ 0};
+
+ i = 0;
+ while ((cond_table = cond_tables[i++]) && !exception)
{
- int i;
-
- /* Scan the DEC Ada exception condition table for a match and fetch
- the associated GNAT exception pointer. */
- for (i = 0;
- dec_ada_cond_except_table [i].cond &&
- !LIB$MATCH_COND (&sigargs [1],
- &dec_ada_cond_except_table [i].cond);
- i++);
- exception = (struct Exception_Data *)
- dec_ada_cond_except_table [i].except;
-
- if (!exception)
- {
- /* Scan the VMS standard condition table for a match and fetch
- the associated GNAT exception pointer. */
- for (i = 0;
- cond_except_table[i].cond &&
- !LIB$MATCH_COND (&sigargs[1], &cond_except_table[i].cond);
- i++);
- exception = (struct Exception_Data *)
- cond_except_table [i].except;
-
- if (!exception)
- /* User programs expect Non_Ada_Error to be raised, reference
- DEC Ada test CXCONDHAN. */
- exception = &Non_Ada_Error;
- }
+ cond = *scan_conditions (sigargs, &cond_table);
+ exception = (struct Exception_Data *) cond.except;
}
+
+ if (exception)
+ needs_adjust = cond.needs_adjust;
+ else
+ /* User programs expect Non_Ada_Error to be raised if no match,
+ reference DEC Ada test CXCONDHAN. */
+ exception = &Non_Ada_Error;
+ }
#else
- exception = &program_error;
+ {
+ /* Pretty much everything is just a program error in the compiler */
+ exception = &program_error;
+ }
#endif
- message[0] = 0;
- /* Subtract PC & PSL fields which messes with PUTMSG. */
- sigargs[0] -= 2;
- SYS$PUTMSG (sigargs, copy_msg, &gnat_facility, message);
- sigargs[0] += 2;
- msg = message;
- break;
- }
+
+ message[0] = 0;
+ /* Subtract PC & PSL fields as per ABI for SYS$PUTMSG. */
+ sigargs[0] -= 2;
+ SYS$PUTMSG (sigargs, copy_msg, &gnat_facility, message);
+ /* Add back PC & PSL fields as per ABI for SYS$PUTMSG. */
+ sigargs[0] += 2;
+ msg = message;
+
+ if (needs_adjust)
+ __gnat_adjust_context_for_raise (sigargs [1], (void *)mechargs);
Raise_From_Signal_Handler (exception, msg);
}
@@ -1244,11 +1275,11 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
if (signo == SS$_HPARITH)
{
/* Sub one to the address of the instruction signaling the condition,
- located in the sigargs array. */
+ located in the sigargs array. */
CHF$MECH_ARRAY * mechargs = (CHF$MECH_ARRAY *) ucontext;
CHF$SIGNAL_ARRAY * sigargs
- = (CHF$SIGNAL_ARRAY *) mechargs->chf$q_mch_sig_addr;
+ = (CHF$SIGNAL_ARRAY *) mechargs->chf$q_mch_sig_addr;
int vcount = sigargs->chf$is_sig_args;
int * pc_slot = & (&sigargs->chf$l_sig_name)[vcount-2];
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index 7e1141a9be7..6b92d27cb13 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -34,10 +34,6 @@
in a separate file/object so that users can replace it easily.
The default implementation should be null on most targets. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* The following include is here to meet the published VxWorks requirement
that the __vxworks header appear before any other include. */
#ifdef __vxworks
@@ -57,6 +53,10 @@ extern "C" {
#include "raise.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/******************************************/
/* __gnat_initialize (NT-mingw32 Version) */
/******************************************/
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index c3947ed2efd..cba417507b6 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -699,11 +699,11 @@ package body Inline is
Error_Msg_Unit_1 := Bname;
Error_Msg_N
- ("one or more inlined subprograms accessed in $!?",
+ ("one or more inlined subprograms accessed in $!??",
Comp_Unit);
Error_Msg_File_1 :=
Get_File_Name (Bname, Subunit => False);
- Error_Msg_N ("\but file{ was not found!?", Comp_Unit);
+ Error_Msg_N ("\but file{ was not found!??", Comp_Unit);
else
-- If the package to be inlined is an ancestor unit of
@@ -882,11 +882,11 @@ package body Inline is
then
Error_Msg_Node_2 := Child_Spec;
Error_Msg_NE
- ("body of & depends on child unit&?",
- With_Clause, P);
+ ("body of & depends on child unit&??",
+ With_Clause, P);
Error_Msg_N
- ("\subprograms in body cannot be inlined?",
- With_Clause);
+ ("\subprograms in body cannot be inlined??",
+ With_Clause);
-- Disable further inlining from this unit,
-- and keep Taft-amendment types incomplete.
@@ -916,8 +916,8 @@ package body Inline is
elsif Ineffective_Inline_Warnings then
Error_Msg_Unit_1 := Bname;
Error_Msg_N
- ("unable to inline subprograms defined in $?", P);
- Error_Msg_N ("\body not found?", P);
+ ("unable to inline subprograms defined in $??", P);
+ Error_Msg_N ("\body not found??", P);
return;
end if;
end if;
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index 651107f24c4..3ac620ca4ca 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -2435,7 +2435,7 @@ package body Layout is
Convention (E) = Convention_CPP)
then
Error_Msg_N
- ("?this access type does not correspond to C pointer", E);
+ ("?x?this access type does not correspond to C pointer", E);
end if;
-- If the designated type is a limited view it is unanalyzed. We can
@@ -2804,7 +2804,7 @@ package body Layout is
begin
if Spec > Max then
Error_Msg_Uint_1 := Spec - Max;
- Error_Msg_NE ("?^ bits of & unused", SC, E);
+ Error_Msg_NE ("??^ bits of & unused", SC, E);
end if;
end Check_Unused_Bits;
@@ -2883,8 +2883,8 @@ package body Layout is
and then not Is_Atomic (E)
then
if not Size_Known_At_Compile_Time (E) then
- Error_Msg_N ("Optimize_Alignment has no effect for &", E);
- Error_Msg_N ("\pragma is ignored for variable length record?", E);
+ Error_Msg_N ("Optimize_Alignment has no effect for &??", E);
+ Error_Msg_N ("\pragma is ignored for variable length record??", E);
else
Align := 1;
end if;
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index aa9031f835c..2f01dd4480f 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -597,7 +597,7 @@ package body Lib.Xref is
and then Warn_On_Ada_2005_Compatibility
and then (Typ = 'm' or else Typ = 'r' or else Typ = 's')
then
- Error_Msg_NE ("& is only defined in Ada 2005?", N, E);
+ Error_Msg_NE ("& is only defined in Ada 2005?y?", N, E);
end if;
-- Warn if reference to Ada 2012 entity not in Ada 2012 mode. We only
@@ -609,7 +609,7 @@ package body Lib.Xref is
and then Warn_On_Ada_2012_Compatibility
and then (Typ = 'm' or else Typ = 'r')
then
- Error_Msg_NE ("& is only defined in Ada 2012?", N, E);
+ Error_Msg_NE ("& is only defined in Ada 2012?y?", N, E);
end if;
-- Never collect references if not in main source unit. However, we omit
@@ -841,7 +841,7 @@ package body Lib.Xref is
while Present (BE) loop
if Chars (BE) = Chars (E) then
Error_Msg_NE -- CODEFIX
- ("?pragma Unreferenced given for&!", N, BE);
+ ("??pragma Unreferenced given for&!", N, BE);
exit;
end if;
diff --git a/gcc/ada/opt.adb b/gcc/ada/opt.adb
index a6c15538c28..98eab409877 100644
--- a/gcc/ada/opt.adb
+++ b/gcc/ada/opt.adb
@@ -57,6 +57,7 @@ package body Opt is
Ada_Version_Explicit_Config := Ada_Version_Explicit;
Assertions_Enabled_Config := Assertions_Enabled;
Assume_No_Invalid_Values_Config := Assume_No_Invalid_Values;
+ Check_Float_Overflow_Config := Check_Float_Overflow;
Check_Policy_List_Config := Check_Policy_List;
Debug_Pragmas_Disabled_Config := Debug_Pragmas_Disabled;
Debug_Pragmas_Enabled_Config := Debug_Pragmas_Enabled;
@@ -91,6 +92,7 @@ package body Opt is
Ada_Version_Explicit := Save.Ada_Version_Explicit;
Assertions_Enabled := Save.Assertions_Enabled;
Assume_No_Invalid_Values := Save.Assume_No_Invalid_Values;
+ Check_Float_Overflow := Save.Check_Float_Overflow;
Check_Policy_List := Save.Check_Policy_List;
Debug_Pragmas_Disabled := Save.Debug_Pragmas_Disabled;
Debug_Pragmas_Enabled := Save.Debug_Pragmas_Enabled;
@@ -127,6 +129,7 @@ package body Opt is
Save.Ada_Version_Explicit := Ada_Version_Explicit;
Save.Assertions_Enabled := Assertions_Enabled;
Save.Assume_No_Invalid_Values := Assume_No_Invalid_Values;
+ Save.Check_Float_Overflow := Check_Float_Overflow;
Save.Check_Policy_List := Check_Policy_List;
Save.Debug_Pragmas_Disabled := Debug_Pragmas_Disabled;
Save.Debug_Pragmas_Enabled := Debug_Pragmas_Enabled;
@@ -198,6 +201,7 @@ package body Opt is
Ada_Version_Explicit := Ada_Version_Explicit_Config;
Assertions_Enabled := Assertions_Enabled_Config;
Assume_No_Invalid_Values := Assume_No_Invalid_Values_Config;
+ Check_Float_Overflow := Check_Float_Overflow_Config;
Check_Policy_List := Check_Policy_List_Config;
Debug_Pragmas_Disabled := Debug_Pragmas_Disabled_Config;
Debug_Pragmas_Enabled := Debug_Pragmas_Enabled_Config;
@@ -255,6 +259,7 @@ package body Opt is
Tree_Read_Int (Assertions_Enabled_Config_Val);
Tree_Read_Bool (All_Errors_Mode);
Tree_Read_Bool (Assertions_Enabled);
+ Tree_Read_Bool (Check_Float_Overflow);
Tree_Read_Int (Int (Check_Policy_List));
Tree_Read_Bool (Debug_Pragmas_Disabled);
Tree_Read_Bool (Debug_Pragmas_Enabled);
@@ -321,6 +326,7 @@ package body Opt is
Tree_Write_Int (Boolean'Pos (Assertions_Enabled_Config));
Tree_Write_Bool (All_Errors_Mode);
Tree_Write_Bool (Assertions_Enabled);
+ Tree_Write_Bool (Check_Float_Overflow);
Tree_Write_Int (Int (Check_Policy_List));
Tree_Write_Bool (Debug_Pragmas_Disabled);
Tree_Write_Bool (Debug_Pragmas_Enabled);
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index b8d169700dc..2b68d796993 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -174,7 +174,8 @@ package Opt is
Address_Clause_Overlay_Warnings : Boolean := True;
-- GNAT
- -- Set False to disable address clause warnings
+ -- Set False to disable address clause warnings. Modified by use of
+ -- -gnatwo/O.
Address_Is_Private : Boolean := False;
-- GNAT, GNATBIND
@@ -211,10 +212,9 @@ package Opt is
-- Enable assertions made using pragma Assert
Assume_No_Invalid_Values : Boolean := False;
- -- GNAT
- -- Normally, in accordance with (RM 13.9.1 (9-11)) the front end assumes
- -- that values could have invalid representations, unless it can clearly
- -- prove that the values are valid. If this switch is set (by -gnatB or by
+ -- GNAT Normally, in accordance with (RM 13.9.1 (9-11)) the front end
+ -- assumes that values could have invalid representations, unless it can
+ -- clearly prove that the values are valid. If this switch is set (by
-- pragma Assume_No_Invalid_Values (Off)), then the compiler assumes values
-- are valid and in range of their representations. This feature is now
-- fully enabled in the compiler.
@@ -276,6 +276,13 @@ package Opt is
-- Set to True to detect whether subprogram parameters and function results
-- alias the same object(s).
+ Check_Float_Overflow : Boolean := False;
+ -- GNAT
+ -- Set to True to check that operations on predefined unconstrained float
+ -- types (e.g. Float, Long_Float) do not overflow and generate infinities
+ -- or invalid values. Set by the Check_Float_Overflow pragma, or by use
+ -- of the -gnateF switch.
+
Check_Object_Consistency : Boolean := False;
-- GNATBIND, GNATMAKE
-- Set to True to check whether every object file is consistent with
@@ -318,6 +325,7 @@ package Opt is
-- GNAT
-- Set to True to enable checking for unreferenced entities other
-- than formal parameters (for which see Check_Unreferenced_Formals)
+ -- Modified by use of -gnatwu/U.
Check_Unreferenced_Formals : Boolean := False;
-- GNAT
@@ -333,6 +341,7 @@ package Opt is
-- GNAT
-- Set to True to enable checking for unused withs, and also the case
-- of withing a package and using none of the entities in the package.
+ -- Modified by use of -gnatwu/U.
CodePeer_Mode : Boolean := False;
-- GNAT, GNATBIND
@@ -374,7 +383,8 @@ package Opt is
Constant_Condition_Warnings : Boolean := False;
-- GNAT
- -- Set to True to activate warnings on constant conditions
+ -- Set to True to activate warnings on constant conditions. Modified by
+ -- use of -gnatwc/C.
Create_Mapping_File : Boolean := False;
-- GNATMAKE, GPRMAKE
@@ -553,8 +563,7 @@ package Opt is
Extensions_Allowed : Boolean := False;
-- GNAT
-- Set to True by switch -gnatX if GNAT specific language extensions
- -- are allowed. For example, the use of 'Constrained with objects of
- -- generic types is a GNAT extension.
+ -- are allowed. Currently there are no such defined extensions.
type External_Casing_Type is (
As_Is, -- External names cased as they appear in the Ada source
@@ -714,7 +723,7 @@ package Opt is
Implementation_Unit_Warnings : Boolean := True;
-- GNAT
-- Set True to active warnings for use of implementation internal units.
- -- Can be controlled by use of -gnatwi/-gnatwI.
+ -- Modified by use of -gnatwi/-gnatwI.
Implicit_Packing : Boolean := False;
-- GNAT
@@ -824,8 +833,7 @@ package Opt is
-- GNAT
-- List inherited invariants, preconditions, and postconditions from
-- Invariant'Class, Pre'Class, and Post'Class aspects. Also list inherited
- -- subtype predicates. Set True by use of -gnatw.l and False by use of
- -- -gnatw.L.
+ -- subtype predicates. Modified by use of -gnatw.l/.L.
List_Restrictions : Boolean := False;
-- GNATBIND
@@ -1019,7 +1027,7 @@ package Opt is
Object_Path_File_Name : String_Ptr := null;
-- GNAT2WHY
-- Path of the temporary file that contains a list of object directories
- -- passed by -gnateO=<obj_pat_file>.
+ -- passed by -gnateO=<obj_path_file>.
One_Compilation_Per_Obj_Dir : Boolean := False;
-- GNATMAKE, GPRBUILD
@@ -1467,47 +1475,48 @@ package Opt is
-- GNAT
-- Set to True to generate all warnings on Ada 2005 compatibility issues,
-- including warnings on Ada 2005 obsolescent features used in Ada 2005
- -- mode. Set False by -gnatwY.
+ -- mode. Set by default, modified by use of -gnatwy/Y.
Warn_On_Ada_2012_Compatibility : Boolean := True;
-- GNAT
-- Set to True to generate all warnings on Ada 2012 compatibility issues,
-- including warnings on Ada 2012 obsolescent features used in Ada 2012
- -- mode. Set False by -gnatwY.
+ -- mode. Modified by use of -gnatwy/Y.
Warn_On_All_Unread_Out_Parameters : Boolean := False;
-- GNAT
-- Set to True to generate warnings in all cases where a variable is
-- modified by being passed as to an OUT formal, but the resulting value is
- -- never read. The default is that this warning is suppressed, except in
- -- the case of
+ -- never read. The default is that this warning is suppressed. Modified
+ -- by use of gnatw.o/.O.
Warn_On_Assertion_Failure : Boolean := True;
-- GNAT
-- Set to True to activate warnings on assertions that can be determined
- -- at compile time will always fail. Set false by -gnatw.A.
+ -- at compile time will always fail. Modified by use of -gnatw.a/.A.
Warn_On_Assumed_Low_Bound : Boolean := True;
-- GNAT
-- Set to True to activate warnings for string parameters that are indexed
- -- with literals or S'Length, presumably assuming a lower bound of one. Set
- -- False by -gnatwW.
+ -- with literals or S'Length, presumably assuming a lower bound of one.
+ -- Modified by use of -gnatww/W.
Warn_On_Atomic_Synchronization : Boolean := False;
-- GNAT
-- Set to True to generate information messages for atomic synchronization.
- -- Set True by use of -gnatw.n.
+ -- Modified by use of -gnatw.n/.N.
Warn_On_Bad_Fixed_Value : Boolean := False;
-- GNAT
-- Set to True to generate warnings for static fixed-point expression
-- values that are not an exact multiple of the small value of the type.
+ -- Odd by default, modified by use of -gnatwb/B.
Warn_On_Biased_Representation : Boolean := True;
-- GNAT
-- Set to True to generate warnings for size clauses, component clauses
- -- and component_size clauses that force biased representation. Set False
- -- by -gnatw.B.
+ -- and component_size clauses that force biased representation. Modified
+ -- by use of -gnatw.b/.B.
Warn_On_Constant : Boolean := False;
-- GNAT
@@ -1533,20 +1542,23 @@ package Opt is
Warn_On_Hiding : Boolean := False;
-- GNAT
-- Set to True to generate warnings if a declared entity hides another
- -- entity. The default is that this warning is suppressed.
+ -- entity. The default is that this warning is suppressed. Modified by
+ -- use of -gnatwh/H.
Warn_On_Modified_Unread : Boolean := False;
-- GNAT
-- Set to True to generate warnings if a variable is assigned but is never
-- read. Also controls warnings for similar cases involving out parameters,
-- but only if there is only one out parameter for the procedure involved.
- -- The default is that this warning is suppressed.
+ -- The default is that this warning is suppressed, modified by use of
+ -- -gnatwm/M.
Warn_On_No_Value_Assigned : Boolean := True;
-- GNAT
-- Set to True to generate warnings if no value is ever assigned to a
-- variable that is at least partially uninitialized. Set to false to
-- suppress such warnings. The default is that such warnings are enabled.
+ -- Modified by use of -gnatwv/V.
Warn_On_Non_Local_Exception : Boolean := False;
-- GNAT
@@ -1556,6 +1568,7 @@ package Opt is
-- default is not to generate the warnings except that if the source has
-- at least one exception handler, and this restriction is set, and the
-- warning was not explicitly turned off, then it is turned on by default.
+ -- Modified by use of -gnatw.x/.X.
No_Warn_On_Non_Local_Exception : Boolean := False;
-- GNAT
@@ -1566,22 +1579,26 @@ package Opt is
Warn_On_Object_Renames_Function : Boolean := False;
-- GNAT
-- Set to True to generate warnings when a function result is renamed as
- -- an object. The default is that this warning is disabled.
+ -- an object. The default is that this warning is disabled. Modified by
+ -- use of -gnatw.r/.R.
Warn_On_Obsolescent_Feature : Boolean := False;
-- GNAT
-- Set to True to generate warnings on use of any feature in Annex or if a
- -- subprogram is called for which a pragma Obsolescent applies.
+ -- subprogram is called for which a pragma Obsolescent applies. Modified
+ -- by use of -gnatwj/J.
Warn_On_Overlap : Boolean := False;
-- GNAT
-- Set to True to generate warnings when a writable actual which is not
-- a by-copy type overlaps with another actual in a subprogram call.
+ -- Modified by use of -gnatw.i/.I.
Warn_On_Questionable_Missing_Parens : Boolean := True;
-- GNAT
-- Set to True to generate warnings for cases where parentheses are missing
- -- and the usage is questionable, because the intent is unclear.
+ -- and the usage is questionable, because the intent is unclear. On by
+ -- default, modified by use of -gnatwq/Q.
Warn_On_Parameter_Order : Boolean := False;
-- GNAT
@@ -1593,53 +1610,54 @@ package Opt is
-- GNAT
-- Set to True to generate warnings for redundant constructs (e.g. useless
-- assignments/conversions). The default is that this warning is disabled.
+ -- Modified by use of -gnatwr/R.
Warn_On_Reverse_Bit_Order : Boolean := True;
-- GNAT
-- Set to True to generate warning (informational) messages for component
-- clauses that are affected by non-standard bit-order. The default is
- -- that this warning is enabled.
+ -- that this warning is enabled. Modified by -gnatw.v/.V.
- Warn_On_Suspicious_Contract : Boolean := False;
+ Warn_On_Suspicious_Contract : Boolean := True;
-- GNAT
-- Set to True to generate warnings for suspicious contracts expressed as
-- pragmas or aspects precondition and postcondition. The default is that
- -- this warning is disabled.
+ -- this warning is enabled. Modified by use of -gnatw.t/.T.
Warn_On_Suspicious_Modulus_Value : Boolean := True;
-- GNAT
-- Set to True to generate warnings for suspicious modulus values. The
- -- default is that this warning is enabled.
+ -- default is that this warning is enabled. Modified by -gnatw.m/.M.
Warn_On_Unchecked_Conversion : Boolean := True;
-- GNAT
-- Set to True to generate warnings for unchecked conversions that may have
- -- non-portable semantics (e.g. because sizes of types differ). The default
- -- is that this warning is enabled.
+ -- non-portable semantics (e.g. because sizes of types differ). Modified
+ -- by use of -gnatwz/Z.
Warn_On_Unordered_Enumeration_Type : Boolean := False;
-- GNAT
-- Set to True to generate warnings for inappropriate uses (comparisons
-- and explicit ranges) on unordered enumeration types (which includes
-- all enumeration types for which pragma Ordered is not given). The
- -- default is that this warning is disabled.
+ -- default is that this warning is disabled. Modified by -gnat.u/.U.
Warn_On_Unrecognized_Pragma : Boolean := True;
-- GNAT
-- Set to True to generate warnings for unrecognized pragmas. The default
- -- is that this warning is enabled.
+ -- is that this warning is enabled. Modified by use of -gnatwg/G.
Warn_On_Unrepped_Components : Boolean := False;
-- GNAT
-- Set to True to generate warnings for the case of components of record
-- which have a record representation clause but this component does not
- -- have a component clause. The default is that this warning is disabled.
+ -- have a component clause. Modified by use of -gnatw.c/.C.
Warn_On_Warnings_Off : Boolean := False;
-- GNAT
-- Set to True to generate warnings for use of Pragma Warnings (Off, ent),
-- where either the pragma is never used, or it could be replaced by a
- -- pragma Unmodified or Unreferenced.
+ -- pragma Unmodified or Unreferenced. Modified by use of -gnatw.w/.W.
type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
Warning_Mode : Warning_Mode_Type := Normal;
@@ -1714,6 +1732,13 @@ package Opt is
-- -gnatB, and possibly modified by the use of the configuration pragma
-- Assume_No_Invalid_Values.
+ Check_Float_Overflow_Config : Boolean;
+ -- GNAT
+ -- Set to True to check that operations on predefined unconstrained float
+ -- types (e.g. Float, Long_Float) do not overflow and generate infinities
+ -- or invalid values. Set by the Check_Float_Overflow pragma, or by use
+ -- of the -gnateF switch.
+
Check_Policy_List_Config : Node_Id;
-- GNAT
-- This points to the list of N_Pragma nodes for Check_Policy pragmas
@@ -1969,6 +1994,7 @@ private
Ada_Version_Explicit : Ada_Version_Type;
Assertions_Enabled : Boolean;
Assume_No_Invalid_Values : Boolean;
+ Check_Float_Overflow : Boolean;
Check_Policy_List : Node_Id;
Debug_Pragmas_Disabled : Boolean;
Debug_Pragmas_Enabled : Boolean;
diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads
index 094fee3f52f..48a7d8e44c1 100644
--- a/gcc/ada/osint.ads
+++ b/gcc/ada/osint.ads
@@ -73,7 +73,7 @@ package Osint is
-- found. Note that for the special case of gnat.adc, only the compilation
-- environment directory is searched, i.e. the directory where the ali and
-- object files are written. Another special case is Debug_Generated_Code
- -- set and the file name ends on ".dg", in which case we look for the
+ -- set and the file name ends in ".dg", in which case we look for the
-- generated file only in the current directory, since that is where it is
-- always built.
diff --git a/gcc/ada/par-ch10.adb b/gcc/ada/par-ch10.adb
index 08553dd0376..ddd88b3eea3 100644
--- a/gcc/ada/par-ch10.adb
+++ b/gcc/ada/par-ch10.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -314,8 +314,9 @@ package body Ch10 is
-- Do not complain if there is a pragma No_Body
if not No_Body then
- Error_Msg_SC ("?file contains no compilation units");
+ Error_Msg_SC ("??file contains no compilation units");
end if;
+
else
Error_Msg_SC ("compilation unit expected");
Cunit_Error_Flag := True;
diff --git a/gcc/ada/par-labl.adb b/gcc/ada/par-labl.adb
index 9bafb07b7d1..f709dd088ee 100644
--- a/gcc/ada/par-labl.adb
+++ b/gcc/ada/par-labl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -81,6 +81,7 @@ procedure Labl is
-- Note that in the worst case, this is quadratic in the number
-- of labels. However, labels are not all that common, and this
-- is only called for explicit labels.
+
-- ???Nonetheless, the efficiency could be improved. For example,
-- call Labl for each body, rather than once per compilation.
@@ -356,7 +357,7 @@ procedure Labl is
Remove (Loop_Header);
Rewrite (Loop_End, Loop_Stmt);
Error_Msg_N
- ("info: code between label and backwards goto rewritten as loop?",
+ ("info: code between label and backwards goto rewritten as loop??",
Loop_End);
end Rewrite_As_Loop;
diff --git a/gcc/ada/par-load.adb b/gcc/ada/par-load.adb
index e30ffc02a02..f5bf99d9d9e 100644
--- a/gcc/ada/par-load.adb
+++ b/gcc/ada/par-load.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -172,7 +172,7 @@ begin
then
Error_Msg_File_1 := File_Name;
Error_Msg
- ("?file name does not match unit name, should be{", Sloc (Curunit));
+ ("??file name does not match unit name, should be{", Sloc (Curunit));
end if;
-- For units other than the main unit, the expected unit name is set and
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index e1f394b2853..579dd374a13 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -1106,6 +1106,7 @@ begin
Pragma_Attach_Handler |
Pragma_Attribute_Definition |
Pragma_Check |
+ Pragma_Check_Float_Overflow |
Pragma_Check_Name |
Pragma_Check_Policy |
Pragma_CIL_Constructor |
diff --git a/gcc/ada/par-util.adb b/gcc/ada/par-util.adb
index 3baf9f51f57..fa592a7ea50 100644
--- a/gcc/ada/par-util.adb
+++ b/gcc/ada/par-util.adb
@@ -186,7 +186,7 @@ package body Util is
or else (Token_Name = Name_Interface
and then Prev_Token /= Tok_Pragma)
then
- Error_Msg_N ("& is a reserved word in Ada 2005?", Token_Node);
+ Error_Msg_N ("& is a reserved word in Ada 2005?y?", Token_Node);
end if;
end if;
@@ -196,7 +196,7 @@ package body Util is
and then Warn_On_Ada_2012_Compatibility
then
if Token_Name = Name_Some then
- Error_Msg_N ("& is a reserved word in Ada 2012?", Token_Node);
+ Error_Msg_N ("& is a reserved word in Ada 2012?y?", Token_Node);
end if;
end if;
@@ -761,7 +761,7 @@ package body Util is
C : constant Entity_Id := Current_Entity (N);
begin
if Present (C) and then Sloc (C) = Standard_Location then
- Error_Msg_N ("redefinition of entity& in Standard?", N);
+ Error_Msg_N ("redefinition of entity& in Standard?K?", N);
end if;
end;
end if;
diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb
index c2c522cb520..54fe0ddb8d7 100644
--- a/gcc/ada/par_sco.adb
+++ b/gcc/ada/par_sco.adb
@@ -154,19 +154,35 @@ package body Par_SCO is
-- Process L, a list of statements or declarations dominated by D.
-- If P is present, it is processed as though it had been prepended to L.
- procedure Traverse_Generic_Instantiation (N : Node_Id);
+ function Traverse_Declarations_Or_Statements
+ (L : List_Id;
+ D : Dominant_Info := No_Dominant;
+ P : Node_Id := Empty) return Dominant_Info;
+ -- Same as above, and returns dominant information corresponding to the
+ -- last node with SCO in L.
+
+ -- The following Traverse_* routines perform appropriate calls to
+ -- Traverse_Declarations_Or_Statements to traverse specific node kinds.
+ -- Parameter D, when present, indicates the dominant of the first
+ -- declaration or statement within N.
+
+ -- Why is Traverse_Sync_Definition commented specificaly and
+ -- the others are not???
+
procedure Traverse_Generic_Package_Declaration (N : Node_Id);
procedure Traverse_Handled_Statement_Sequence
(N : Node_Id;
D : Dominant_Info := No_Dominant);
- procedure Traverse_Package_Body (N : Node_Id);
- procedure Traverse_Package_Declaration (N : Node_Id);
- procedure Traverse_Protected_Body (N : Node_Id);
+ procedure Traverse_Package_Body (N : Node_Id);
+ procedure Traverse_Package_Declaration
+ (N : Node_Id;
+ D : Dominant_Info := No_Dominant);
procedure Traverse_Subprogram_Or_Task_Body
(N : Node_Id;
D : Dominant_Info := No_Dominant);
- procedure Traverse_Subprogram_Declaration (N : Node_Id);
- -- Traverse the corresponding construct, generating SCO table entries
+
+ procedure Traverse_Sync_Definition (N : Node_Id);
+ -- Traverse a protected definition or task definition
procedure Write_SCOs_To_ALI_File is new Put_SCOs;
-- Write SCO information to the ALI file using routines in Lib.Util
@@ -900,6 +916,23 @@ package body Par_SCO is
Lu : Node_Id;
From : Nat;
+ procedure Traverse_Aux_Decls (N : Node_Id);
+ -- Traverse the Aux_Decl_Nodes of compilation unit N
+
+ ------------------------
+ -- Traverse_Aux_Decls --
+ ------------------------
+
+ procedure Traverse_Aux_Decls (N : Node_Id) is
+ ADN : constant Node_Id := Aux_Decls_Node (N);
+ begin
+ Traverse_Declarations_Or_Statements (Config_Pragmas (ADN));
+ Traverse_Declarations_Or_Statements (Declarations (ADN));
+ Traverse_Declarations_Or_Statements (Pragmas_After (ADN));
+ end Traverse_Aux_Decls;
+
+ -- Start of processing for SCO_Record
+
begin
-- Ignore call if not generating code and generating SCO's
@@ -929,27 +962,20 @@ package body Par_SCO is
-- Traverse the unit
- case Nkind (Lu) is
- when N_Protected_Body =>
- Traverse_Protected_Body (Lu);
-
- when N_Subprogram_Body | N_Task_Body =>
- Traverse_Subprogram_Or_Task_Body (Lu);
-
- when N_Subprogram_Declaration =>
- Traverse_Subprogram_Declaration (Lu);
+ Traverse_Aux_Decls (Cunit (U));
- when N_Package_Declaration =>
- Traverse_Package_Declaration (Lu);
-
- when N_Package_Body =>
- Traverse_Package_Body (Lu);
-
- when N_Generic_Package_Declaration =>
- Traverse_Generic_Package_Declaration (Lu);
-
- when N_Generic_Instantiation =>
- Traverse_Generic_Instantiation (Lu);
+ case Nkind (Lu) is
+ when
+ N_Package_Declaration |
+ N_Package_Body |
+ N_Subprogram_Declaration |
+ N_Subprogram_Body |
+ N_Generic_Package_Declaration |
+ N_Protected_Body |
+ N_Task_Body |
+ N_Generic_Instantiation =>
+
+ Traverse_Declarations_Or_Statements (L => No_List, P => Lu);
when others =>
@@ -1012,8 +1038,7 @@ package body Par_SCO is
-- original source occurrence of the pragma.
if not (Generate_SCO
- and then
- In_Extended_Main_Source_Unit (Cunit_Entity (Current_Sem_Unit))
+ and then In_Extended_Main_Source_Unit (Loc)
and then not (In_Instance or In_Inlined_Body))
then
return;
@@ -1025,10 +1050,15 @@ package body Par_SCO is
Index := Condition_Pragma_Hash_Table.Get (Loc);
- -- The test here for zero is to deal with possible previous errors
+ -- A zero index here indicates that semantic analysis found an
+ -- activated pragma at Loc which does not have a corresponding pragma
+ -- or aspect at the syntax level. This may occur in legitimate cases
+ -- because of expanded code (such are Pre/Post conditions generated for
+ -- formal parameter validity checks), or as a consequence of a previous
+ -- error.
if Index = 0 then
- Check_Error_Detected;
+ return;
else
declare
@@ -1172,6 +1202,17 @@ package body Par_SCO is
D : Dominant_Info := No_Dominant;
P : Node_Id := Empty)
is
+ Discard_Dom : Dominant_Info;
+ pragma Warnings (Off, Discard_Dom);
+ begin
+ Discard_Dom := Traverse_Declarations_Or_Statements (L, D, P);
+ end Traverse_Declarations_Or_Statements;
+
+ function Traverse_Declarations_Or_Statements
+ (L : List_Id;
+ D : Dominant_Info := No_Dominant;
+ P : Node_Id := Empty) return Dominant_Info
+ is
Current_Dominant : Dominant_Info := D;
-- Dominance information for the current basic block
@@ -1191,12 +1232,13 @@ package body Par_SCO is
procedure Set_Statement_Entry;
-- Output CS entries for all statements saved in table SC, and end the
- -- current CS sequence.
+ -- current CS sequence. Then output entries for all decisions nested in
+ -- these statements, which have been deferred so far.
procedure Process_Decisions_Defer (N : Node_Id; T : Character);
pragma Inline (Process_Decisions_Defer);
-- This routine is logically the same as Process_Decisions, except that
- -- the arguments are saved in the SD table, for later processing when
+ -- the arguments are saved in the SD table for later processing when
-- Set_Statement_Entry is called, which goes through the saved entries
-- making the corresponding calls to Process_Decision.
@@ -1340,12 +1382,25 @@ package body Par_SCO is
when N_Loop_Statement =>
To_Node := Iteration_Scheme (N);
- when N_Selective_Accept |
- N_Timed_Entry_Call |
- N_Conditional_Entry_Call |
- N_Asynchronous_Select =>
+ when N_Selective_Accept |
+ N_Timed_Entry_Call |
+ N_Conditional_Entry_Call |
+ N_Asynchronous_Select |
+ N_Single_Protected_Declaration |
+ N_Single_Task_Declaration =>
T := F;
+ when N_Protected_Type_Declaration | N_Task_Type_Declaration =>
+ if Has_Aspects (N) then
+ To_Node := Last (Aspect_Specifications (N));
+
+ elsif Present (Discriminant_Specifications (N)) then
+ To_Node := Last (Discriminant_Specifications (N));
+
+ else
+ To_Node := Defining_Identifier (N);
+ end if;
+
when others =>
null;
@@ -1415,6 +1470,9 @@ package body Par_SCO is
-- entry since Set_SCO_Pragma_Enabled will be called when
-- analyzing actual checks, possibly in other units).
+ -- Pre/post can have checks in client units too because of
+ -- inheritance, so should they be moved here???
+
when Aspect_Predicate |
Aspect_Static_Predicate |
Aspect_Dynamic_Predicate |
@@ -1466,7 +1524,7 @@ package body Par_SCO is
when N_Package_Declaration =>
Set_Statement_Entry;
- Traverse_Package_Declaration (N);
+ Traverse_Package_Declaration (N, Current_Dominant);
-- Generic package declaration
@@ -1482,7 +1540,7 @@ package body Par_SCO is
-- Subprogram declaration
- when N_Subprogram_Declaration =>
+ when N_Subprogram_Declaration | N_Subprogram_Body_Stub =>
Process_Decisions_Defer
(Parameter_Specifications (Specification (N)), 'X');
@@ -1528,7 +1586,7 @@ package body Par_SCO is
when N_Protected_Body =>
Set_Statement_Entry;
- Traverse_Protected_Body (N);
+ Traverse_Declarations_Or_Statements (Declarations (N));
-- Exit statement, which is an exit statement in the SCO sense,
-- so it is included in the current statement sequence, but
@@ -1561,9 +1619,14 @@ package body Par_SCO is
when N_Block_Statement =>
Set_Statement_Entry;
- Traverse_Declarations_Or_Statements
- (L => Declarations (N),
- D => Current_Dominant);
+
+ -- The first statement in the handled sequence of statements
+ -- is dominated by the elaboration of the last declaration.
+
+ Current_Dominant := Traverse_Declarations_Or_Statements
+ (L => Declarations (N),
+ D => Current_Dominant);
+
Traverse_Handled_Statement_Sequence
(N => Handled_Statement_Sequence (N),
D => Current_Dominant);
@@ -1868,10 +1931,13 @@ package body Par_SCO is
begin
case Nam is
- when Name_Assert |
- Name_Check |
- Name_Precondition |
- Name_Postcondition =>
+ when Name_Assert |
+ Name_Assert_And_Cut |
+ Name_Assume |
+ Name_Check |
+ Name_Loop_Invariant |
+ Name_Precondition |
+ Name_Postcondition =>
-- For Assert/Check/Precondition/Postcondition, we
-- must generate a P entry for the decision. Note
@@ -1887,6 +1953,9 @@ package body Par_SCO is
Process_Decisions_Defer (Expression (Arg), 'P');
Typ := 'p';
+ -- Pre/postconditions can be inherited so SCO should
+ -- never be deactivated???
+
when Name_Debug =>
if Present (Arg) and then Present (Next (Arg)) then
@@ -1905,6 +1974,10 @@ package body Par_SCO is
-- for any embedded expressions, and the pragma is
-- never disabled.
+ -- Should generate P decisions (not X) for assertion
+ -- related pragmas: [Type_]Invariant,
+ -- [{Static,Dynamic}_]Predicate???
+
when others =>
Process_Decisions_Defer (N, 'X');
Typ := 'P';
@@ -1920,7 +1993,7 @@ package body Par_SCO is
-- Object declaration. Ignored if Prev_Ids is set, since the
-- parser generates multiple instances of the whole declaration
-- if there is more than one identifier declared, and we only
- -- want one entry in the SCO's, so we take the first, for which
+ -- want one entry in the SCOs, so we take the first, for which
-- Prev_Ids is False.
when N_Object_Declaration =>
@@ -1935,6 +2008,19 @@ package body Par_SCO is
-- All other cases, which extend the current statement sequence
-- but do not terminate it, even if they have nested decisions.
+ when N_Protected_Type_Declaration | N_Task_Type_Declaration =>
+ Extend_Statement_Sequence (N, 't');
+ Process_Decisions_Defer (Discriminant_Specifications (N), 'X');
+ Set_Statement_Entry;
+
+ Traverse_Sync_Definition (N);
+
+ when N_Single_Protected_Declaration | N_Single_Task_Declaration =>
+ Extend_Statement_Sequence (N, 'o');
+ Set_Statement_Entry;
+
+ Traverse_Sync_Definition (N);
+
when others =>
-- Determine required type character code, or ASCII.NUL if
@@ -1962,7 +2048,10 @@ package body Par_SCO is
when N_Representation_Clause |
N_Use_Package_Clause |
- N_Use_Type_Clause =>
+ N_Use_Type_Clause |
+ N_Package_Body_Stub |
+ N_Task_Body_Stub |
+ N_Protected_Body_Stub =>
Typ := ASCII.NUL;
when others =>
@@ -1989,47 +2078,31 @@ package body Par_SCO is
-- Start of processing for Traverse_Declarations_Or_Statements
begin
+ -- Process single prefixed node
+
if Present (P) then
Traverse_One (P);
end if;
- if Is_Non_Empty_List (L) then
-
- -- Loop through statements or declarations
+ -- Loop through statements or declarations
+ if Is_Non_Empty_List (L) then
N := First (L);
while Present (N) loop
Traverse_One (N);
Next (N);
end loop;
- Set_Statement_Entry;
end if;
- end Traverse_Declarations_Or_Statements;
-
- ------------------------------------
- -- Traverse_Generic_Instantiation --
- ------------------------------------
-
- procedure Traverse_Generic_Instantiation (N : Node_Id) is
- First : Source_Ptr;
- Last : Source_Ptr;
-
- begin
- -- First we need a statement entry to cover the instantiation
- Sloc_Range (N, First, Last);
- Set_Table_Entry
- (C1 => 'S',
- C2 => ' ',
- From => First,
- To => Last,
- Last => True);
+ -- End sequence of statements and flush deferred decisions
- -- Now output any embedded decisions
+ if Present (P) or else Is_Non_Empty_List (L) then
+ Set_Statement_Entry;
+ end if;
- Process_Decisions (N, 'X', No_Location);
- end Traverse_Generic_Instantiation;
+ return Current_Dominant;
+ end Traverse_Declarations_Or_Statements;
------------------------------------------
-- Traverse_Generic_Package_Declaration --
@@ -2076,30 +2149,77 @@ package body Par_SCO is
---------------------------
procedure Traverse_Package_Body (N : Node_Id) is
+ Dom : Dominant_Info;
begin
- Traverse_Declarations_Or_Statements (Declarations (N));
- Traverse_Handled_Statement_Sequence (Handled_Statement_Sequence (N));
+ -- The first statement in the handled sequence of statements is
+ -- dominated by the elaboration of the last declaration.
+
+ Dom := Traverse_Declarations_Or_Statements (Declarations (N));
+
+ Traverse_Handled_Statement_Sequence
+ (Handled_Statement_Sequence (N), Dom);
end Traverse_Package_Body;
----------------------------------
-- Traverse_Package_Declaration --
----------------------------------
- procedure Traverse_Package_Declaration (N : Node_Id) is
+ procedure Traverse_Package_Declaration
+ (N : Node_Id;
+ D : Dominant_Info := No_Dominant)
+ is
Spec : constant Node_Id := Specification (N);
+ Dom : Dominant_Info;
+
begin
- Traverse_Declarations_Or_Statements (Visible_Declarations (Spec));
- Traverse_Declarations_Or_Statements (Private_Declarations (Spec));
+ Dom :=
+ Traverse_Declarations_Or_Statements (Visible_Declarations (Spec), D);
+
+ -- First private declaration is dominated by last visible declaration
+
+ Traverse_Declarations_Or_Statements (Private_Declarations (Spec), Dom);
end Traverse_Package_Declaration;
- -----------------------------
- -- Traverse_Protected_Body --
- -----------------------------
+ ------------------------------
+ -- Traverse_Sync_Definition --
+ ------------------------------
+
+ procedure Traverse_Sync_Definition (N : Node_Id) is
+ Dom_Info : Dominant_Info := ('S', N);
+ -- The first declaration is dominated by the protected or task [type]
+ -- declaration.
+
+ Sync_Def : Node_Id;
+ -- N's protected or task definition
+
+ Vis_Decl : List_Id;
+ -- Sync_Def's Visible_Declarations
- procedure Traverse_Protected_Body (N : Node_Id) is
begin
- Traverse_Declarations_Or_Statements (Declarations (N));
- end Traverse_Protected_Body;
+ case Nkind (N) is
+ when N_Single_Protected_Declaration | N_Protected_Type_Declaration =>
+ Sync_Def := Protected_Definition (N);
+
+ when N_Single_Task_Declaration | N_Task_Type_Declaration =>
+ Sync_Def := Task_Definition (N);
+
+ when others =>
+ raise Program_Error;
+ end case;
+
+ Vis_Decl := Visible_Declarations (Sync_Def);
+
+ Dom_Info := Traverse_Declarations_Or_Statements
+ (L => Vis_Decl,
+ D => Dom_Info);
+
+ -- If visible declarations are present, the first private declaration
+ -- is dominated by the last visible declaration.
+
+ Traverse_Declarations_Or_Statements
+ (L => Private_Declarations (Sync_Def),
+ D => Dom_Info);
+ end Traverse_Sync_Definition;
--------------------------------------
-- Traverse_Subprogram_Or_Task_Body --
@@ -2109,21 +2229,18 @@ package body Par_SCO is
(N : Node_Id;
D : Dominant_Info := No_Dominant)
is
+ Decls : constant List_Id := Declarations (N);
+ Dom_Info : Dominant_Info := D;
begin
- Traverse_Declarations_Or_Statements (Declarations (N), D);
- Traverse_Handled_Statement_Sequence (Handled_Statement_Sequence (N), D);
- end Traverse_Subprogram_Or_Task_Body;
+ -- If declarations are present, the first statement is dominated by the
+ -- last declaration.
- -------------------------------------
- -- Traverse_Subprogram_Declaration --
- -------------------------------------
+ Dom_Info := Traverse_Declarations_Or_Statements
+ (L => Decls, D => Dom_Info);
- procedure Traverse_Subprogram_Declaration (N : Node_Id) is
- ADN : constant Node_Id := Aux_Decls_Node (Parent (N));
- begin
- Traverse_Declarations_Or_Statements (Config_Pragmas (ADN));
- Traverse_Declarations_Or_Statements (Declarations (ADN));
- Traverse_Declarations_Or_Statements (Pragmas_After (ADN));
- end Traverse_Subprogram_Declaration;
+ Traverse_Handled_Statement_Sequence
+ (N => Handled_Statement_Sequence (N),
+ D => Dom_Info);
+ end Traverse_Subprogram_Or_Task_Body;
end Par_SCO;
diff --git a/gcc/ada/raise.c b/gcc/ada/raise.c
index 35b0e988ee1..a0c01216777 100644
--- a/gcc/ada/raise.c
+++ b/gcc/ada/raise.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2011, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2012, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -32,10 +32,6 @@
/* Shared routines to support exception handling. __gnat_unhandled_terminate
is shared between all exception handling mechanisms. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef IN_RTS
#include "tconfig.h"
#include "tsystem.h"
@@ -47,6 +43,10 @@ extern "C" {
#include "adaint.h"
#include "raise.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Wrapper to builtin_longjmp. This is for the compiler eh only, as the sjlj
runtime library interfaces directly to the intrinsic. We can't yet do
this for the compiler itself, because this capability relies on changes
diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb
index 14ab452b477..d4acf1dd912 100644
--- a/gcc/ada/restrict.adb
+++ b/gcc/ada/restrict.adb
@@ -582,7 +582,7 @@ package body Restrict is
if No_Dependences.Table (J).Warn then
Error_Msg
- ("?violation of restriction `No_Dependence '='> &`#",
+ ("??violation of restriction `No_Dependence '='> &`#",
Sloc (Err));
else
Error_Msg
@@ -611,8 +611,8 @@ package body Restrict is
end if;
-- Ignore call if node N is not in the main source unit, since we only
- -- give messages for . This avoids giving messages for aspects that are
- -- specified in withed units.
+ -- give messages for the main unit. This avoids giving messages for
+ -- aspects that are specified in withed units.
if not In_Extended_Main_Source_Unit (N) then
return;
@@ -798,9 +798,9 @@ package body Restrict is
if Warn_On_Obsolescent_Feature then
Error_Msg_Name_1 := Old_Name;
- Error_Msg_N ("restriction identifier % is obsolescent?", N);
+ Error_Msg_N ("restriction identifier % is obsolescent?j?", N);
Error_Msg_Name_1 := New_Name;
- Error_Msg_N ("|use restriction identifier % instead", N);
+ Error_Msg_N ("|use restriction identifier % instead?j?", N);
end if;
return New_Name;
@@ -951,7 +951,7 @@ package body Restrict is
-- Set warning message if warning
if Restriction_Warnings (R) then
- Add_Char ('?');
+ Add_Str ("??");
-- If real violation (not warning), then mark it as non-serious unless
-- it is a violation of No_Finalization in which case we leave it as a
@@ -1012,7 +1012,7 @@ package body Restrict is
-- Set as warning if warning case
if Restriction_Warnings (R) then
- Add_Char ('?');
+ Add_Str ("??");
end if;
-- Set main message
diff --git a/gcc/ada/s-crtl.ads b/gcc/ada/s-crtl.ads
index a763d606b70..18c43c42a64 100644
--- a/gcc/ada/s-crtl.ads
+++ b/gcc/ada/s-crtl.ads
@@ -122,9 +122,18 @@ package System.CRTL is
origin : int) return int;
pragma Import (C, fseek, "fseek");
+ function fseek64
+ (stream : FILEs;
+ offset : ssize_t;
+ origin : int) return int;
+ pragma Import (C, fseek64, "__gnat_fseek64");
+
function ftell (stream : FILEs) return long;
pragma Import (C, ftell, "ftell");
+ function ftell64 (stream : FILEs) return ssize_t;
+ pragma Import (C, ftell64, "__gnat_ftell64");
+
function getenv (S : String) return System.Address;
pragma Import (C, getenv, "getenv");
diff --git a/gcc/ada/s-direio.adb b/gcc/ada/s-direio.adb
index ef4c3ea9cf1..99f8ddf7722 100644
--- a/gcc/ada/s-direio.adb
+++ b/gcc/ada/s-direio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -29,13 +29,13 @@
-- --
------------------------------------------------------------------------------
-with Ada.IO_Exceptions; use Ada.IO_Exceptions;
-with Interfaces.C_Streams; use Interfaces.C_Streams;
-with System; use System;
+with Ada.IO_Exceptions; use Ada.IO_Exceptions;
+with Ada.Unchecked_Deallocation;
+with Interfaces.C_Streams; use Interfaces.C_Streams;
+with System; use System;
with System.CRTL;
with System.File_IO;
with System.Soft_Links;
-with Ada.Unchecked_Deallocation;
package body System.Direct_IO is
@@ -280,11 +280,20 @@ package body System.Direct_IO is
------------------
procedure Set_Position (File : File_Type) is
+ use type System.CRTL.ssize_t;
+ R : int;
begin
- if fseek
+ if Standard'Address_Size = 64 then
+ R := fseek64
+ (File.Stream, ssize_t (File.Bytes) *
+ ssize_t (File.Index - 1), SEEK_SET);
+ else
+ R := fseek
(File.Stream, long (File.Bytes) *
- long (File.Index - 1), SEEK_SET) /= 0
- then
+ long (File.Index - 1), SEEK_SET);
+ end if;
+
+ if R /= 0 then
raise Use_Error;
end if;
end Set_Position;
@@ -294,6 +303,7 @@ package body System.Direct_IO is
----------
function Size (File : File_Type) return Count is
+ use type System.CRTL.ssize_t;
begin
FIO.Check_File_Open (AP (File));
File.Last_Op := Op_Other;
@@ -302,7 +312,11 @@ package body System.Direct_IO is
raise Device_Error;
end if;
- return Count (ftell (File.Stream) / long (File.Bytes));
+ if Standard'Address_Size = 64 then
+ return Count (ftell64 (File.Stream) / ssize_t (File.Bytes));
+ else
+ return Count (ftell (File.Stream) / long (File.Bytes));
+ end if;
end Size;
-----------
diff --git a/gcc/ada/s-except.ads b/gcc/ada/s-except.ads
index f0da1e520d3..255ca859783 100644
--- a/gcc/ada/s-except.ads
+++ b/gcc/ada/s-except.ads
@@ -40,6 +40,7 @@ package System.Exceptions is
-- Visible copy to allow Ada.Exceptions to know the exception model.
private
+
type Require_Body;
-- Dummy Taft-amendment type to make it legal (and required) to provide
-- a body for this package.
diff --git a/gcc/ada/s-rannum.adb b/gcc/ada/s-rannum.adb
index 21d879923a3..bfcea556944 100644
--- a/gcc/ada/s-rannum.adb
+++ b/gcc/ada/s-rannum.adb
@@ -406,7 +406,7 @@ package body System.Random_Numbers is
-- Ignore different-size warnings here since GNAT's handling
-- is correct.
- pragma Warnings ("Z"); -- better to use msg string! ???
+ pragma Warnings ("Z");
function Conv_To_Unsigned is
new Unchecked_Conversion (Result_Subtype'Base, Unsigned_64);
function Conv_To_Result is
@@ -496,7 +496,6 @@ package body System.Random_Numbers is
procedure Reset (Gen : Generator; Initiator : Integer) is
begin
- pragma Warnings (Off, "condition is always *");
-- This is probably an unnecessary precaution against future change, but
-- since the test is a static expression, no extra code is involved.
@@ -515,8 +514,6 @@ package body System.Random_Numbers is
Reset (Gen, Initialization_Vector'(Init0, Init1));
end;
end if;
-
- pragma Warnings (On, "condition is always *");
end Reset;
procedure Reset (Gen : Generator; Initiator : Initialization_Vector) is
diff --git a/gcc/ada/scn.adb b/gcc/ada/scn.adb
index 52431b3940b..9f8ce2078d4 100644
--- a/gcc/ada/scn.adb
+++ b/gcc/ada/scn.adb
@@ -339,9 +339,9 @@ package body Scn is
if Warn_On_Obsolescent_Feature then
Error_Msg
- ("use of "":"" is an obsolescent feature (RM J.2(3))?", S);
+ ("?j?use of "":"" is an obsolescent feature (RM J.2(3))", S);
Error_Msg
- ("\use ""'#"" instead?", S);
+ ("\?j?use ""'#"" instead", S);
end if;
end if;
end Check_Obsolete_Base_Char;
@@ -382,8 +382,8 @@ package body Scn is
if Warn_On_Obsolescent_Feature then
Error_Msg_SC
- ("use of ""'%"" is an obsolescent feature (RM J.2(4))?");
- Error_Msg_SC ("\use """""" instead?");
+ ("?j?use of ""'%"" is an obsolescent feature (RM J.2(4))");
+ Error_Msg_SC ("\?j?use """""" instead");
end if;
end if;
@@ -398,8 +398,8 @@ package body Scn is
if Warn_On_Obsolescent_Feature then
Error_Msg_SC
- ("use of ""'!"" is an obsolescent feature (RM J.2(2))?");
- Error_Msg_SC ("\use ""'|"" instead?");
+ ("?j?use of ""'!"" is an obsolescent feature (RM J.2(2))");
+ Error_Msg_SC ("\?j?use ""'|"" instead");
end if;
end if;
diff --git a/gcc/ada/scos.ads b/gcc/ada/scos.ads
index 0082099afb4..dc4248e12d9 100644
--- a/gcc/ada/scos.ads
+++ b/gcc/ada/scos.ads
@@ -385,8 +385,8 @@ package SCOs is
Table_Increment => 300);
Is_Decision : constant array (Character) of Boolean :=
- ('E' | 'G' | 'I' | 'P' | 'A' | 'W' | 'X' => True,
- others => False);
+ ('E' | 'G' | 'I' | 'P' | 'a' | 'A' | 'W' | 'X' => True,
+ others => False);
-- Indicates which C1 values correspond to decisions
-- The SCO_Table_Entry values appear as follows:
diff --git a/gcc/ada/seh_init.c b/gcc/ada/seh_init.c
index 772dab0aa84..9b3c081081d 100644
--- a/gcc/ada/seh_init.c
+++ b/gcc/ada/seh_init.c
@@ -32,10 +32,6 @@
/* This unit contains support for SEH (Structured Exception Handling).
Right now the only implementation is for Win32. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef IN_RTS
#include "tconfig.h"
#include "tsystem.h"
@@ -50,6 +46,10 @@ extern "C" {
#include "raise.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Addresses of exception data blocks for predefined exceptions. */
extern struct Exception_Data constraint_error;
extern struct Exception_Data numeric_error;
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index e73b8758386..7458324a9d6 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -468,13 +468,13 @@ package body Sem_Aggr is
then
if Is_Out_Of_Range (Exp, Base_Type (Check_Typ)) then
Apply_Compile_Time_Constraint_Error
- (Exp, "value not in range of}?", CE_Range_Check_Failed,
+ (Exp, "value not in range of}??", CE_Range_Check_Failed,
Ent => Base_Type (Check_Typ),
Typ => Base_Type (Check_Typ));
elsif Is_Out_Of_Range (Exp, Check_Typ) then
Apply_Compile_Time_Constraint_Error
- (Exp, "value not in range of}?", CE_Range_Check_Failed,
+ (Exp, "value not in range of}??", CE_Range_Check_Failed,
Ent => Check_Typ,
Typ => Check_Typ);
@@ -583,9 +583,9 @@ package body Sem_Aggr is
elsif Expr_Value (This_Low) /= Expr_Value (Aggr_Low (Dim)) then
Set_Raises_Constraint_Error (N);
- Error_Msg_N ("sub-aggregate low bound mismatch?", N);
+ Error_Msg_N ("sub-aggregate low bound mismatch??", N);
Error_Msg_N
- ("\Constraint_Error will be raised at run time?", N);
+ ("\Constraint_Error will be raised at run time??", N);
end if;
end if;
@@ -597,9 +597,9 @@ package body Sem_Aggr is
Expr_Value (This_High) /= Expr_Value (Aggr_High (Dim))
then
Set_Raises_Constraint_Error (N);
- Error_Msg_N ("sub-aggregate high bound mismatch?", N);
+ Error_Msg_N ("sub-aggregate high bound mismatch??", N);
Error_Msg_N
- ("\Constraint_Error will be raised at run time?", N);
+ ("\Constraint_Error will be raised at run time??", N);
end if;
end if;
end if;
@@ -1440,8 +1440,8 @@ package body Sem_Aggr is
if OK_BH and then OK_AH and then Val_BH < Val_AH then
Set_Raises_Constraint_Error (N);
- Error_Msg_N ("upper bound out of range?", AH);
- Error_Msg_N ("\Constraint_Error will be raised at run time?", AH);
+ Error_Msg_N ("upper bound out of range??", AH);
+ Error_Msg_N ("\Constraint_Error will be raised at run time??", AH);
-- You need to set AH to BH or else in the case of enumerations
-- indexes we will not be able to resolve the aggregate bounds.
@@ -1483,14 +1483,14 @@ package body Sem_Aggr is
if OK_L and then Val_L > Val_AL then
Set_Raises_Constraint_Error (N);
- Error_Msg_N ("lower bound of aggregate out of range?", N);
- Error_Msg_N ("\Constraint_Error will be raised at run time?", N);
+ Error_Msg_N ("lower bound of aggregate out of range??", N);
+ Error_Msg_N ("\Constraint_Error will be raised at run time??", N);
end if;
if OK_H and then Val_H < Val_AH then
Set_Raises_Constraint_Error (N);
- Error_Msg_N ("upper bound of aggregate out of range?", N);
- Error_Msg_N ("\Constraint_Error will be raised at run time?", N);
+ Error_Msg_N ("upper bound of aggregate out of range??", N);
+ Error_Msg_N ("\Constraint_Error will be raised at run time??", N);
end if;
end Check_Bounds;
@@ -1529,8 +1529,8 @@ package body Sem_Aggr is
if Range_Len < Len then
Set_Raises_Constraint_Error (N);
- Error_Msg_N ("too many elements?", N);
- Error_Msg_N ("\Constraint_Error will be raised at run time?", N);
+ Error_Msg_N ("too many elements??", N);
+ Error_Msg_N ("\Constraint_Error will be raised at run time??", N);
end if;
end Check_Length;
@@ -1877,31 +1877,6 @@ package body Sem_Aggr is
return Failure;
end if;
- if Others_Present
- and then Nkind (Parent (N)) /= N_Component_Association
- and then No (Expressions (N))
- and then
- Nkind (First (Choices (First (Component_Associations (N)))))
- = N_Others_Choice
- and then Is_Elementary_Type (Component_Typ)
- and then False
- then
- declare
- Assoc : constant Node_Id := First (Component_Associations (N));
- begin
- Rewrite (Assoc,
- Make_Component_Association (Loc,
- Choices =>
- New_List (
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Typ, Loc),
- Attribute_Name => Name_Range)),
- Expression => Relocate_Node (Expression (Assoc))));
- return Resolve_Array_Aggregate
- (N, Index, Index_Constr, Component_Typ, Others_Allowed);
- end;
- end if;
-
-- Protect against cascaded errors
if Etype (Index_Typ) = Any_Type then
@@ -1980,7 +1955,7 @@ package body Sem_Aggr is
elsif Nkind (Choice) = N_Subtype_Indication then
Resolve_Discrete_Subtype_Indication (Choice, Index_Base);
- -- Does the subtype indication evaluation raise CE ?
+ -- Does the subtype indication evaluation raise CE?
Get_Index_Bounds (Subtype_Mark (Choice), S_Low, S_High);
Get_Index_Bounds (Choice, Low, High);
@@ -2310,7 +2285,8 @@ package body Sem_Aggr is
(Enumeration_Pos (AHi) - Enumeration_Pos (ALo))
then
Error_Msg_N
- ("missing index value(s) in array aggregate?", N);
+ ("missing index value(s) in array aggregate??",
+ N);
-- Output missing value(s) at start
@@ -2319,11 +2295,11 @@ package body Sem_Aggr is
if Chars (ALo) = Chars (Ent) then
Error_Msg_Name_1 := Chars (ALo);
- Error_Msg_N ("\ %?", N);
+ Error_Msg_N ("\ %??", N);
else
Error_Msg_Name_1 := Chars (ALo);
Error_Msg_Name_2 := Chars (Ent);
- Error_Msg_N ("\ % .. %?", N);
+ Error_Msg_N ("\ % .. %??", N);
end if;
end if;
@@ -2334,11 +2310,11 @@ package body Sem_Aggr is
if Chars (AHi) = Chars (Ent) then
Error_Msg_Name_1 := Chars (Ent);
- Error_Msg_N ("\ %?", N);
+ Error_Msg_N ("\ %??", N);
else
Error_Msg_Name_1 := Chars (Ent);
Error_Msg_Name_2 := Chars (AHi);
- Error_Msg_N ("\ % .. %?", N);
+ Error_Msg_N ("\ % .. %??", N);
end if;
end if;
@@ -2356,7 +2332,7 @@ package body Sem_Aggr is
not Is_Constrained (First_Subtype (Etype (N)))
then
Error_Msg_N
- ("bounds of aggregate do not match target?", N);
+ ("bounds of aggregate do not match target??", N);
end if;
end;
end if;
@@ -2810,7 +2786,7 @@ package body Sem_Aggr is
and then Enclosing_CPP_Parent (Typ) /= A_Type
then
Error_Msg_NE
- ("?must use 'C'P'P constructor for type &", A,
+ ("??must use 'C'P'P constructor for type &", A,
Enclosing_CPP_Parent (Typ));
-- The following call is not needed if the previous warning
@@ -4576,9 +4552,9 @@ package body Sem_Aggr is
Insert_Action
(Compile_Time_Constraint_Error
(Expr,
- "(Ada 2005) null not allowed in null-excluding component?"),
- Make_Raise_Constraint_Error (Sloc (Expr),
- Reason => CE_Access_Check_Failed));
+ "(Ada 2005) null not allowed in null-excluding component??"),
+ Make_Raise_Constraint_Error
+ (Sloc (Expr), Reason => CE_Access_Check_Failed));
-- Set proper type for bogus component (why is this needed???)
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 94cbd9e730a..6247952843e 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -739,7 +739,7 @@ package body Sem_Attr is
if Is_CPP_Class (Root_Type (Typ)) then
Error_Msg_N
- ("?current instance unsupported for derivations of "
+ ("??current instance unsupported for derivations of "
& "'C'P'P types", N);
end if;
@@ -1015,6 +1015,16 @@ package body Sem_Attr is
("prefix for % attribute must be constrained array", P);
end if;
+ -- The attribute reference freezes the type, and thus the
+ -- component type, even if the attribute may not depend on the
+ -- component. Diagnose arrays with incomplete components now.
+ -- If the prefix is an access to array, this does not freeze
+ -- the designated type.
+
+ if Nkind (P) /= N_Explicit_Dereference then
+ Check_Fully_Declared (Component_Type (P_Type), P);
+ end if;
+
D := Number_Dimensions (P_Type);
else
@@ -2019,7 +2029,7 @@ package body Sem_Attr is
if not Attribute_83 (Attr_Id) then
if Ada_Version = Ada_83 and then Comes_From_Source (N) then
Error_Msg_Name_1 := Aname;
- Error_Msg_N ("(Ada 83) attribute% is not standard?", N);
+ Error_Msg_N ("(Ada 83) attribute% is not standard??", N);
end if;
if Attribute_Impl_Def (Attr_Id) then
@@ -2640,7 +2650,7 @@ package body Sem_Attr is
and then Warn_On_Redundant_Constructs
then
Error_Msg_NE -- CODEFIX
- ("?redundant attribute, & is its own base type", N, Typ);
+ ("?r?redundant attribute, & is its own base type", N, Typ);
end if;
if Nkind (Parent (N)) /= N_Attribute_Reference then
@@ -2896,7 +2906,7 @@ package body Sem_Attr is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("constrained for private type is an " &
- "obsolescent feature (RM J.4)?", N);
+ "obsolescent feature (RM J.4)?j?", N);
end if;
-- If we are within an instance, the attribute must be legal
@@ -4251,9 +4261,9 @@ package body Sem_Attr is
Prag := N;
while not Nkind_In (Prag, N_Pragma,
- N_Function_Specification,
- N_Procedure_Specification,
- N_Subprogram_Body)
+ N_Function_Specification,
+ N_Procedure_Specification,
+ N_Subprogram_Body)
loop
Prag := Parent (Prag);
end loop;
@@ -4346,7 +4356,7 @@ package body Sem_Attr is
and then Is_Constant_Object (Entity (P))
then
Error_Msg_N
- ("?attribute Old applied to constant has no effect", P);
+ ("??attribute Old applied to constant has no effect", P);
end if;
-- The attribute appears within a pre/postcondition, but refers to
@@ -4586,11 +4596,26 @@ package body Sem_Attr is
-- During pre-analysis, Prag is the enclosing pragma node if any
begin
- -- Find enclosing scopes, excluding loops
+ -- Find the proper enclosing scope
CS := Current_Scope;
- while Ekind (CS) = E_Loop loop
- CS := Scope (CS);
+ while Present (CS) loop
+
+ -- Skip generated loops
+
+ if Ekind (CS) = E_Loop then
+ CS := Scope (CS);
+
+ -- Skip the special _Parent scope generated to capture references
+ -- to formals during the process of subprogram inlining.
+
+ elsif Ekind (CS) = E_Function
+ and then Chars (CS) = Name_uParent
+ then
+ CS := Scope (CS);
+ else
+ exit;
+ end if;
end loop;
PS := Scope (CS);
@@ -4603,7 +4628,7 @@ package body Sem_Attr is
and then Warn_On_Redundant_Constructs
then
Error_Msg_N
- ("postconditions on inlined functions not enforced?", N);
+ ("postconditions on inlined functions not enforced?r?", N);
end if;
-- If we are in the scope of a function and in Spec_Expression mode,
@@ -5032,10 +5057,10 @@ package body Sem_Attr is
Name_Simple_Storage_Pool_Type))
then
Error_Msg_Name_1 := Aname;
- Error_Msg_N ("cannot use % attribute for type with simple " &
- "storage pool?", N);
+ Error_Msg_N ("cannot use % attribute for type with simple "
+ & "storage pool??", N);
Error_Msg_N
- ("\Program_Error will be raised at run time?", N);
+ ("\Program_Error will be raised at run time??", N);
Rewrite
(N, Make_Raise_Program_Error
@@ -5228,8 +5253,8 @@ package body Sem_Attr is
if not Is_Tagged_Type (P_Type) then
Error_Attr_P ("prefix of % attribute must be tagged");
- -- Next test does not apply to generated code
- -- why not, and what does the illegal reference mean???
+ -- Next test does not apply to generated code why not, and what does
+ -- the illegal reference mean???
elsif Is_Object_Reference (P)
and then not Is_Class_Wide_Type (P_Type)
@@ -5240,9 +5265,9 @@ package body Sem_Attr is
"of class - wide type");
end if;
- -- The prefix cannot be an incomplete type. However, references
- -- to 'Tag can be generated when expanding interface conversions,
- -- and this is legal.
+ -- The prefix cannot be an incomplete type. However, references to
+ -- 'Tag can be generated when expanding interface conversions, and
+ -- this is legal.
if Comes_From_Source (N) then
Check_Not_Incomplete_Type;
@@ -5728,8 +5753,8 @@ package body Sem_Attr is
begin
if Present (Pred_Func) and then Current_Scope = Pred_Func then
Error_Msg_N
- ("attribute Valid requires a predicate check?", N);
- Error_Msg_N ("\and will result in infinite recursion?", N);
+ ("attribute Valid requires a predicate check??", N);
+ Error_Msg_N ("\and will result in infinite recursion??", N);
end if;
end;
@@ -5744,7 +5769,7 @@ package body Sem_Attr is
Check_Object_Reference (P);
if No_Scalar_Parts (P_Type) then
- Error_Attr_P ("?attribute % always True, no scalars to check");
+ Error_Attr_P ("??attribute % always True, no scalars to check");
end if;
Set_Etype (N, Standard_Boolean);
@@ -6095,7 +6120,7 @@ package body Sem_Attr is
elsif Is_Out_Of_Range (N, T) then
Apply_Compile_Time_Constraint_Error
- (N, "value not in range of}?", CE_Range_Check_Failed);
+ (N, "value not in range of}??", CE_Range_Check_Failed);
elsif not Range_Checks_Suppressed (T) then
Enable_Range_Check (N);
@@ -8894,9 +8919,10 @@ package body Sem_Attr is
-- know will fail, so generate an appropriate warning.
if In_Instance_Body then
- Error_Msg_F ("?non-local pointer cannot point to local object", P);
Error_Msg_F
- ("\?Program_Error will be raised at run time", P);
+ ("??non-local pointer cannot point to local object", P);
+ Error_Msg_F
+ ("\??Program_Error will be raised at run time", P);
Rewrite (N,
Make_Raise_Program_Error (Loc,
Reason => PE_Accessibility_Check_Failed));
@@ -9368,9 +9394,9 @@ package body Sem_Attr is
if In_Instance_Body then
Error_Msg_F
- ("?non-local pointer cannot point to local object", P);
+ ("??non-local pointer cannot point to local object", P);
Error_Msg_F
- ("\?Program_Error will be raised at run time", P);
+ ("\??Program_Error will be raised at run time", P);
Rewrite (N,
Make_Raise_Program_Error (Loc,
Reason => PE_Accessibility_Check_Failed));
@@ -9484,11 +9510,13 @@ package body Sem_Attr is
declare
D : constant Node_Id := Declaration_Node (Entity (P));
begin
- Error_Msg_N ("aliased object has explicit bounds?",
- D);
- Error_Msg_N ("\declare without bounds"
- & " (and with explicit initialization)?", D);
- Error_Msg_N ("\for use with unconstrained access?", D);
+ Error_Msg_N
+ ("aliased object has explicit bounds??", D);
+ Error_Msg_N
+ ("\declare without bounds (and with explicit "
+ & "initialization)??", D);
+ Error_Msg_N
+ ("\for use with unconstrained access??", D);
end;
end if;
end if;
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb
index 3dd3b617820..432de5dc367 100644
--- a/gcc/ada/sem_case.adb
+++ b/gcc/ada/sem_case.adb
@@ -601,8 +601,8 @@ package body Sem_Case is
and then Comes_From_Source (Others_Choice)
and then Is_Empty_List (Choice_List)
then
- Error_Msg_N ("?OTHERS choice is redundant", Others_Choice);
- Error_Msg_N ("\previous choices cover all values", Others_Choice);
+ Error_Msg_N ("?r?OTHERS choice is redundant", Others_Choice);
+ Error_Msg_N ("\?r?previous choices cover all values", Others_Choice);
end if;
end Expand_Others_Choice;
diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb
index 4d8b8ffc5d0..e4615393dd2 100644
--- a/gcc/ada/sem_cat.adb
+++ b/gcc/ada/sem_cat.adb
@@ -923,6 +923,7 @@ package body Sem_Cat is
then
-- If the type is private, it must have the Ada 2005 pragma
-- Has_Preelaborable_Initialization.
+
-- The check is omitted within predefined units. This is probably
-- obsolete code to fix the Ada 95 weakness in this area ???
@@ -1728,8 +1729,7 @@ package body Sem_Cat is
Direct_Designated_Type := Designated_Type (T);
Desig_Type := Etype (Direct_Designated_Type);
- -- Why is the check below not in
- -- Validate_Remote_Access_To_Class_Wide_Type???
+ -- Why is this check not in Validate_Remote_Access_To_Class_Wide_Type???
if not Is_Valid_Remote_Object_Type (Desig_Type) then
Error_Msg_N
@@ -2047,6 +2047,7 @@ package body Sem_Cat is
function Is_Primary (N : Node_Id) return Boolean;
-- Determine whether node is syntactically a primary in an expression
-- This function should probably be somewhere else ???
+ --
-- Also it does not do what it says, e.g if N is a binary operator
-- whose parent is a binary operator, Is_Primary returns True ???
@@ -2170,7 +2171,7 @@ package body Sem_Cat is
if GNAT_Mode then
Error_Msg_N
- ("?non-static constant in preelaborated unit", N);
+ ("??non-static constant in preelaborated unit", N);
else
Flag_Non_Static_Expr
("non-static constant in preelaborated unit", N);
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 19d749931b4..b55d064f7bb 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -556,7 +556,7 @@ package body Sem_Ch10 is
Used_In_Spec)
then
Error_Msg_N -- CODEFIX
- ("?redundant with clause in body", Clause);
+ ("redundant with clause in body??", Clause);
end if;
Used_In_Body := False;
@@ -585,7 +585,7 @@ package body Sem_Ch10 is
if Withed then
Error_Msg_N -- CODEFIX
- ("?redundant with clause", Clause);
+ ("redundant with clause??", Clause);
end if;
end;
end if;
@@ -1793,7 +1793,7 @@ package body Sem_Ch10 is
Error_Msg_File_1 :=
Get_File_Name (Subunit_Name, Subunit => True);
Error_Msg_N
- ("subunit$$ in file{ not found?!!", N);
+ ("subunit$$ in file{ not found??!!", N);
Subunits_Missing := True;
end if;
@@ -2513,30 +2513,30 @@ package body Sem_Ch10 is
begin
if U_Kind = Implementation_Unit then
- Error_Msg_F ("& is an internal 'G'N'A'T unit?", Name (N));
+ Error_Msg_F ("& is an internal 'G'N'A'T unit?i?", Name (N));
-- Add alternative name if available, otherwise issue a
-- general warning message.
if Error_Msg_Strlen /= 0 then
- Error_Msg_F ("\use ""~"" instead", Name (N));
+ Error_Msg_F ("\use ""~"" instead?i?", Name (N));
else
Error_Msg_F
("\use of this unit is non-portable " &
- "and version-dependent?", Name (N));
+ "and version-dependent?i?", Name (N));
end if;
elsif U_Kind = Ada_2005_Unit
and then Ada_Version < Ada_2005
and then Warn_On_Ada_2005_Compatibility
then
- Error_Msg_N ("& is an Ada 2005 unit?", Name (N));
+ Error_Msg_N ("& is an Ada 2005 unit?i?", Name (N));
elsif U_Kind = Ada_2012_Unit
and then Ada_Version < Ada_2012
and then Warn_On_Ada_2012_Compatibility
then
- Error_Msg_N ("& is an Ada 2012 unit?", Name (N));
+ Error_Msg_N ("& is an Ada 2012 unit?i?", Name (N));
end if;
end;
end if;
@@ -3342,7 +3342,7 @@ package body Sem_Ch10 is
procedure License_Error is
begin
Error_Msg_N
- ("?license of withed unit & may be inconsistent",
+ ("license of withed unit & may be inconsistent??",
Name (Item));
end License_Error;
@@ -4129,7 +4129,7 @@ package body Sem_Ch10 is
then
Error_Msg_NE
("child unit& hides compilation unit " &
- "with the same name?",
+ "with the same name??",
Name (Item), Id);
exit;
end if;
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb
index d3d8528c872..e3635c66e17 100644
--- a/gcc/ada/sem_ch11.adb
+++ b/gcc/ada/sem_ch11.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -266,7 +266,7 @@ package body Sem_Ch11 is
and then Scope (Entity (Id)) = Current_Scope
then
Error_Msg_NE
- ("?exception & is never raised", Entity (Id), Id);
+ ("exception & is never raised?r?", Entity (Id), Id);
end if;
if Present (Renamed_Entity (Entity (Id))) then
@@ -276,9 +276,9 @@ package body Sem_Ch11 is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("Numeric_Error is an " &
- "obsolescent feature (RM J.6(1))?", Id);
+ "obsolescent feature (RM J.6(1))?j?", Id);
Error_Msg_N
- ("\use Constraint_Error instead?", Id);
+ ("\use Constraint_Error instead?j?", Id);
end if;
end if;
end if;
@@ -345,7 +345,7 @@ package body Sem_Ch11 is
N_Others_Choice)
then
Error_Msg_N
- ("useless handler contains only a reraise statement?",
+ ("useless handler contains only a reraise statement?r?",
Handler);
end if;
@@ -445,8 +445,7 @@ package body Sem_Ch11 is
end if;
-- Check for useless assignment to OUT or IN OUT scalar preceding the
- -- raise. Right now we only look at assignment statements, we could do
- -- more.
+ -- raise. Right now only look at assignment statements, could do more???
if Is_List_Member (N) then
declare
@@ -496,11 +495,11 @@ package body Sem_Ch11 is
if No (Exception_Handlers (Par)) then
Error_Msg_N
- ("?assignment to pass-by-copy formal " &
- "may have no effect", P);
+ ("assignment to pass-by-copy formal " &
+ "may have no effect??", P);
Error_Msg_N
- ("\?RAISE statement may result in abnormal return" &
- " (RM 6.4.1(17))", P);
+ ("\RAISE statement may result in abnormal return" &
+ " (RM 6.4.1(17))??", P);
end if;
end if;
end if;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 60edce32f2d..ee883327054 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -1448,10 +1448,15 @@ package body Sem_Ch12 is
-- defined aspect/pragma Remote_Access_Type. In that case
-- the actual must be remote as well.
+ -- If the current instantiation is the construction of a
+ -- local copy for a formal package the actuals may be
+ -- defaulted, and there is no matching actual to check.
+
if Nkind (Analyzed_Formal) = N_Formal_Type_Declaration
and then
Nkind (Formal_Type_Definition (Analyzed_Formal)) =
N_Access_To_Object_Definition
+ and then Present (Match)
then
declare
Formal_Ent : constant Entity_Id :=
@@ -4924,6 +4929,17 @@ package body Sem_Ch12 is
Assoc := Associated_Node (Assoc);
end if;
+ -- An additional special case: an unconstrained type in an object
+ -- declaration may have been rewritten as a local subtype constrained
+ -- by the expression in the declaration. We need to recover the
+ -- original entity which may be global.
+
+ if Present (Original_Node (Assoc))
+ and then Nkind (Parent (N)) = N_Object_Declaration
+ then
+ Assoc := Original_Node (Assoc);
+ end if;
+
return Assoc;
end if;
end Get_Associated_Node;
@@ -10475,8 +10491,7 @@ package body Sem_Ch12 is
-- This is a binding interpretation that applies to previous versions
-- of the language, but for now we retain the milder check in order
- -- to preserve ACATS tests.
- -- These will be protested eventually ???
+ -- to preserve ACATS tests. These will be protested eventually ???
if Ada_Version < Ada_2012 then
Check_Mode_Conformant
@@ -12139,8 +12154,8 @@ package body Sem_Ch12 is
E1 := First_Entity (Form);
E2 := First_Entity (Act);
while Present (E1) and then E1 /= First_Private_Entity (Form) loop
- -- Could this test be a single condition???
- -- Seems like it could, and isn't FPE (Form) a constant anyway???
+ -- Could this test be a single condition??? Seems like it could, and
+ -- isn't FPE (Form) a constant anyway???
if not Is_Internal (E1)
and then Present (Parent (E1))
@@ -12406,7 +12421,7 @@ package body Sem_Ch12 is
-- provide additional warning which might explain the error.
Set_Is_Immediately_Visible (Cur, Vis);
- Error_Msg_NE ("& hides outer unit with the same name?",
+ Error_Msg_NE ("& hides outer unit with the same name??",
N, Defining_Unit_Name (N));
end if;
@@ -12981,7 +12996,36 @@ package body Sem_Ch12 is
end if;
if Is_Global (E) then
- Set_Global_Type (N, N2);
+
+ -- If the entity is a package renaming that is the prefix of
+ -- an expanded name, it has been rewritten as the renamed
+ -- package, which is necessary semantically but complicates
+ -- ASIS tree traversal, so we recover the original entity to
+ -- expose the renaming. Take into account that the context may
+ -- be a nested generic and that the original node may itself
+ -- have an associated node.
+
+ if Ekind (E) = E_Package
+ and then Nkind (Parent (N)) = N_Expanded_Name
+ and then Present (Original_Node (N2))
+ and then Present (Entity (Original_Node (N2)))
+ and then Is_Entity_Name (Entity (Original_Node (N2)))
+ then
+ if Is_Global (Entity (Original_Node (N2))) then
+ N2 := Original_Node (N2);
+ Set_Associated_Node (N, N2);
+ Set_Global_Type (N, N2);
+
+ else
+ -- Renaming is local, and will be resolved in instance
+
+ Set_Associated_Node (N, Empty);
+ Set_Etype (N, Empty);
+ end if;
+
+ else
+ Set_Global_Type (N, N2);
+ end if;
elsif Nkind (N) = N_Op_Concat
and then Is_Generic_Type (Etype (N2))
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index eee75d52a1e..37e521cb099 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -279,16 +279,16 @@ package body Sem_Ch13 is
then
Error_Msg_N
("multi-byte field specified with non-standard"
- & " Bit_Order?", CLC);
+ & " Bit_Order??", CLC);
if Bytes_Big_Endian then
Error_Msg_N
("bytes are not reversed "
- & "(component is big-endian)?", CLC);
+ & "(component is big-endian)??", CLC);
else
Error_Msg_N
("bytes are not reversed "
- & "(component is little-endian)?", CLC);
+ & "(component is little-endian)??", CLC);
end if;
-- Do not allow non-contiguous field
@@ -314,14 +314,14 @@ package body Sem_Ch13 is
and then Warn_On_Reverse_Bit_Order
then
Error_Msg_N
- ("?Bit_Order clause does not affect " &
- "byte ordering", Pos);
+ ("Bit_Order clause does not affect " &
+ "byte ordering?V?", Pos);
Error_Msg_Uint_1 :=
Intval (Pos) + Intval (FB) /
System_Storage_Unit;
Error_Msg_N
- ("?position normalized to ^ before bit " &
- "order interpreted", Pos);
+ ("position normalized to ^ before bit " &
+ "order interpreted?V?", Pos);
end if;
-- Here is where we fix up the Component_Bit_Offset value
@@ -390,10 +390,8 @@ package body Sem_Ch13 is
if Present (CC) then
declare
- Fbit : constant Uint :=
- Static_Integer (First_Bit (CC));
- Lbit : constant Uint :=
- Static_Integer (Last_Bit (CC));
+ Fbit : constant Uint := Static_Integer (First_Bit (CC));
+ Lbit : constant Uint := Static_Integer (Last_Bit (CC));
begin
-- Case of component with last bit >= max machine scalar
@@ -410,16 +408,16 @@ package body Sem_Ch13 is
if Warn_On_Reverse_Bit_Order then
Error_Msg_N
("multi-byte field specified with "
- & " non-standard Bit_Order?", CC);
+ & " non-standard Bit_Order?V?", CC);
if Bytes_Big_Endian then
Error_Msg_N
("\bytes are not reversed "
- & "(component is big-endian)?", CC);
+ & "(component is big-endian)?V?", CC);
else
Error_Msg_N
("\bytes are not reversed "
- & "(component is little-endian)?", CC);
+ & "(component is little-endian)?V?", CC);
end if;
end if;
@@ -633,19 +631,19 @@ package body Sem_Ch13 is
Error_Msg_Uint_1 := MSS;
Error_Msg_N
("info: reverse bit order in machine " &
- "scalar of length^?", First_Bit (CC));
+ "scalar of length^?V?", First_Bit (CC));
Error_Msg_Uint_1 := NFB;
Error_Msg_Uint_2 := NLB;
if Bytes_Big_Endian then
Error_Msg_NE
- ("?\info: big-endian range for "
- & "component & is ^ .. ^",
+ ("\info: big-endian range for "
+ & "component & is ^ .. ^?V?",
First_Bit (CC), Comp);
else
Error_Msg_NE
- ("?\info: little-endian range "
- & "for component & is ^ .. ^",
+ ("\info: little-endian range "
+ & "for component & is ^ .. ^?V?",
First_Bit (CC), Comp);
end if;
end if;
@@ -1602,10 +1600,33 @@ package body Sem_Ch13 is
-- with delay of visibility for the expression analysis.
-- If the entity is a library-level subprogram, the pre/
- -- postconditions must be treated as late pragmas.
+ -- postconditions must be treated as late pragmas. Note
+ -- that they must be prepended, not appended, to the list,
+ -- so that split AND THEN sections are processed in the
+ -- correct order.
if Nkind (Parent (N)) = N_Compilation_Unit then
- Add_Global_Declaration (Aitem);
+ declare
+ Aux : constant Node_Id := Aux_Decls_Node (Parent (N));
+
+ begin
+ if No (Pragmas_After (Aux)) then
+ Set_Pragmas_After (Aux, New_List);
+ end if;
+
+ Prepend (Aitem, Pragmas_After (Aux));
+ end;
+
+ -- If it is a subprogram body, add pragmas to list of
+ -- declarations in body.
+
+ elsif Nkind (N) = N_Subprogram_Body then
+ if No (Declarations (N)) then
+ Set_Declarations (N, New_List);
+ end if;
+
+ Append (Aitem, Declarations (N));
+
else
Insert_After (N, Aitem);
end if;
@@ -1875,7 +1896,7 @@ package body Sem_Ch13 is
-- In the context of a compilation unit, we directly put the
-- pragma in the Pragmas_After list of the
- -- N_Compilation_Unit_Aux node (No delay is required here)
+ -- N_Compilation_Unit_Aux node (no delay is required here)
-- except for aspects on a subprogram body (see below).
if Nkind (Parent (N)) = N_Compilation_Unit
@@ -1919,7 +1940,7 @@ package body Sem_Ch13 is
else
if No (Pragmas_After (Aux)) then
- Set_Pragmas_After (Aux, Empty_List);
+ Set_Pragmas_After (Aux, New_List);
end if;
Append (Aitem, Pragmas_After (Aux));
@@ -1992,17 +2013,17 @@ package body Sem_Ch13 is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
- ("at clause is an obsolescent feature (RM J.7(2))?", N);
+ ("?j?at clause is an obsolescent feature (RM J.7(2))", N);
Error_Msg_N
- ("\use address attribute definition clause instead?", N);
+ ("\?j?use address attribute definition clause instead", N);
end if;
-- Rewrite as address clause
Rewrite (N,
Make_Attribute_Definition_Clause (Sloc (N),
- Name => Identifier (N),
- Chars => Name_Address,
+ Name => Identifier (N),
+ Chars => Name_Address,
Expression => Expression (N)));
-- We preserve Comes_From_Source, since logically the clause still comes
@@ -2736,9 +2757,9 @@ package body Sem_Ch13 is
and then Comes_From_Source (Scope (U_Ent))
then
Error_Msg_N
- ("?entry address declared for entry in task type", N);
+ ("??entry address declared for entry in task type", N);
Error_Msg_N
- ("\?only one task can be declared of this type", N);
+ ("\??only one task can be declared of this type", N);
end if;
-- Entry address clauses are obsolescent
@@ -2747,10 +2768,10 @@ package body Sem_Ch13 is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
- ("attaching interrupt to task entry is an " &
- "obsolescent feature (RM J.7.1)?", N);
+ ("?j?attaching interrupt to task entry is an " &
+ "obsolescent feature (RM J.7.1)", N);
Error_Msg_N
- ("\use interrupt procedure instead?", N);
+ ("\?j?use interrupt procedure instead", N);
end if;
-- Case of an address clause for a controlled object which we
@@ -2760,9 +2781,9 @@ package body Sem_Ch13 is
or else Has_Controlled_Component (Etype (U_Ent))
then
Error_Msg_NE
- ("?controlled object& must not be overlaid", Nam, U_Ent);
+ ("??controlled object& must not be overlaid", Nam, U_Ent);
Error_Msg_N
- ("\?Program_Error will be raised at run time", Nam);
+ ("\??Program_Error will be raised at run time", Nam);
Insert_Action (Declaration_Node (U_Ent),
Make_Raise_Program_Error (Loc,
Reason => PE_Overlaid_Controlled_Object));
@@ -2799,9 +2820,9 @@ package body Sem_Ch13 is
or else Is_Controlled (Etype (O_Ent)))
then
Error_Msg_N
- ("?cannot overlay with controlled object", Expr);
+ ("??cannot overlay with controlled object", Expr);
Error_Msg_N
- ("\?Program_Error will be raised at run time", Expr);
+ ("\??Program_Error will be raised at run time", Expr);
Insert_Action (Declaration_Node (U_Ent),
Make_Raise_Program_Error (Loc,
Reason => PE_Overlaid_Controlled_Object));
@@ -2811,7 +2832,7 @@ package body Sem_Ch13 is
and then Ekind (U_Ent) = E_Constant
and then not Is_Constant_Object (O_Ent)
then
- Error_Msg_N ("constant overlays a variable?", Expr);
+ Error_Msg_N ("??constant overlays a variable", Expr);
-- Imported variables can have an address clause, but then
-- the import is pretty meaningless except to suppress
@@ -2982,7 +3003,7 @@ package body Sem_Ch13 is
if Is_Tagged_Type (U_Ent) and then Align > Max_Align then
Error_Msg_N
- ("?alignment for & set to Maximum_Aligment", Nam);
+ ("alignment for & set to Maximum_Aligment??", Nam);
Set_Alignment (U_Ent, Max_Align);
-- All other cases
@@ -3110,7 +3131,7 @@ package body Sem_Ch13 is
if not GNAT_Mode then
Error_Msg_N
- ("?component size ignored in this configuration", N);
+ ("component size ignored in this configuration??", N);
end if;
end if;
@@ -3121,8 +3142,7 @@ package body Sem_Ch13 is
and then RM_Size (Ctyp) /= Csize
then
Error_Msg_NE
- ("?component size overrides size clause for&",
- N, Ctyp);
+ ("component size overrides size clause for&?S?", N, Ctyp);
end if;
Set_Has_Component_Size_Clause (Btype, True);
@@ -3278,11 +3298,12 @@ package body Sem_Ch13 is
if not Is_Library_Level_Entity (U_Ent) then
Error_Msg_NE
- ("?non-unique external tag supplied for &", N, U_Ent);
+ ("??non-unique external tag supplied for &", N, U_Ent);
Error_Msg_N
- ("?\same external tag applies to all subprogram calls", N);
+ ("\??same external tag applies to all "
+ & "subprogram calls", N);
Error_Msg_N
- ("?\corresponding internal tag cannot be obtained", N);
+ ("\??corresponding internal tag cannot be obtained", N);
end if;
end if;
end External_Tag;
@@ -3563,7 +3584,7 @@ package body Sem_Ch13 is
-- case this is useless.
Error_Msg_N
- ("?size clauses are ignored in this configuration", N);
+ ("size clauses are ignored in this configuration??", N);
end if;
if Is_Type (U_Ent) then
@@ -3852,9 +3873,9 @@ package body Sem_Ch13 is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
- ("storage size clause for task is an " &
- "obsolescent feature (RM J.9)?", N);
- Error_Msg_N ("\use Storage_Size pragma instead?", N);
+ ("?j?storage size clause for task is an " &
+ "obsolescent feature (RM J.9)", N);
+ Error_Msg_N ("\?j?use Storage_Size pragma instead", N);
end if;
FOnly := True;
@@ -4487,7 +4508,7 @@ package body Sem_Ch13 is
if First_Entity (E) /= Last_Entity (E) then
Error_Msg_N
- ("?'C'P'P type must import at least one primitive from C++",
+ ("'C'P'P type must import at least one primitive from C++??",
E);
end if;
end if;
@@ -4514,15 +4535,15 @@ package body Sem_Ch13 is
or else Convention (Prim) /= Convention_CPP
then
Error_Msg_N
- ("?primitives of 'C'P'P types must be imported from C++"
- & " or abstract", Prim);
+ ("primitives of 'C'P'P types must be imported from C++ "
+ & "or abstract??", Prim);
elsif not Has_Constructors
and then not Error_Reported
then
Error_Msg_Name_1 := Chars (E);
Error_Msg_N
- ("?'C'P'P constructor required for type %", Prim);
+ ("??'C'P'P constructor required for type %", Prim);
Error_Reported := True;
end if;
end if;
@@ -4698,9 +4719,9 @@ package body Sem_Ch13 is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
- ("mod clause is an obsolescent feature (RM J.8)?", N);
+ ("?j?mod clause is an obsolescent feature (RM J.8)", N);
Error_Msg_N
- ("\use alignment attribute definition clause instead?", N);
+ ("\?j?use alignment attribute definition clause instead", N);
end if;
if Present (P) then
@@ -4887,7 +4908,7 @@ package body Sem_Ch13 is
& "with representation of ancestor", CC);
elsif Warn_On_Redundant_Constructs then
Error_Msg_N
- ("?redundant component clause "
+ ("?r?redundant component clause "
& "for inherited component!", CC);
end if;
end;
@@ -4927,7 +4948,7 @@ package body Sem_Ch13 is
and then RM_Size (Etype (Comp)) /= Esize (Comp)
then
Error_Msg_NE
- ("?component size overrides size clause for&",
+ ("?S?component size overrides size clause for&",
Component_Name (CC), Etype (Comp));
end if;
@@ -4993,7 +5014,7 @@ package body Sem_Ch13 is
Next_Component_Or_Discriminant (Comp);
end loop;
- -- If no Complete_Representation pragma, warn if missing components
+ -- Give missing components warning if required
elsif Warn_On_Unrepped_Components then
declare
@@ -5037,7 +5058,7 @@ package body Sem_Ch13 is
then
Error_Msg_Sloc := Sloc (Comp);
Error_Msg_NE
- ("?no component clause given for & declared #",
+ ("?C?no component clause given for & declared #",
N, Comp);
end if;
@@ -5066,9 +5087,7 @@ package body Sem_Ch13 is
-- Check for duplicate definiations.
- if Has_Invariants (Typ)
- and then Present (Invariant_Procedure (Typ))
- then
+ if Has_Invariants (Typ) and then Present (Invariant_Procedure (Typ)) then
return Empty;
end if;
@@ -5229,8 +5248,7 @@ package body Sem_Ch13 is
Exp := New_Copy_Tree (Arg2);
- -- Preserve sloc of original pragma Invariant (this is required
- -- by Par_SCO).
+ -- Preserve sloc of original pragma Invariant
Loc := Sloc (Ritem);
@@ -5321,7 +5339,7 @@ package body Sem_Ch13 is
if Inherit and Opt.List_Inherited_Aspects then
Error_Msg_Sloc := Sloc (Ritem);
Error_Msg_N
- ("?info: & inherits `Invariant''Class` aspect from #",
+ ("?L?info: & inherits `Invariant''Class` aspect from #",
Typ);
end if;
end if;
@@ -5545,7 +5563,7 @@ package body Sem_Ch13 is
then
Error_Msg_Sloc := Sloc (Predicate_Function (T));
Error_Msg_Node_2 := T;
- Error_Msg_N ("?info: & inherits predicate from & #", Typ);
+ Error_Msg_N ("info: & inherits predicate from & #?L?", Typ);
end if;
end if;
end Add_Call;
@@ -6755,7 +6773,7 @@ package body Sem_Ch13 is
("visibility of aspect for& changes after freeze point",
ASN, Ent);
Error_Msg_NE
- ("?info: & is frozen here, aspects evaluated at this point",
+ ("info: & is frozen here, aspects evaluated at this point??",
Freeze_Node (Ent), Ent);
end if;
end Check_Aspect_At_End_Of_Declarations;
@@ -7932,7 +7950,7 @@ package body Sem_Ch13 is
if Error_Msg_Uint_1 > 0 then
Error_Msg_NE
- ("?^-bit gap before component&",
+ ("?H?^-bit gap before component&",
Component_Name (Component_Clause (CEnt)), CEnt);
end if;
@@ -8887,7 +8905,7 @@ package body Sem_Ch13 is
if Present (Freeze_Node (S)) then
Error_Msg_NE
- ("?no more representation items for }", Freeze_Node (S), S);
+ ("??no more representation items for }", Freeze_Node (S), S);
end if;
return True;
@@ -9269,7 +9287,7 @@ package body Sem_Ch13 is
if Warn_On_Biased_Representation then
Error_Msg_NE
- ("?" & Msg & " forces biased representation for&", N, E);
+ ("?B?" & Msg & " forces biased representation for&", N, E);
end if;
end if;
end Set_Biased;
@@ -9378,13 +9396,13 @@ package body Sem_Ch13 is
Error_Msg_NE
("?& overlays smaller object", ACCR.N, ACCR.X);
Error_Msg_N
- ("\?program execution may be erroneous", ACCR.N);
+ ("\??program execution may be erroneous", ACCR.N);
Error_Msg_Uint_1 := X_Size;
Error_Msg_NE
- ("\?size of & is ^", ACCR.N, ACCR.X);
+ ("\??size of & is ^", ACCR.N, ACCR.X);
Error_Msg_Uint_1 := Y_Size;
Error_Msg_NE
- ("\?size of & is ^", ACCR.N, ACCR.Y);
+ ("\??size of & is ^", ACCR.N, ACCR.Y);
-- Check for inadequate alignment, both of the base object
-- and of the offset, if any.
@@ -9405,24 +9423,20 @@ package body Sem_Ch13 is
/= Known_Compatible))
then
Error_Msg_NE
- ("?specified address for& may be inconsistent "
- & "with alignment",
- ACCR.N, ACCR.X);
+ ("??specified address for& may be inconsistent "
+ & "with alignment", ACCR.N, ACCR.X);
Error_Msg_N
- ("\?program execution may be erroneous (RM 13.3(27))",
+ ("\??program execution may be erroneous (RM 13.3(27))",
ACCR.N);
Error_Msg_Uint_1 := X_Alignment;
Error_Msg_NE
- ("\?alignment of & is ^",
- ACCR.N, ACCR.X);
+ ("\??alignment of & is ^", ACCR.N, ACCR.X);
Error_Msg_Uint_1 := Y_Alignment;
Error_Msg_NE
- ("\?alignment of & is ^",
- ACCR.N, ACCR.Y);
+ ("\??alignment of & is ^", ACCR.N, ACCR.Y);
if Y_Alignment >= X_Alignment then
Error_Msg_N
- ("\?but offset is not multiple of alignment",
- ACCR.N);
+ ("\??but offset is not multiple of alignment", ACCR.N);
end if;
end if;
end if;
@@ -9783,7 +9797,8 @@ package body Sem_Ch13 is
or else OpenVMS_On_Target
then
Error_Msg_N
- ("?conversion between pointers with different conventions!", N);
+ ("?z?conversion between pointers with different conventions!",
+ N);
end if;
end if;
@@ -9809,7 +9824,7 @@ package body Sem_Ch13 is
if Source = Calendar_Time or else Target = Calendar_Time then
Error_Msg_N
- ("?representation of 'Time values may change between " &
+ ("?z?representation of 'Time values may change between " &
"'G'N'A'T versions", N);
end if;
end;
@@ -9831,7 +9846,8 @@ package body Sem_Ch13 is
-- known statically, then we need the annotation.
if Known_Static_RM_Size (Source)
- and then Known_Static_RM_Size (Target)
+ and then
+ Known_Static_RM_Size (Target)
then
null;
else
@@ -9909,7 +9925,7 @@ package body Sem_Ch13 is
if Source_Siz /= Target_Siz then
Error_Msg
- ("?types for unchecked conversion have different sizes!",
+ ("?z?types for unchecked conversion have different sizes!",
Eloc);
if All_Errors_Mode then
@@ -9917,7 +9933,7 @@ package body Sem_Ch13 is
Error_Msg_Uint_1 := Source_Siz;
Error_Msg_Name_2 := Chars (Target);
Error_Msg_Uint_2 := Target_Siz;
- Error_Msg ("\size of % is ^, size of % is ^?", Eloc);
+ Error_Msg ("\size of % is ^, size of % is ^?z?", Eloc);
Error_Msg_Uint_1 := UI_Abs (Source_Siz - Target_Siz);
@@ -9927,44 +9943,41 @@ package body Sem_Ch13 is
then
if Source_Siz > Target_Siz then
Error_Msg
- ("\?^ high order bits of source will be ignored!",
- Eloc);
+ ("\?z?^ high order bits of source will "
+ & "be ignored!", Eloc);
elsif Is_Unsigned_Type (Source) then
Error_Msg
- ("\?source will be extended with ^ high order " &
- "zero bits?!", Eloc);
+ ("\?z?source will be extended with ^ high order "
+ & "zero bits?!", Eloc);
else
Error_Msg
- ("\?source will be extended with ^ high order " &
- "sign bits!",
- Eloc);
+ ("\?z?source will be extended with ^ high order "
+ & "sign bits!", Eloc);
end if;
elsif Source_Siz < Target_Siz then
if Is_Discrete_Type (Target) then
if Bytes_Big_Endian then
Error_Msg
- ("\?target value will include ^ undefined " &
- "low order bits!",
- Eloc);
+ ("\?z?target value will include ^ undefined "
+ & "low order bits!", Eloc);
else
Error_Msg
- ("\?target value will include ^ undefined " &
- "high order bits!",
- Eloc);
+ ("\?z?target value will include ^ undefined "
+ & "high order bits!", Eloc);
end if;
else
Error_Msg
- ("\?^ trailing bits of target value will be " &
- "undefined!", Eloc);
+ ("\?z?^ trailing bits of target value will be "
+ & "undefined!", Eloc);
end if;
else pragma Assert (Source_Siz > Target_Siz);
Error_Msg
- ("\?^ trailing bits of source will be ignored!",
+ ("\?z?^ trailing bits of source will be ignored!",
Eloc);
end if;
end if;
@@ -10017,11 +10030,11 @@ package body Sem_Ch13 is
Error_Msg_Node_1 := D_Target;
Error_Msg_Node_2 := D_Source;
Error_Msg
- ("?alignment of & (^) is stricter than " &
- "alignment of & (^)!", Eloc);
+ ("?z?alignment of & (^) is stricter than "
+ & "alignment of & (^)!", Eloc);
Error_Msg
- ("\?resulting access value may have invalid " &
- "alignment!", Eloc);
+ ("\?z?resulting access value may have invalid "
+ & "alignment!", Eloc);
end if;
end;
end if;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 5745746ce00..5764223cd06 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -3643,9 +3643,9 @@ package body Sem_Ch3 is
(E, Attribute_Address))
then
Error_Msg_N
- ("?more than one task with same entry address", N);
+ ("??more than one task with same entry address", N);
Error_Msg_N
- ("\?Program_Error will be raised at run time", N);
+ ("\??Program_Error will be raised at run time", N);
Insert_Action (N,
Make_Raise_Program_Error (Loc,
Reason => PE_Duplicated_Entry_Address));
@@ -5049,10 +5049,45 @@ package body Sem_Ch3 is
Decl :=
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Anon,
- Type_Definition => Relocate_Node (Spec));
+ Type_Definition => Copy_Separate_Tree (Spec));
Mark_Rewrite_Insertion (Decl);
+ -- In ASIS mode, analyze the profile on the original node, because
+ -- the separate copy does not provide enough links to recover the
+ -- original tree. Analysis is limited to type annotations, within
+ -- a temporary scope that serves as an anonymous subprogram to collect
+ -- otherwise useless temporaries and itypes.
+
+ if ASIS_Mode then
+ declare
+ Typ : constant Entity_Id := Make_Temporary (Loc, 'S');
+
+ begin
+ if Nkind (Spec) = N_Access_Function_Definition then
+ Set_Ekind (Typ, E_Function);
+ else
+ Set_Ekind (Typ, E_Procedure);
+ end if;
+
+ Set_Parent (Typ, N);
+ Set_Scope (Typ, Current_Scope);
+ Push_Scope (Typ);
+
+ Process_Formals (Parameter_Specifications (Spec), Spec);
+
+ if Nkind (Spec) = N_Access_Function_Definition then
+ if Nkind (Result_Definition (Spec)) = N_Access_Definition then
+ Find_Type (Subtype_Mark (Result_Definition (Spec)));
+ else
+ Find_Type (Result_Definition (Spec));
+ end if;
+ end if;
+
+ End_Scope;
+ end;
+ end if;
+
-- Insert the new declaration in the nearest enclosing scope. If the
-- node is a body and N is its return type, the declaration belongs in
-- the enclosing scope.
@@ -10866,7 +10901,7 @@ package body Sem_Ch3 is
if Ada_Version < Ada_2005 then
Error_Msg_N
("access subtype of general access type would not " &
- "be allowed in Ada 2005?", S);
+ "be allowed in Ada 2005?y?", S);
else
Error_Msg_N
("access subtype of general access type not allowed", S);
@@ -10882,7 +10917,7 @@ package body Sem_Ch3 is
if Ada_Version < Ada_2005 then
Error_Msg_N
("access subtype would not be allowed in generic body " &
- "in Ada 2005?", S);
+ "in Ada 2005?y?", S);
else
Error_Msg_N
("access subtype not allowed in generic body", S);
@@ -11320,6 +11355,7 @@ package body Sem_Ch3 is
-- to one: one new discriminant can constrain several old ones. In
-- that case, scan sequentially the stored_constraint, the list of
-- discriminants of the parents, and the constraints.
+
-- Previous code checked for the present of the Stored_Constraint
-- list for the derived type, but did not use it at all. Should it
-- be present when the component is a discriminated task type?
@@ -11780,7 +11816,7 @@ package body Sem_Ch3 is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("subtype digits constraint is an " &
- "obsolescent feature (RM J.3(8))?", C);
+ "obsolescent feature (RM J.3(8))?j?", C);
end if;
D := Digits_Expression (C);
@@ -11794,7 +11830,7 @@ package body Sem_Ch3 is
if Digits_Value (Def_Id) > Digits_Value (T) then
Error_Msg_Uint_1 := Digits_Value (T);
- Error_Msg_N ("?digits value is too large, maximum is ^", D);
+ Error_Msg_N ("??digits value is too large, maximum is ^", D);
Rais :=
Make_Raise_Constraint_Error (Sloc (D),
Reason => CE_Range_Check_Failed);
@@ -12007,7 +12043,7 @@ package body Sem_Ch3 is
if Warn_On_Obsolescent_Feature then
Error_Msg_S
("subtype delta constraint is an " &
- "obsolescent feature (RM J.3(7))?");
+ "obsolescent feature (RM J.3(7))?j?");
end if;
D := Delta_Expression (C);
@@ -12020,7 +12056,7 @@ package body Sem_Ch3 is
-- course there is an ACVC test that checks this!
if Delta_Value (Def_Id) < Delta_Value (T) then
- Error_Msg_N ("?delta value is too small", D);
+ Error_Msg_N ("??delta value is too small", D);
Rais :=
Make_Raise_Constraint_Error (Sloc (D),
Reason => CE_Range_Check_Failed);
@@ -13320,8 +13356,29 @@ package body Sem_Ch3 is
-- of the parent subprogram (a requirement of AI-117). Derived
-- subprograms of untagged types simply get convention Ada by default.
+ -- If the derived type is a tagged generic formal type with unknown
+ -- discriminants, its convention is intrinsic (RM 6.3.1 (8)).
+
+ -- However, if the type is derived from a generic formal, the further
+ -- inherited subprogram has the convention of the non-generic ancestor.
+ -- Otherwise there would be no way to override the operation.
+ -- (This is subject to forthcoming ARG discussions).
+
if Is_Tagged_Type (Derived_Type) then
- Set_Convention (New_Subp, Convention (Parent_Subp));
+ if Is_Generic_Type (Derived_Type)
+ and then Has_Unknown_Discriminants (Derived_Type)
+ then
+ Set_Convention (New_Subp, Convention_Intrinsic);
+
+ else
+ if Is_Generic_Type (Parent_Type)
+ and then Has_Unknown_Discriminants (Parent_Type)
+ then
+ Set_Convention (New_Subp, Convention (Alias (Parent_Subp)));
+ else
+ Set_Convention (New_Subp, Convention (Parent_Subp));
+ end if;
+ end if;
end if;
-- Predefined controlled operations retain their name even if the parent
@@ -13333,9 +13390,9 @@ package body Sem_Ch3 is
if Is_Controlled (Parent_Type)
and then
- (Chars (Parent_Subp) = Name_Initialize
- or else Chars (Parent_Subp) = Name_Adjust
- or else Chars (Parent_Subp) = Name_Finalize)
+ (Chars (Parent_Subp) = Name_Initialize or else
+ Chars (Parent_Subp) = Name_Adjust or else
+ Chars (Parent_Subp) = Name_Finalize)
and then Is_Hidden (Parent_Subp)
and then not Is_Visibly_Controlled (Parent_Type)
then
@@ -13377,14 +13434,14 @@ package body Sem_Ch3 is
elsif Ada_Version >= Ada_2005
and then (Is_Abstract_Subprogram (Alias (New_Subp))
or else (Is_Tagged_Type (Derived_Type)
- and then Etype (New_Subp) = Derived_Type
- and then not Is_Null_Extension (Derived_Type))
+ and then Etype (New_Subp) = Derived_Type
+ and then not Is_Null_Extension (Derived_Type))
or else (Is_Tagged_Type (Derived_Type)
- and then Ekind (Etype (New_Subp)) =
+ and then Ekind (Etype (New_Subp)) =
E_Anonymous_Access_Type
- and then Designated_Type (Etype (New_Subp)) =
- Derived_Type
- and then not Is_Null_Extension (Derived_Type)))
+ and then Designated_Type (Etype (New_Subp)) =
+ Derived_Type
+ and then not Is_Null_Extension (Derived_Type)))
and then No (Actual_Subp)
then
if not Is_Tagged_Type (Derived_Type)
@@ -13509,9 +13566,7 @@ package body Sem_Ch3 is
-- an incomplete type whose full-view is derived type
E := First_Entity (Scope (Derived_Type));
- while Present (E)
- and then E /= Derived_Type
- loop
+ while Present (E) and then E /= Derived_Type loop
if Ekind (E) = E_Incomplete_Type
and then Present (Full_View (E))
and then Full_View (E) = Derived_Type
@@ -13614,7 +13669,7 @@ package body Sem_Ch3 is
Alias_Subp : Entity_Id;
Act_List : Elist_Id;
- Act_Elmt : Elmt_Id := No_Elmt;
+ Act_Elmt : Elmt_Id;
Act_Subp : Entity_Id := Empty;
Elmt : Elmt_Id;
Need_Search : Boolean := False;
@@ -13637,6 +13692,9 @@ package body Sem_Ch3 is
if Present (Generic_Actual) then
Act_List := Collect_Primitive_Operations (Generic_Actual);
Act_Elmt := First_Elmt (Act_List);
+ else
+ Act_List := No_Elist;
+ Act_Elmt := No_Elmt;
end if;
-- Derive primitives inherited from the parent. Note that if the generic
@@ -13648,8 +13706,7 @@ package body Sem_Ch3 is
if not Is_Tagged_Type (Derived_Type)
or else (not Has_Interfaces (Derived_Type)
and then not (Present (Generic_Actual)
- and then
- Has_Interfaces (Generic_Actual)))
+ and then Has_Interfaces (Generic_Actual)))
then
Elmt := First_Elmt (Op_List);
while Present (Elmt) loop
@@ -13673,9 +13730,10 @@ package body Sem_Ch3 is
else
pragma Assert (No (Node (Act_Elmt))
or else (Primitive_Names_Match (Subp, Node (Act_Elmt))
- and then
- Type_Conformant (Subp, Node (Act_Elmt),
- Skip_Controlling_Formals => True)));
+ and then
+ Type_Conformant
+ (Subp, Node (Act_Elmt),
+ Skip_Controlling_Formals => True)));
Derive_Subprogram
(New_Subp, Subp, Derived_Type, Parent_Base, Node (Act_Elmt));
@@ -13831,15 +13889,17 @@ package body Sem_Ch3 is
pragma Assert
(Is_Generic_Unit
(Scope (Find_Dispatching_Type (Alias_Subp)))
- or else
- Instantiation_Depth
- (Sloc (Find_Dispatching_Type (Alias_Subp))) > 0);
+ or else
+ Instantiation_Depth
+ (Sloc (Find_Dispatching_Type (Alias_Subp))) > 0);
declare
Iface_Prim_Loc : constant Source_Ptr :=
Original_Location (Sloc (Alias_Subp));
- Elmt : Elmt_Id;
- Prim : Entity_Id;
+
+ Elmt : Elmt_Id;
+ Prim : Entity_Id;
+
begin
Elmt :=
First_Elmt (Primitive_Operations (Generic_Actual));
@@ -13849,8 +13909,8 @@ package body Sem_Ch3 is
if Present (Interface_Alias (Prim))
and then Original_Location
- (Sloc (Interface_Alias (Prim)))
- = Iface_Prim_Loc
+ (Sloc (Interface_Alias (Prim))) =
+ Iface_Prim_Loc
then
Act_Subp := Alias (Prim);
exit Search;
@@ -14722,9 +14782,7 @@ package body Sem_Ch3 is
-- Set Discard_Names if configuration pragma set, or if there is
-- a parameterless pragma in the current declarative region
- if Global_Discard_Names
- or else Discard_Names (Scope (T))
- then
+ if Global_Discard_Names or else Discard_Names (Scope (T)) then
Set_Discard_Names (T);
end if;
@@ -16775,10 +16833,6 @@ package body Sem_Ch3 is
Set_Must_Not_Freeze (I);
Set_Must_Not_Freeze (Prefix (I));
-
- -- Is order critical??? if so, document why, if not
- -- use Analyze_And_Resolve
-
Analyze_And_Resolve (I);
T := Etype (I);
R := I;
@@ -16906,7 +16960,8 @@ package body Sem_Ch3 is
and then Nkind (Right_Opnd (Mod_Expr)) = N_Integer_Literal
and then Intval (Right_Opnd (Mod_Expr)) <= Uint_64
then
- Error_Msg_N ("suspicious MOD value, was '*'* intended'??", Mod_Expr);
+ Error_Msg_N
+ ("suspicious MOD value, was '*'* intended'??M?", Mod_Expr);
end if;
-- Proceed with analysis of mod expression
@@ -17251,7 +17306,7 @@ package body Sem_Ch3 is
High_Val := Expr_Value_R (High);
if Low_Val > High_Val then
- Error_Msg_NE ("?fixed point type& has null range", Def, T);
+ Error_Msg_NE ("??fixed point type& has null range", Def, T);
end if;
end;
end if;
@@ -19119,7 +19174,7 @@ package body Sem_Ch3 is
then
Make_Class_Wide_Type (Typ);
Error_Msg_N
- ("incomplete view of tagged type should be declared tagged?",
+ ("incomplete view of tagged type should be declared tagged??",
Parent (Current_Entity (Typ)));
end if;
return;
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 718af47f17c..14e7f93da7c 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -635,8 +635,9 @@ package body Sem_Ch4 is
Insert_Action (N, Not_Null_Check);
Analyze (Not_Null_Check);
- else
- Error_Msg_N ("null value not allowed here?", E);
+ elsif Warn_On_Ada_2012_Compatibility then
+ Error_Msg_N
+ ("null value not allowed here in Ada 2012?y?", E);
end if;
end;
end if;
@@ -2082,7 +2083,8 @@ package body Sem_Ch4 is
-- account a possible implicit dereference.
if Is_Access_Type (Array_Type) then
- Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
+ Error_Msg_NW
+ (Warn_On_Dereference, "?d?implicit dereference", N);
Array_Type := Process_Implicit_Dereference_Prefix (Pent, P);
end if;
@@ -2241,7 +2243,8 @@ package body Sem_Ch4 is
if Is_Access_Type (Typ) then
Typ := Designated_Type (Typ);
- Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
+ Error_Msg_NW
+ (Warn_On_Dereference, "?d?implicit dereference", N);
end if;
if Is_Array_Type (Typ) then
@@ -2670,7 +2673,7 @@ package body Sem_Ch4 is
and then Intval (Right_Opnd (Parent (N))) <= Uint_64
then
Error_Msg_N
- ("suspicious MOD value, was '*'* intended'??", Parent (N));
+ ("suspicious MOD value, was '*'* intended'??M?", Parent (N));
end if;
-- Remaining processing is same as for other arithmetic operators
@@ -3235,7 +3238,7 @@ package body Sem_Ch4 is
while Present (It.Typ) loop
if Is_Access_Type (It.Typ) then
T := Designated_Type (It.Typ);
- Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
+ Error_Msg_NW (Warn_On_Dereference, "?d?implicit dereference", N);
else
T := It.Typ;
end if;
@@ -3318,7 +3321,7 @@ package body Sem_Ch4 is
then
Insert_Explicit_Dereference (Nam);
Error_Msg_NW
- (Warn_On_Dereference, "?implicit dereference", N);
+ (Warn_On_Dereference, "?d?implicit dereference", N);
end if;
end if;
@@ -3427,13 +3430,13 @@ package body Sem_Ch4 is
if All_Present (N) then
Error_Msg_N
- ("?quantified expression with ALL "
+ ("??quantified expression with ALL "
& "over a null range has value True", N);
Rewrite (N, New_Occurrence_Of (Standard_True, Loc));
else
Error_Msg_N
- ("?quantified expression with SOME "
+ ("??quantified expression with SOME "
& "over a null range has value False", N);
Rewrite (N, New_Occurrence_Of (Standard_False, Loc));
end if;
@@ -3810,7 +3813,7 @@ package body Sem_Ch4 is
-- Normal case of selected component applied to access type
else
- Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
+ Error_Msg_NW (Warn_On_Dereference, "?d?implicit dereference", N);
if Is_Entity_Name (Name) then
Pent := Entity (Name);
@@ -3922,7 +3925,7 @@ package body Sem_Ch4 is
if Is_Access_Type (Etype (Name)) then
Insert_Explicit_Dereference (Name);
- Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
+ Error_Msg_NW (Warn_On_Dereference, "?d?implicit dereference", N);
end if;
elsif Is_Record_Type (Prefix_Type) then
@@ -4220,7 +4223,7 @@ package body Sem_Ch4 is
if Is_Access_Type (Etype (Name)) then
Insert_Explicit_Dereference (Name);
Error_Msg_NW
- (Warn_On_Dereference, "?implicit dereference", N);
+ (Warn_On_Dereference, "?d?implicit dereference", N);
end if;
end if;
@@ -4403,7 +4406,7 @@ package body Sem_Ch4 is
Ent => Prefix_Type, Rep => False);
else
Apply_Compile_Time_Constraint_Error
- (N, "component not present in }?",
+ (N, "component not present in }??",
CE_Discriminant_Check_Failed,
Ent => Prefix_Type, Rep => False);
end if;
@@ -4537,7 +4540,8 @@ package body Sem_Ch4 is
if Is_Access_Type (Typ) then
Typ := Designated_Type (Typ);
- Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
+ Error_Msg_NW
+ (Warn_On_Dereference, "?d?implicit dereference", N);
end if;
if Is_Array_Type (Typ)
@@ -4574,7 +4578,7 @@ package body Sem_Ch4 is
if Is_Access_Type (Array_Type) then
Array_Type := Designated_Type (Array_Type);
- Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
+ Error_Msg_NW (Warn_On_Dereference, "?d?implicit dereference", N);
end if;
if not Is_Array_Type (Array_Type) then
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index a16e01e2be8..04c07bec6d9 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -430,9 +430,9 @@ package body Sem_Ch5 is
if Locking_Policy /= 'C' then
Error_Msg_N ("assignment to the attribute PRIORITY has " &
- "no effect?", Lhs);
+ "no effect??", Lhs);
Error_Msg_N ("\since no Locking_Policy has been " &
- "specified", Lhs);
+ "specified??", Lhs);
end if;
return;
@@ -636,8 +636,9 @@ package body Sem_Ch5 is
if Known_Null (Rhs) then
Apply_Compile_Time_Constraint_Error
- (N => Rhs,
- Msg => "(Ada 2005) null not allowed in null-excluding objects?",
+ (N => Rhs,
+ Msg =>
+ "(Ada 2005) null not allowed in null-excluding objects??",
Reason => CE_Null_Not_Allowed);
-- We still mark this as a possible modification, that's necessary
@@ -717,10 +718,10 @@ package body Sem_Ch5 is
then
if Nkind (Lhs) in N_Has_Entity then
Error_Msg_NE -- CODEFIX
- ("?useless assignment of & to itself!", N, Entity (Lhs));
+ ("?r?useless assignment of & to itself!", N, Entity (Lhs));
else
Error_Msg_N -- CODEFIX
- ("?useless assignment of object to itself!", N);
+ ("?r?useless assignment of object to itself!", N);
end if;
end if;
@@ -2405,7 +2406,7 @@ package body Sem_Ch5 is
(L, H, Assume_Valid => False) = GT
then
Error_Msg_N
- ("?loop range is null, loop will not execute", DS);
+ ("??loop range is null, loop will not execute", DS);
-- Since we know the range of the loop is null, set the
-- appropriate flag to remove the loop entirely during
@@ -2420,9 +2421,11 @@ package body Sem_Ch5 is
else
Error_Msg_N
- ("?loop range may be null, loop may not execute", DS);
+ ("??loop range may be null, loop may not execute",
+ DS);
Error_Msg_N
- ("?can only execute if invalid values are present", DS);
+ ("??can only execute if invalid values are present",
+ DS);
end if;
end if;
@@ -2449,8 +2452,8 @@ package body Sem_Ch5 is
(Intval (Original_Node (H)) = Uint_0
or else Intval (Original_Node (H)) = Uint_1)
then
- Error_Msg_N ("?loop range may be null", DS);
- Error_Msg_N ("\?bounds may be wrong way round", DS);
+ Error_Msg_N ("??loop range may be null", DS);
+ Error_Msg_N ("\??bounds may be wrong way round", DS);
end if;
end;
end if;
@@ -2666,7 +2669,7 @@ package body Sem_Ch5 is
then
Error_Msg_Sloc := Sloc (ODSD);
Error_Msg_N
- ("inner range same as outer range#?", DSD);
+ ("inner range same as outer range#??", DSD);
end if;
end;
end if;
@@ -2918,7 +2921,7 @@ package body Sem_Ch5 is
Check_SPARK_Restriction
("unreachable code is not allowed", Error_Node);
else
- Error_Msg ("?unreachable code!", Sloc (Error_Node));
+ Error_Msg ("??unreachable code!", Sloc (Error_Node));
end if;
end if;
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 2903e896e5e..eae2df3c000 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -261,7 +261,7 @@ package body Sem_Ch6 is
or else Scop /= Scope (Etype (First_Formal (Designator))))
then
Error_Msg_N
- ("?abstract subprogram is not dispatching or overriding", N);
+ ("abstract subprogram is not dispatching or overriding?r?", N);
end if;
Generate_Reference_To_Formals (Designator);
@@ -579,16 +579,16 @@ package body Sem_Ch6 is
if Inside_A_Generic then
Error_Msg_N
("return of limited object not permitted in Ada 2005 "
- & "(RM-2005 6.5(5.5/2))?", Expr);
+ & "(RM-2005 6.5(5.5/2))?y?", Expr);
elsif Is_Immutably_Limited_Type (R_Type) then
Error_Msg_N
("return by reference not permitted in Ada 2005 "
- & "(RM-2005 6.5(5.5/2))?", Expr);
+ & "(RM-2005 6.5(5.5/2))?y?", Expr);
else
Error_Msg_N
("cannot copy object of a limited type in Ada 2005 "
- & "(RM-2005 6.5(5.5/2))?", Expr);
+ & "(RM-2005 6.5(5.5/2))?y?", Expr);
end if;
-- Ada 95 mode, compatibility warnings disabled
@@ -847,7 +847,12 @@ package body Sem_Ch6 is
if Has_Aliased then
if Ada_Version < Ada_2012 then
- Error_Msg_N ("aliased only allowed for limited"
+
+ -- Shouldn't this test Warn_On_Ada_2012_Compatibility ???
+ -- Can it really happen (extended return???)
+
+ Error_Msg_N
+ ("aliased only allowed for limited"
& " return objects in Ada 2012?", N);
elsif not Is_Immutably_Limited_Type (R_Type) then
@@ -937,7 +942,6 @@ package body Sem_Ch6 is
and then Object_Access_Level (Expr) >
Subprogram_Access_Level (Scope_Id)
then
-
-- Suppress the message in a generic, where the rewriting
-- is irrelevant.
@@ -951,9 +955,9 @@ package body Sem_Ch6 is
Analyze (N);
Error_Msg_N
- ("cannot return a local value by reference?", N);
+ ("cannot return a local value by reference??", N);
Error_Msg_NE
- ("\& will be raised at run time?",
+ ("\& will be raised at run time??",
N, Standard_Program_Error);
end if;
end if;
@@ -965,7 +969,7 @@ package body Sem_Ch6 is
Apply_Compile_Time_Constraint_Error
(N => Expr,
Msg => "(Ada 2005) null not allowed for "
- & "null-excluding return?",
+ & "null-excluding return??",
Reason => CE_Null_Not_Allowed);
end if;
@@ -3784,6 +3788,7 @@ package body Sem_Ch6 is
if Has_Excluded_Statement (Then_Statements (E)) then
return True;
end if;
+
Next (E);
end loop;
end if;
@@ -3971,7 +3976,7 @@ package body Sem_Ch6 is
then
Cannot_Inline
("cannot inline & (call returns unconstrained type)?",
- N, Subp);
+ N, Subp);
return Abandon;
else
return OK;
@@ -4168,7 +4173,7 @@ package body Sem_Ch6 is
Error_Msg_NE (Msg (Msg'First .. Msg'Last - 1), N, Subp);
elsif Ineffective_Inline_Warnings then
- Error_Msg_NE (Msg, N, Subp);
+ Error_Msg_NE (Msg & "p?", N, Subp);
end if;
return;
@@ -4207,7 +4212,7 @@ package body Sem_Ch6 is
(Unit_File_Name (Get_Source_Unit (Gen_P)))
then
Set_Is_Inlined (Subp, False);
- Error_Msg_NE (Msg, N, Subp);
+ Error_Msg_NE (Msg & "p?", N, Subp);
return;
end if;
end;
@@ -4225,7 +4230,7 @@ package body Sem_Ch6 is
-- For backward compatibility we still report a warning.
if Ineffective_Inline_Warnings then
- Error_Msg_NE (Msg, N, Subp);
+ Error_Msg_NE (Msg & "p?", N, Subp);
end if;
end if;
@@ -6912,10 +6917,10 @@ package body Sem_Ch6 is
if Mode = 'F' then
if not Raise_Exception_Call then
Error_Msg_N
- ("?RETURN statement missing following this statement!",
+ ("RETURN statement missing following this statement??!",
Last_Stm);
Error_Msg_N
- ("\?Program_Error may be raised at run time!",
+ ("\Program_Error may be raised at run time??!",
Last_Stm);
end if;
@@ -6931,11 +6936,11 @@ package body Sem_Ch6 is
else
if not Raise_Exception_Call then
Error_Msg_N
- ("?implied return after this statement " &
- "will raise Program_Error",
+ ("implied return after this statement " &
+ "will raise Program_Error??",
Last_Stm);
Error_Msg_NE
- ("\?procedure & is marked as No_Return!",
+ ("\procedure & is marked as No_Return??!",
Last_Stm, Proc);
end if;
@@ -7172,7 +7177,7 @@ package body Sem_Ch6 is
No_Warning_On_Some_Postcondition := True;
else
Error_Msg_N
- ("?`Ensures` component refers only to pre-state", Prag);
+ ("`Ensures` component refers only to pre-state??", Prag);
end if;
end if;
@@ -7229,7 +7234,7 @@ package body Sem_Ch6 is
No_Warning_On_Some_Postcondition := True;
else
Error_Msg_N
- ("?postcondition refers only to pre-state", Prag);
+ ("postcondition refers only to pre-state??", Prag);
end if;
end if;
end if;
@@ -7283,17 +7288,18 @@ package body Sem_Ch6 is
then
if Present (Last_Postcondition) then
if Present (Last_Contract_Case) then
- Error_Msg_N ("?neither function postcondition nor " &
- "contract cases do mention result",
- Last_Postcondition);
+ Error_Msg_N
+ ("neither function postcondition nor "
+ & "contract cases mention result?T?", Last_Postcondition);
else
- Error_Msg_N ("?function postcondition does not mention result",
- Last_Postcondition);
+ Error_Msg_N
+ ("function postcondition does not mention result?T?",
+ Last_Postcondition);
end if;
else
- Error_Msg_N ("?contract cases do not mention result",
- Last_Contract_Case);
+ Error_Msg_N
+ ("contract cases do not mention result?T?", Last_Contract_Case);
end if;
end if;
end Check_Subprogram_Contract;
@@ -8143,14 +8149,14 @@ package body Sem_Ch6 is
then
if Scope (E) /= Standard_Standard then
Error_Msg_Sloc := Sloc (E);
- Error_Msg_N ("declaration of & hides one#?", S);
+ Error_Msg_N ("declaration of & hides one#?h?", S);
elsif Nkind (S) = N_Defining_Operator_Symbol
and then
Scope (Base_Type (Etype (First_Formal (S)))) /= Scope (S)
then
Error_Msg_N
- ("declaration of & hides predefined operator?", S);
+ ("declaration of & hides predefined operator?h?", S);
end if;
end if;
end loop;
@@ -8199,17 +8205,15 @@ package body Sem_Ch6 is
& "before type& is frozen", Eq_Op, Typ);
Obj_Decl := Next (Parent (Typ));
- while Present (Obj_Decl)
- and then Obj_Decl /= Decl
- loop
+ while Present (Obj_Decl) and then Obj_Decl /= Decl loop
if Nkind (Obj_Decl) = N_Object_Declaration
and then Etype (Defining_Identifier (Obj_Decl)) = Typ
then
- Error_Msg_NE ("type& is frozen by declaration?",
- Obj_Decl, Typ);
+ Error_Msg_NE
+ ("type& is frozen by declaration??", Obj_Decl, Typ);
Error_Msg_N
("\an equality operator cannot be declared after this "
- & "point (RM 4.5.2 (9.8)) (Ada 2012))?", Obj_Decl);
+ & "point (RM 4.5.2 (9.8)) (Ada 2012))??", Obj_Decl);
exit;
end if;
@@ -9328,7 +9332,7 @@ package body Sem_Ch6 is
Error_Msg_Node_2 := F_Typ;
Error_Msg_NE
("private operation& in generic unit does not override " &
- "any primitive operation of& (RM 12.3 (18))?",
+ "any primitive operation of& (RM 12.3 (18))??",
New_E, New_E);
end if;
@@ -9350,24 +9354,24 @@ package body Sem_Ch6 is
and then (Is_Subprogram (E) or else Is_Generic_Subprogram (E))
then
declare
- Inherited : constant Subprogram_List :=
- Inherited_Subprograms (E);
+ Inherited : constant Subprogram_List := Inherited_Subprograms (E);
P : Node_Id;
begin
for J in Inherited'Range loop
P := Spec_PPC_List (Contract (Inherited (J)));
-
while Present (P) loop
Error_Msg_Sloc := Sloc (P);
if Class_Present (P) and then not Split_PPC (P) then
if Pragma_Name (P) = Name_Precondition then
Error_Msg_N
- ("?info: & inherits `Pre''Class` aspect from #", E);
+ ("info: & inherits `Pre''Class` aspect from #?L?",
+ E);
else
Error_Msg_N
- ("?info: & inherits `Post''Class` aspect from #", E);
+ ("info: & inherits `Post''Class` aspect from #?L?",
+ E);
end if;
end if;
@@ -10659,7 +10663,7 @@ package body Sem_Ch6 is
and then No (F1)
and then No (F2)
then
- Error_Msg_NE ("calls to& may be ambiguous?", S, S);
+ Error_Msg_NE ("calls to& may be ambiguous??", S, S);
end if;
end;
end if;
@@ -11094,7 +11098,7 @@ package body Sem_Ch6 is
if Convention (Formal_Type) = Convention_Ada_Pass_By_Copy then
Error_Msg_N
- ("?cannot pass aliased parameter & by copy", Formal);
+ ("cannot pass aliased parameter & by copy?", Formal);
end if;
-- Force mechanism if type has Convention Ada_Pass_By_Ref/Copy
diff --git a/gcc/ada/sem_ch6.ads b/gcc/ada/sem_ch6.ads
index 5d30df76c95..a0df51ef21e 100644
--- a/gcc/ada/sem_ch6.ads
+++ b/gcc/ada/sem_ch6.ads
@@ -58,26 +58,31 @@ package Sem_Ch6 is
Is_Serious : Boolean := False);
-- This procedure is called if the node N, an instance of a call to
-- subprogram Subp, cannot be inlined. Msg is the message to be issued,
- -- and has a ? as the last character. Temporarily the behavior of this
- -- routine depends on the value of -gnatd.k:
+ -- which ends with ? (it does not end with ?p?, this routine takes care of
+ -- the need to change ? to ?p?). Temporarily the behavior of this routine
+ -- depends on the value of -gnatd.k:
+ --
-- * If -gnatd.k is not set (ie. old inlining model) then if Subp has
-- a pragma Always_Inlined, then an error message is issued (by
-- removing the last character of Msg). If Subp is not Always_Inlined,
-- then a warning is issued if the flag Ineffective_Inline_Warnings
- -- is set, and if not, the call has no effect.
+ -- is set, adding ?p to the msg, and if not, the call has no effect.
+ --
-- * If -gnatd.k is set (ie. new inlining model) then:
-- - If Is_Serious is true, then an error is reported (by removing the
-- last character of Msg);
+ --
-- - otherwise:
+ --
-- * Compiling without optimizations if Subp has a pragma
-- Always_Inlined, then an error message is issued; if Subp is
-- not Always_Inlined, then a warning is issued if the flag
- -- Ineffective_Inline_Warnings is set, and if not, the call
- -- has no effect.
- -- * Compiling with optimizations then a warning is issued if
- -- the flag Ineffective_Inline_Warnings is set; otherwise the
- -- call has no effect since inlining may be performed by the
- -- backend.
+ -- Ineffective_Inline_Warnings is set (adding p?), and if not,
+ -- the call has no effect.
+ --
+ -- * Compiling with optimizations then a warning is issued if the
+ -- flag Ineffective_Inline_Warnings is set (adding p?); otherwise
+ -- no effect since inlining may be performed by the backend.
procedure Check_Conventions (Typ : Entity_Id);
-- Ada 2005 (AI-430): Check that the conventions of all inherited and
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index a25e3283338..b81f57554aa 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -261,7 +261,7 @@ package body Sem_Ch7 is
then
if Ada_Version = Ada_83 then
Error_Msg_N
- ("optional package body (not allowed in Ada 95)?", N);
+ ("optional package body (not allowed in Ada 95)??", N);
else
Error_Msg_N ("spec of this package does not allow a body", N);
end if;
@@ -2218,7 +2218,7 @@ package body Sem_Ch7 is
Write_Eol;
end if;
- -- On exit from the package scope, we must preserve the visibility
+ -- On exit from the package scope, we must preserve the visibility
-- established by use clauses in the current scope. Two cases:
-- a) If the entity is an operator, it may be a primitive operator of
@@ -2252,8 +2252,8 @@ package body Sem_Ch7 is
-- of its parent unit.
if Is_Child_Unit (Id) then
- Set_Is_Potentially_Use_Visible (Id,
- Is_Visible_Child_Unit (Id));
+ Set_Is_Potentially_Use_Visible
+ (Id, Is_Visible_Child_Unit (Id));
else
Set_Is_Potentially_Use_Visible (Id);
end if;
@@ -2272,9 +2272,7 @@ package body Sem_Ch7 is
-- full view is also removed from visibility: it may be exposed when
-- swapping views in an instantiation.
- if Is_Type (Id)
- and then Present (Full_View (Id))
- then
+ if Is_Type (Id) and then Present (Full_View (Id)) then
Set_Is_Immediately_Visible (Full_View (Id), False);
end if;
@@ -2328,7 +2326,7 @@ package body Sem_Ch7 is
-- OK if object declaration with the No_Initialization flag set
and then not (Nkind (Parent (Id)) = N_Object_Declaration
- and then No_Initialization (Parent (Id)))
+ and then No_Initialization (Parent (Id)))
then
-- If no private declaration is present, we assume the user did
-- not intend a deferred constant declaration and the problem
@@ -2354,13 +2352,13 @@ package body Sem_Ch7 is
else
Error_Msg_N
- ("missing full declaration for deferred constant (RM 7.4)",
- Id);
+ ("missing full declaration for deferred constant (RM 7.4)",
+ Id);
if Is_Limited_Type (Etype (Id)) then
Error_Msg_N
("\if variable intended, remove CONSTANT from declaration",
- Parent (Id));
+ Parent (Id));
end if;
end if;
end if;
@@ -2396,9 +2394,7 @@ package body Sem_Ch7 is
Set_Is_Immediately_Visible (Id, False);
- if Is_Private_Base_Type (Id)
- and then Present (Full_View (Id))
- then
+ if Is_Private_Base_Type (Id) and then Present (Full_View (Id)) then
Full := Full_View (Id);
-- If the partial view is not declared in the visible part of the
@@ -2407,8 +2403,8 @@ package body Sem_Ch7 is
-- no exchange takes place.
if No (Parent (Id))
- or else List_Containing (Parent (Id))
- /= Visible_Declarations (Specification (Decl))
+ or else List_Containing (Parent (Id)) /=
+ Visible_Declarations (Specification (Decl))
then
goto Next_Id;
end if;
@@ -2433,9 +2429,9 @@ package body Sem_Ch7 is
Priv_Elmt := First_Elmt (Private_Dependents (Id));
- -- Swap out the subtypes and derived types of Id that were
- -- compiled in this scope, or installed previously by
- -- Install_Private_Declarations.
+ -- Swap out the subtypes and derived types of Id that
+ -- were compiled in this scope, or installed previously
+ -- by Install_Private_Declarations.
-- Before we do the swap, we verify the presence of the Full_View
-- field which may be empty due to a swap by a previous call to
@@ -2445,7 +2441,6 @@ package body Sem_Ch7 is
Priv_Sub := Node (Priv_Elmt);
if Present (Full_View (Priv_Sub)) then
-
if Scope (Priv_Sub) = P
or else not In_Open_Scopes (Scope (Priv_Sub))
then
@@ -2615,11 +2610,11 @@ package body Sem_Ch7 is
-- expander will provide an implicit completion at some point.
elsif (Is_Overloadable (E)
- and then Ekind (E) /= E_Enumeration_Literal
- and then Ekind (E) /= E_Operator
- and then not Is_Abstract_Subprogram (E)
- and then not Has_Completion (E)
- and then Comes_From_Source (Parent (E)))
+ and then Ekind (E) /= E_Enumeration_Literal
+ and then Ekind (E) /= E_Operator
+ and then not Is_Abstract_Subprogram (E)
+ and then not Has_Completion (E)
+ and then Comes_From_Source (Parent (E)))
or else
(Ekind (E) = E_Package
@@ -2633,12 +2628,12 @@ package body Sem_Ch7 is
and then not Is_Generic_Type (E))
or else
- ((Ekind (E) = E_Task_Type or else
- Ekind (E) = E_Protected_Type)
+ (Ekind_In (E, E_Task_Type, E_Protected_Type)
and then not Has_Completion (E))
or else
- (Ekind (E) = E_Generic_Package and then E /= P
+ (Ekind (E) = E_Generic_Package
+ and then E /= P
and then not Has_Completion (E)
and then Unit_Requires_Body (E))
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index ae12e466811..4437a16aa6e 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -397,8 +397,10 @@ package body Sem_Ch8 is
New_S : Entity_Id;
Is_Body : Boolean);
-- If the renamed entity in a subprogram renaming is a primitive operation
- -- or a class-wide operation in prefix form, save the target object, which
- -- must be added to the list of actuals in any subsequent call.
+ -- or a class-wide operation in prefix form, save the target object,
+ -- which must be added to the list of actuals in any subsequent call.
+ -- The renaming operation is intrinsic because the compiler must in
+ -- fact generate a wrapper for it (6.3.1 (10 1/2)).
function Applicable_Use (Pack_Name : Node_Id) return Boolean;
-- Common code to Use_One_Package and Set_Use, to determine whether use
@@ -1015,13 +1017,13 @@ package body Sem_Ch8 is
and then Comes_From_Source (Nam)
then
Error_Msg_N
- ("?renaming function result object is suspicious", Nam);
+ ("renaming function result object is suspicious?R?", Nam);
Error_Msg_NE
- ("\?function & will be called only once", Nam,
+ ("\function & will be called only once?R?", Nam,
Entity (Name (Nam)));
Error_Msg_N -- CODEFIX
- ("\?suggest using an initialized constant object instead",
- Nam);
+ ("\suggest using an initialized constant "
+ & "object instead?R?", Nam);
end if;
end case;
@@ -1602,6 +1604,10 @@ package body Sem_Ch8 is
-- match. The first formal of the renamed entity is skipped because it
-- is the target object in any subsequent call.
+ --------------
+ -- Conforms --
+ --------------
+
function Conforms
(Subp : Entity_Id;
Ctyp : Conformance_Type) return Boolean
@@ -1634,6 +1640,8 @@ package body Sem_Ch8 is
return True;
end Conforms;
+ -- Start of processing for Analyze_Renamed_Primitive_Operation
+
begin
if not Is_Overloaded (Selector_Name (Name (N))) then
Old_S := Entity (Selector_Name (Name (N)));
@@ -1681,6 +1689,14 @@ package body Sem_Ch8 is
if not Conforms (Old_S, Mode_Conformant) then
Error_Msg_N ("mode conformance error in renaming", N);
end if;
+
+ -- Enforce the rule given in (RM 6.3.1 (10.1/2)): a prefixed
+ -- view of a subprogram is intrinsic, because the compiler has
+ -- to generate a wrapper for any call to it. If the name in a
+ -- subprogram renaming is a prefixed view, the entity is thus
+ -- intrinsic, and 'Access cannot be applied to it.
+
+ Set_Convention (New_S, Convention_Intrinsic);
end if;
-- Inherit_Renamed_Profile (New_S, Old_S);
@@ -1890,7 +1906,7 @@ package body Sem_Ch8 is
end loop;
New_S := Analyze_Subprogram_Specification (Spec);
- Result := Find_Renamed_Entity (N, Name (N), New_S, Is_Actual);
+ Result := Find_Renamed_Entity (N, Name (N), New_S, Is_Actual);
end if;
if Result /= Any_Id then
@@ -2273,10 +2289,10 @@ package body Sem_Ch8 is
and then Hidden /= Old_S
then
Error_Msg_Sloc := Sloc (Hidden);
- Error_Msg_N ("?default subprogram is resolved " &
+ Error_Msg_N ("default subprogram is resolved " &
"in the generic declaration " &
- "(RM 12.6(17))", N);
- Error_Msg_NE ("\?and will not use & #", N, Hidden);
+ "(RM 12.6(17))??", N);
+ Error_Msg_NE ("\and will not use & #??", N, Hidden);
end if;
end;
end if;
@@ -2926,7 +2942,7 @@ package body Sem_Ch8 is
and then Chars (Old_S) /= Chars (New_S)
then
Error_Msg_NE
- ("?& is being renamed as a different operator", N, Old_S);
+ ("& is being renamed as a different operator??", N, Old_S);
end if;
-- Check for renaming of obsolescent subprogram
@@ -2949,7 +2965,7 @@ package body Sem_Ch8 is
and then Chars (Current_Scope) /= Chars (Old_S)
then
Error_Msg_N
- ("?redundant renaming, entity is directly visible", Name (N));
+ ("redundant renaming, entity is directly visible?r?", Name (N));
end if;
-- Implementation-defined aspect specifications can appear in a renaming
@@ -3203,7 +3219,7 @@ package body Sem_Ch8 is
and then Pack = Current_Scope
then
Error_Msg_NE -- CODEFIX
- ("& is already use-visible within itself?", Pack_Name, Pack);
+ ("& is already use-visible within itself?r?", Pack_Name, Pack);
end if;
return False;
@@ -4728,7 +4744,7 @@ package body Sem_Ch8 is
goto Found;
-- If there is more than one potentially use-visible entity and at
- -- least one of them non-overloadable, we have an error (RM 8.4(11).
+ -- least one of them non-overloadable, we have an error (RM 8.4(11)).
-- Note that E points to the first such entity on the homonym list.
-- Special case: if one of the entities is declared in an actual
-- package, it was visible in the generic, and takes precedence over
@@ -5999,7 +6015,8 @@ package body Sem_Ch8 is
then
-- Selected component of record. Type checking will validate
-- name of selector.
- -- ??? could we rewrite an implicit dereference into an explicit
+
+ -- ??? Could we rewrite an implicit dereference into an explicit
-- one here?
Analyze_Selected_Component (N);
@@ -6259,18 +6276,18 @@ package body Sem_Ch8 is
Set_Entity (N, Any_Type);
return;
- -- ??? This test is temporarily disabled (always False)
- -- because it causes an unwanted warning on GNAT sources
- -- (built with -gnatg, which includes Warn_On_Obsolescent_
- -- Feature). Once this issue is cleared in the sources, it
- -- can be enabled.
+ -- ??? This test is temporarily disabled (always
+ -- False) because it causes an unwanted warning on
+ -- GNAT sources (built with -gnatg, which includes
+ -- Warn_On_Obsolescent_ Feature). Once this issue
+ -- is cleared in the sources, it can be enabled.
elsif Warn_On_Obsolescent_Feature
and then False
then
Error_Msg_N
("applying 'Class to an untagged incomplete type"
- & " is an obsolescent feature (RM J.11)", N);
+ & " is an obsolescent feature (RM J.11)?r?", N);
end if;
end if;
@@ -6363,7 +6380,7 @@ package body Sem_Ch8 is
and then Base_Type (Typ) = Typ
then
Error_Msg_NE -- CODEFIX
- ("?redundant attribute, & is its own base type", N, Typ);
+ ("redundant attribute, & is its own base type?r?", N, Typ);
end if;
T := Base_Type (Typ);
@@ -7232,7 +7249,7 @@ package body Sem_Ch8 is
if Present (Redundant) then
Error_Msg_Sloc := Sloc (Prev_Use);
Error_Msg_NE -- CODEFIX
- ("& is already use-visible through previous use clause #?",
+ ("& is already use-visible through previous use clause #??",
Redundant, Pack_Name);
end if;
end Note_Redundant_Use;
@@ -8346,14 +8363,14 @@ package body Sem_Ch8 is
Error_Msg_Sloc := Sloc (Current_Use_Clause (T));
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use_type_clause #?", Clause1, T);
+ & "use_type_clause #??", Clause1, T);
return;
elsif Nkind (Unit1) = N_Subunit then
Error_Msg_Sloc := Sloc (Current_Use_Clause (T));
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use_type_clause #?", Clause1, T);
+ & "use_type_clause #??", Clause1, T);
return;
elsif Nkind_In (Unit2, N_Package_Body, N_Subprogram_Body)
@@ -8363,7 +8380,7 @@ package body Sem_Ch8 is
Error_Msg_Sloc := Sloc (Clause1);
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use_type_clause #?", Current_Use_Clause (T), T);
+ & "use_type_clause #??", Current_Use_Clause (T), T);
return;
end if;
@@ -8415,7 +8432,7 @@ package body Sem_Ch8 is
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use_type_clause #?", Err_No, Id);
+ & "use_type_clause #??", Err_No, Id);
-- Case where current use type clause and the use type
-- clause for the type are not both at the compilation unit
@@ -8424,7 +8441,7 @@ package body Sem_Ch8 is
else
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use type clause?", Id, T);
+ & "use type clause??", Id, T);
end if;
end Use_Clause_Known;
@@ -8434,7 +8451,7 @@ package body Sem_Ch8 is
else
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use type clause?", Id, T);
+ & "use type clause??", Id, T);
end if;
-- The package where T is declared is already used
@@ -8442,7 +8459,7 @@ package body Sem_Ch8 is
elsif In_Use (Scope (T)) then
Error_Msg_Sloc := Sloc (Current_Use_Clause (Scope (T)));
Error_Msg_NE -- CODEFIX
- ("& is already use-visible through package use clause #?",
+ ("& is already use-visible through package use clause #??",
Id, T);
-- The current scope is the package where T is declared
@@ -8450,7 +8467,7 @@ package body Sem_Ch8 is
else
Error_Msg_Node_2 := Scope (T);
Error_Msg_NE -- CODEFIX
- ("& is already use-visible inside package &?", Id, T);
+ ("& is already use-visible inside package &??", Id, T);
end if;
end if;
end Use_One_Type;
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 9b38f0072fb..16c011c5ad8 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -1062,9 +1062,9 @@ package body Sem_Ch9 is
and then Nkind (First (Else_Statements (N))) in N_Delay_Statement
then
Error_Msg_N
- ("suspicious form of conditional entry call?!", N);
+ ("suspicious form of conditional entry call??!", N);
Error_Msg_N
- ("\`SELECT OR` may be intended rather than `SELECT ELSE`!", N);
+ ("\`SELECT OR` may be intended rather than `SELECT ELSE`??!", N);
end if;
-- Postpone the analysis of the statements till expansion. Analyze only
@@ -1987,11 +1987,11 @@ package body Sem_Ch9 is
if Error_Msg_Sloc = No_Location then
Error_Msg_N
("objects of this type will violate " &
- "`No_Local_Protected_Objects`?", N);
+ "`No_Local_Protected_Objects`??", N);
else
Error_Msg_N
("objects of this type will violate " &
- "`No_Local_Protected_Objects`?#", N);
+ "`No_Local_Protected_Objects`#??", N);
end if;
end if;
@@ -2052,15 +2052,15 @@ package body Sem_Ch9 is
or else From_Aspect_Specification (Prio_Item)
then
Error_Msg_Name_1 := Chars (Identifier (Prio_Item));
- Error_Msg_NE ("?aspect% for & has no effect when Lock_Free" &
- " given", Prio_Item, Id);
+ Error_Msg_NE ("aspect% for & has no effect when Lock_Free" &
+ " given??", Prio_Item, Id);
-- Pragma case
else
Error_Msg_Name_1 := Pragma_Name (Prio_Item);
- Error_Msg_NE ("?pragma% for & has no effect when Lock_Free" &
- " given", Prio_Item, Id);
+ Error_Msg_NE ("pragma% for & has no effect when Lock_Free" &
+ " given??", Prio_Item, Id);
end if;
end if;
end;
@@ -2089,16 +2089,16 @@ package body Sem_Ch9 is
or else From_Aspect_Specification (Prio_Item))
and then Chars (Identifier (Prio_Item)) = Name_Priority
then
- Error_Msg_N ("?aspect Interrupt_Priority is preferred "
- & "in presence of handlers", Prio_Item);
+ Error_Msg_N ("aspect Interrupt_Priority is preferred "
+ & "in presence of handlers??", Prio_Item);
-- Pragma case
elsif Nkind (Prio_Item) = N_Pragma
and then Pragma_Name (Prio_Item) = Name_Priority
then
- Error_Msg_N ("?pragma Interrupt_Priority is preferred "
- & "in presence of handlers", Prio_Item);
+ Error_Msg_N ("pragma Interrupt_Priority is preferred "
+ & "in presence of handlers??", Prio_Item);
end if;
end if;
end;
@@ -2516,7 +2516,7 @@ package body Sem_Ch9 is
if Entity (EDN1) = Ent then
Error_Msg_Sloc := Sloc (Stm1);
Error_Msg_N
- ("?accept duplicates one on line#", Stm);
+ ("accept duplicates one on line#??", Stm);
exit;
end if;
end if;
@@ -2799,7 +2799,7 @@ package body Sem_Ch9 is
and then not Entry_Accepted (Ent)
and then Comes_From_Source (Ent)
then
- Error_Msg_NE ("no accept for entry &?", N, Ent);
+ Error_Msg_NE ("no accept for entry &??", N, Ent);
end if;
Next_Entity (Ent);
@@ -2923,10 +2923,10 @@ package body Sem_Ch9 is
if Error_Msg_Sloc = No_Location then
Error_Msg_N
- ("objects of this type will violate `No_Task_Hierarchy`?", N);
+ ("objects of this type will violate `No_Task_Hierarchy`??", N);
else
Error_Msg_N
- ("objects of this type will violate `No_Task_Hierarchy`?#", N);
+ ("objects of this type will violate `No_Task_Hierarchy`#??", N);
end if;
end if;
diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb
index 0e46efae949..be14d47ef5c 100644
--- a/gcc/ada/sem_dim.adb
+++ b/gcc/ada/sem_dim.adb
@@ -2451,7 +2451,7 @@ package body Sem_Dim is
Add_String_To_Name_Buffer (Symbol_Of (Typ));
Error_Msg_Name_1 := Name_Find;
- Error_Msg_N ("?assumed to be%%", N);
+ Error_Msg_N ("??assumed to be%%", N);
end Dim_Warning_For_Numeric_Literal;
----------------------------------------
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 50929365596..2e4186f2652 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -904,10 +904,10 @@ package body Sem_Disp is
and then not Is_Generic_Type (Typ)
and then not In_Instance
then
- Error_Msg_N ("?declaration of& is too late!", Subp);
+ Error_Msg_N ("??declaration of& is too late!", Subp);
Error_Msg_NE -- CODEFIX??
- ("\spec should appear immediately after declaration of &!",
- Subp, Typ);
+ ("\??spec should appear immediately after declaration "
+ & "of & !", Subp, Typ);
exit;
end if;
@@ -933,10 +933,10 @@ package body Sem_Disp is
and then not Is_Generic_Type (Typ)
and then not In_Instance
then
- Error_Msg_N ("?declaration of& is too late!", Subp);
+ Error_Msg_N ("??declaration of& is too late!", Subp);
Error_Msg_NE
- ("\spec should appear immediately after declaration of &!",
- Subp, Typ);
+ ("\??spec should appear immediately after declaration "
+ & "of & !", Subp, Typ);
end if;
end if;
end;
@@ -1153,7 +1153,7 @@ package body Sem_Disp is
and then In_Same_List (Parent (Tagged_Type), Parent (Parent (Subp)))
then
Error_Msg_N
- ("?not dispatching (must be defined in a package spec)", Subp);
+ ("??not dispatching (must be defined in a package spec)", Subp);
return;
-- When the type is frozen, it is legitimate to define a new
@@ -1169,7 +1169,7 @@ package body Sem_Disp is
elsif Is_Frozen (Tagged_Type) and then not Has_Dispatching_Parent then
Error_Msg_N ("this primitive operation is declared too late", Subp);
Error_Msg_NE
- ("?no primitive operations for& after this line",
+ ("??no primitive operations for& after this line",
Freeze_Node (Tagged_Type),
Tagged_Type);
return;
@@ -1220,7 +1220,7 @@ package body Sem_Disp is
else
Error_Msg_NE
- ("operation does not override inherited&?", Subp, Subp);
+ ("operation does not override inherited&??", Subp, Subp);
end if;
else
diff --git a/gcc/ada/sem_dist.adb b/gcc/ada/sem_dist.adb
index 678a6001b1a..f3d3e33ff77 100644
--- a/gcc/ada/sem_dist.adb
+++ b/gcc/ada/sem_dist.adb
@@ -522,8 +522,9 @@ package body Sem_Dist is
Parameter := First (Parameter_Specifications (Type_Def));
while Present (Parameter) loop
if Nkind (Parameter_Type (Parameter)) = N_Access_Definition then
- Error_Msg_N ("formal parameter& has anonymous access type?",
- Defining_Identifier (Parameter));
+ Error_Msg_N
+ ("formal parameter& has anonymous access type??",
+ Defining_Identifier (Parameter));
Is_Degenerate := True;
exit;
end if;
@@ -533,7 +534,7 @@ package body Sem_Dist is
if Is_Degenerate then
Error_Msg_NE
- ("remote access-to-subprogram type& can only be null?",
+ ("remote access-to-subprogram type& can only be null??",
Defining_Identifier (Parameter), User_Type);
-- The only legal value for a RAS with a formal parameter of an
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 6d88c966e1f..125caefbc96 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -908,8 +908,8 @@ package body Sem_Elab is
if Inst_Case then
Elab_Warning
- ("instantiation of& may raise Program_Error?",
- "info: instantiation of& during elaboration?", Ent);
+ ("instantiation of& may raise Program_Error?l?",
+ "info: instantiation of& during elaboration?l?", Ent);
-- Indirect call case, warning only in static elaboration
-- case, because the attribute reference itself cannot raise
@@ -917,7 +917,7 @@ package body Sem_Elab is
elsif Access_Case then
Elab_Warning
- ("", "info: access to& during elaboration?", Ent);
+ ("", "info: access to& during elaboration?l?", Ent);
-- Subprogram call case
@@ -927,14 +927,14 @@ package body Sem_Elab is
and then Comes_From_Source (Ent)
then
Elab_Warning
- ("implicit call to & may raise Program_Error?",
- "info: implicit call to & during elaboration?",
+ ("implicit call to & may raise Program_Error?l?",
+ "info: implicit call to & during elaboration?l?",
Ent);
else
Elab_Warning
- ("call to & may raise Program_Error?",
- "info: call to & during elaboration?",
+ ("call to & may raise Program_Error?l?",
+ "info: call to & during elaboration?l?",
Ent);
end if;
end if;
@@ -943,14 +943,14 @@ package body Sem_Elab is
if Nkind (N) in N_Subprogram_Instantiation then
Elab_Warning
- ("\missing pragma Elaborate for&?",
- "\info: implicit pragma Elaborate for& generated?",
+ ("\missing pragma Elaborate for&?l?",
+ "\info: implicit pragma Elaborate for& generated?l?",
W_Scope);
else
Elab_Warning
- ("\missing pragma Elaborate_All for&?",
- "\info: implicit pragma Elaborate_All for & generated?",
+ ("\missing pragma Elaborate_All for&?l?",
+ "\info: implicit pragma Elaborate_All for & generated?l?",
W_Scope);
end if;
end Generate_Elab_Warnings;
@@ -1030,7 +1030,7 @@ package body Sem_Elab is
Error_Msg_Node_2 := W_Scope;
Error_Msg_NE
("call to& in elaboration code " &
- "requires pragma Elaborate_All on&?", N, E);
+ "requires pragma Elaborate_All on&?l?", N, E);
end if;
-- Set indication for binder to generate Elaborate_All
@@ -1138,13 +1138,13 @@ package body Sem_Elab is
-- Here we definitely have a bad instantiation
- Error_Msg_NE ("?cannot instantiate& before body seen", N, Ent);
+ Error_Msg_NE ("??cannot instantiate& before body seen", N, Ent);
if Present (Instance_Spec (N)) then
Supply_Bodies (Instance_Spec (N));
end if;
- Error_Msg_N ("\?Program_Error will be raised at run time", N);
+ Error_Msg_N ("\??Program_Error will be raised at run time", N);
Insert_Elab_Check (N);
Set_ABE_Is_Certain (N);
end Check_Bad_Instantiation;
@@ -1720,13 +1720,13 @@ package body Sem_Elab is
Error_Msg_Sloc := Sloc (Ent);
Error_Msg_NE
- ("?elaboration code may access& before it is initialized",
+ ("??elaboration code may access& before it is initialized",
N, Ent);
Error_Msg_NE
- ("\?suggest adding pragma Elaborate_Body to spec of &",
+ ("\??suggest adding pragma Elaborate_Body to spec of &",
N, Scop);
Error_Msg_N
- ("\?or an explicit initialization could be added #", N);
+ ("\??or an explicit initialization could be added #", N);
end if;
if not All_Errors_Mode then
@@ -2181,12 +2181,12 @@ package body Sem_Elab is
if Elab_Call.Last = 0 then
if Inst_Case then
Error_Msg_NE
- ("?cannot instantiate& before body seen", N, Orig_Ent);
+ ("??cannot instantiate& before body seen", N, Orig_Ent);
else
- Error_Msg_NE ("?cannot call& before body seen", N, Orig_Ent);
+ Error_Msg_NE ("??cannot call& before body seen", N, Orig_Ent);
end if;
- Error_Msg_N ("\?Program_Error will be raised at run time", N);
+ Error_Msg_N ("\??Program_Error will be raised at run time", N);
Insert_Elab_Check (N);
-- Call is not at outer level
@@ -2255,15 +2255,15 @@ package body Sem_Elab is
then
if Inst_Case then
Error_Msg_NE
- ("instantiation of& may occur before body is seen?",
+ ("instantiation of& may occur before body is seen??",
N, Orig_Ent);
else
Error_Msg_NE
- ("call to& may occur before body is seen?", N, Orig_Ent);
+ ("call to& may occur before body is seen??", N, Orig_Ent);
end if;
Error_Msg_N
- ("\Program_Error may be raised at run time?", N);
+ ("\Program_Error may be raised at run time??", N);
Output_Calls (N);
end if;
@@ -2359,10 +2359,10 @@ package body Sem_Elab is
Scope (Proc) = Scope (Defining_Identifier (Decl)))
then
Error_Msg_N
- ("task will be activated before elaboration of its body?",
+ ("task will be activated before elaboration of its body??",
Decl);
Error_Msg_N
- ("\Program_Error will be raised at run time?", Decl);
+ ("\Program_Error will be raised at run time??", Decl);
elsif
Present (Corresponding_Body (Unit_Declaration_Node (Proc)))
@@ -2506,7 +2506,7 @@ package body Sem_Elab is
Error_Msg_Node_2 := Task_Scope;
Error_Msg_NE
("activation of an instance of task type&" &
- " requires pragma Elaborate_All on &?", N, Ent);
+ " requires pragma Elaborate_All on &?l?", N, Ent);
end if;
Activate_Elaborate_All_Desirable (N, Task_Scope);
@@ -3082,16 +3082,16 @@ package body Sem_Elab is
Ent := Elab_Call.Table (J).Ent;
if Is_Generic_Unit (Ent) then
- Error_Msg_NE ("\?& instantiated #", N, Ent);
+ Error_Msg_NE ("\??& instantiated #", N, Ent);
elsif Is_Init_Proc (Ent) then
- Error_Msg_N ("\?initialization procedure called #", N);
+ Error_Msg_N ("\??initialization procedure called #", N);
elsif Is_Printable_Error_Name (Chars (Ent)) then
- Error_Msg_NE ("\?& called #", N, Ent);
+ Error_Msg_NE ("\??& called #", N, Ent);
else
- Error_Msg_N ("\? called #", N);
+ Error_Msg_N ("\?? called #", N);
end if;
end loop;
end Output_Calls;
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index a4bb76e309b..ab7f3c934ae 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -293,7 +293,7 @@ package body Sem_Eval is
and then Is_Out_Of_Range (N, Base_Type (T), Assume_Valid => True)
then
Error_Msg_N
- ("?float value out of range, infinity will be generated", N);
+ ("??float value out of range, infinity will be generated", N);
end if;
return;
@@ -369,7 +369,7 @@ package body Sem_Eval is
Intval (N) > Expr_Value (Type_High_Bound (Universal_Integer)))
then
Apply_Compile_Time_Constraint_Error
- (N, "non-static universal integer value out of range?",
+ (N, "non-static universal integer value out of range??",
CE_Range_Check_Failed);
-- Check out of range of base type
@@ -390,7 +390,7 @@ package body Sem_Eval is
elsif Is_Out_Of_Range (N, T, Assume_Valid => True) then
Apply_Compile_Time_Constraint_Error
- (N, "value not in range of}?", CE_Range_Check_Failed);
+ (N, "value not in range of}??", CE_Range_Check_Failed);
elsif Checks_On then
Enable_Range_Check (N);
@@ -407,14 +407,12 @@ package body Sem_Eval is
procedure Check_String_Literal_Length (N : Node_Id; Ttype : Entity_Id) is
begin
- if not Raises_Constraint_Error (N)
- and then Is_Constrained (Ttype)
- then
+ if not Raises_Constraint_Error (N) and then Is_Constrained (Ttype) then
if
UI_From_Int (String_Length (Strval (N))) /= String_Type_Len (Ttype)
then
Apply_Compile_Time_Constraint_Error
- (N, "string length wrong for}?",
+ (N, "string length wrong for}??",
CE_Length_Check_Failed,
Ent => Ttype,
Typ => Ttype);
@@ -744,13 +742,18 @@ package body Sem_Eval is
begin
Diff.all := No_Uint;
- -- In preanalysis mode, always return Unknown, it is too early to be
- -- thinking we know the result of a comparison, save that judgment for
- -- the full analysis. This is particularly important in the case of
- -- pre and postconditions, which otherwise can be prematurely collapsed
- -- into having True or False conditions when this is inappropriate.
+ -- In preanalysis mode, always return Unknown unless the expression
+ -- is static. It is too early to be thinking we know the result of a
+ -- comparison, save that judgment for the full analysis. This is
+ -- particularly important in the case of pre and postconditions, which
+ -- otherwise can be prematurely collapsed into having True or False
+ -- conditions when this is inappropriate.
- if not Full_Analysis then
+ if not (Full_Analysis
+ or else (Is_Static_Expression (L)
+ and then
+ Is_Static_Expression (R)))
+ then
return Unknown;
end if;
@@ -1650,7 +1653,7 @@ package body Sem_Eval is
begin
if Result < Lo or else Result > Hi then
Apply_Compile_Time_Constraint_Error
- (N, "value not in range of }?",
+ (N, "value not in range of }??",
CE_Overflow_Check_Failed,
Ent => BT);
return;
@@ -3253,7 +3256,7 @@ package body Sem_Eval is
Left_Int := Expr_Value (Left);
if (Kind = N_And_Then and then Is_False (Left_Int))
- or else
+ or else
(Kind = N_Or_Else and then Is_True (Left_Int))
then
Fold_Uint (N, Left_Int, Rstat);
@@ -3311,10 +3314,10 @@ package body Sem_Eval is
= Entity (Drange)
then
if Warn_On_Redundant_Constructs then
- Error_Msg_N ("redundant slice denotes whole array?", N);
+ Error_Msg_N ("redundant slice denotes whole array?r?", N);
end if;
- -- The following might be a useful optimization????
+ -- The following might be a useful optimization???
-- Rewrite (N, New_Occurrence_Of (E, Sloc (N)));
end if;
@@ -4651,7 +4654,7 @@ package body Sem_Eval is
else
Apply_Compile_Time_Constraint_Error
- (N, "value not in range of}?", CE_Range_Check_Failed);
+ (N, "value not in range of}??", CE_Range_Check_Failed);
end if;
end Out_Of_Range;
diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb
index 93eb4924735..fe3855d33d6 100644
--- a/gcc/ada/sem_intr.adb
+++ b/gcc/ada/sem_intr.adb
@@ -163,7 +163,7 @@ package body Sem_Intr is
and then Can_Never_Be_Null (Etype (Arg1))
then
Error_Msg_N
- ("freeing `NOT NULL` object will raise Constraint_Error?", N);
+ ("freeing `NOT NULL` object will raise Constraint_Error??", N);
-- For unchecked deallocation, error to deallocate from empty pool.
-- Note: this test used to be in Exp_Intr as a warning, but AI 157
diff --git a/gcc/ada/sem_mech.adb b/gcc/ada/sem_mech.adb
index 6bd498ef9fc..e2fce979a22 100644
--- a/gcc/ada/sem_mech.adb
+++ b/gcc/ada/sem_mech.adb
@@ -245,7 +245,7 @@ package body Sem_Mech is
if Mech in Descriptor_Codes and then not Is_Formal (Ent) then
if Is_Record_Type (Etype (Ent)) then
- Error_Msg_N ("?records cannot be returned by Descriptor", Enod);
+ Error_Msg_N ("??records cannot be returned by Descriptor", Enod);
return;
end if;
end if;
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index b44df5ad150..0610128fd7b 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -980,7 +980,7 @@ package body Sem_Prag is
procedure Check_Ada_83_Warning is
begin
if Ada_Version = Ada_83 and then Comes_From_Source (N) then
- Error_Msg_N ("(Ada 83) pragma& is non-standard?", N);
+ Error_Msg_N ("(Ada 83) pragma& is non-standard??", N);
end if;
end Check_Ada_83_Warning;
@@ -1853,7 +1853,7 @@ package body Sem_Prag is
then
Error_Msg_Name_1 := Pname;
Error_Msg_N
- ("?pragma% is only effective in main program", N);
+ ("??pragma% is only effective in main program", N);
end if;
end Check_In_Main_Program;
@@ -2233,7 +2233,7 @@ package body Sem_Prag is
(Get_Pragma_Arg (Arg2), Standard_String);
end if;
- -- For a pragma in the extended main source unit, record enabled
+ -- For a pragma PPC in the extended main source unit, record enabled
-- status in SCO.
-- This may seem redundant with the call to Check_Enabled occurring
@@ -3551,7 +3551,7 @@ package body Sem_Prag is
else
if Warn_On_Export_Import and not OpenVMS_On_Target then
Error_Msg_N
- ("?unrecognized convention name, C assumed",
+ ("??unrecognized convention name, C assumed",
Get_Pragma_Arg (Arg1));
end if;
@@ -3860,7 +3860,7 @@ package body Sem_Prag is
begin
if not OpenVMS_On_Target then
Error_Pragma
- ("?pragma% ignored (applies only to Open'V'M'S)");
+ ("??pragma% ignored (applies only to Open'V'M'S)");
end if;
Process_Extended_Import_Export_Internal_Arg (Arg_Internal);
@@ -3996,7 +3996,7 @@ package body Sem_Prag is
end if;
if Warn_On_Export_Import and then Is_Exported (Def_Id) then
- Error_Msg_N ("?duplicate Export_Object pragma", N);
+ Error_Msg_N ("??duplicate Export_Object pragma", N);
else
Set_Exported (Def_Id, Arg_Internal);
end if;
@@ -4019,21 +4019,20 @@ package body Sem_Prag is
and then Has_Discriminants (Etype (Def_Id))
then
Error_Msg_N
- ("imported value must be initialized?", Arg_Internal);
+ ("imported value must be initialized??", Arg_Internal);
end if;
if Warn_On_Export_Import
and then Is_Access_Type (Etype (Def_Id))
then
Error_Pragma_Arg
- ("cannot import object of an access type?", Arg_Internal);
+ ("cannot import object of an access type??", Arg_Internal);
end if;
if Warn_On_Export_Import
and then Is_Imported (Def_Id)
then
- Error_Msg_N
- ("?duplicate Import_Object pragma", N);
+ Error_Msg_N ("??duplicate Import_Object pragma", N);
-- Check for explicit initialization present. Note that an
-- initialization generated by the code generator, e.g. for an
@@ -4957,7 +4956,7 @@ package body Sem_Prag is
if Front_End_Inlining
and then Analyzed (Corresponding_Body (Decl))
then
- Error_Msg_N ("pragma appears too late, ignored?", N);
+ Error_Msg_N ("pragma appears too late, ignored??", N);
return True;
-- If the subprogram is a renaming as body, the body is just a
@@ -5209,10 +5208,12 @@ package body Sem_Prag is
then
if Inlining_Not_Possible (Subp) then
Error_Msg_NE
- ("pragma Inline for& is ignored?", N, Entity (Subp_Id));
+ ("pragma Inline for& is ignored?r?",
+ N, Entity (Subp_Id));
else
Error_Msg_NE
- ("pragma Inline for& is redundant?", N, Entity (Subp_Id));
+ ("pragma Inline for& is redundant?r?",
+ N, Entity (Subp_Id));
end if;
end if;
@@ -5284,7 +5285,7 @@ package body Sem_Prag is
Get_Character (C) = '/'))
then
Error_Msg
- ("?interface name contains illegal character",
+ ("??interface name contains illegal character",
Sloc (SN) + Source_Ptr (J));
end if;
end loop;
@@ -5704,7 +5705,7 @@ package body Sem_Prag is
if not UI_Is_In_Int_Range (Val) then
Error_Pragma_Arg
- ("pragma ignored, value too large?", Arg);
+ ("pragma ignored, value too large??", Arg);
end if;
-- Warning case. If the real restriction is active, then we
@@ -5981,20 +5982,23 @@ package body Sem_Prag is
and then Comes_From_Source (Arg)
then
Error_Msg_NE
- ("?& has been made static as a result of Export", Arg, E);
+ ("?x?& has been made static as a result of Export",
+ Arg, E);
Error_Msg_N
- ("\this usage is non-standard and non-portable", Arg);
+ ("\?x?this usage is non-standard and non-portable",
+ Arg);
end if;
end if;
end if;
if Warn_On_Export_Import and then Is_Type (E) then
- Error_Msg_NE ("exporting a type has no effect?", Arg, E);
+ Error_Msg_NE ("exporting a type has no effect?x?", Arg, E);
end if;
if Warn_On_Export_Import and Inside_A_Generic then
Error_Msg_NE
- ("all instances of& will have the same external name?", Arg, E);
+ ("all instances of& will have the same external name?x?",
+ Arg, E);
end if;
end Set_Exported;
@@ -6562,13 +6566,13 @@ package body Sem_Prag is
if not Is_Pragma_Name (Pname) then
if Warn_On_Unrecognized_Pragma then
Error_Msg_Name_1 := Pname;
- Error_Msg_N ("?unrecognized pragma%!", Pragma_Identifier (N));
+ Error_Msg_N ("?g?unrecognized pragma%!", Pragma_Identifier (N));
for PN in First_Pragma_Name .. Last_Pragma_Name loop
if Is_Bad_Spelling_Of (Pname, PN) then
Error_Msg_Name_1 := PN;
Error_Msg_N -- CODEFIX
- ("\?possible misspelling of %!", Pragma_Identifier (N));
+ ("\?g?possible misspelling of %!", Pragma_Identifier (N));
exit;
end if;
end loop;
@@ -7013,16 +7017,27 @@ package body Sem_Prag is
-- pragma Assume (boolean_EXPRESSION);
- -- This should share pragma Assert code ???
- -- Run-time check is missing completely ???
-
when Pragma_Assume => Assume : declare
begin
GNAT_Pragma;
S14_Pragma;
Check_Arg_Count (1);
- Analyze_And_Resolve (Expression (Arg1), Any_Boolean);
+ -- Pragma Assume is transformed into pragma Check in the following
+ -- manner:
+
+ -- pragma Check (Assume, Expr);
+
+ Rewrite (N,
+ Make_Pragma (Loc,
+ Chars => Name_Check,
+ Pragma_Argument_Associations => New_List (
+ Make_Pragma_Argument_Association (Loc,
+ Expression => Make_Identifier (Loc, Name_Assume)),
+
+ Make_Pragma_Argument_Association (Loc,
+ Expression => Relocate_Node (Expression (Arg1))))));
+ Analyze (N);
end Assume;
------------------------------
@@ -7449,8 +7464,9 @@ package body Sem_Prag is
-- [,[Message =>] String_EXPRESSION]);
when Pragma_Check => Check : declare
- Expr : Node_Id;
- Eloc : Source_Ptr;
+ Expr : Node_Id;
+ Eloc : Source_Ptr;
+ Cname : Name_Id;
Check_On : Boolean;
-- Set True if category of assertions referenced by Name enabled
@@ -7477,14 +7493,28 @@ package body Sem_Prag is
return;
end if;
- -- Indicate if pragma is enabled. The Original_Node reference here
- -- is to deal with pragma Assert rewritten as a Check pragma.
+ Cname := Chars (Get_Pragma_Arg (Arg1));
+ Check_On := Check_Enabled (Cname);
- Check_On := Check_Enabled (Chars (Get_Pragma_Arg (Arg1)));
+ case Cname is
+ when Name_Predicate |
+ Name_Invariant =>
- if Check_On and then not Split_PPC (N) then
- Set_SCO_Pragma_Enabled (Loc);
- end if;
+ -- Nothing to do: since checks occur in client units,
+ -- the SCO for the aspect in the declaration unit is
+ -- conservatively always enabled.
+
+ null;
+
+ when others =>
+
+ if Check_On and then not Split_PPC (N) then
+
+ -- Mark pragma/aspect SCO as enabled
+
+ Set_SCO_Pragma_Enabled (Loc);
+ end if;
+ end case;
-- If expansion is active and the check is not enabled then we
-- rewrite the Check as:
@@ -7530,6 +7560,18 @@ package body Sem_Prag is
end if;
end Check;
+ --------------------------
+ -- Check_Float_Overflow --
+ --------------------------
+
+ -- pragma Check_Float_Overflow;
+
+ when Pragma_Check_Float_Overflow =>
+ GNAT_Pragma;
+ Check_Valid_Configuration_Pragma;
+ Check_Arg_Count (0);
+ Check_Float_Overflow := True;
+
----------------
-- Check_Name --
----------------
@@ -8093,7 +8135,7 @@ package body Sem_Prag is
-- Following message is obsolete ???
Error_Msg_N
("'G'N'A'T pragma cpp'_class is now obsolete and has no " &
- "effect; replace it by pragma import?", N);
+ "effect; replace it by pragma import?j?", N);
end if;
Check_Arg_Count (1);
@@ -8145,7 +8187,7 @@ package body Sem_Prag is
if Is_Constructor (Def_Id) then
Error_Msg_N
- ("?duplicate argument for pragma 'C'P'P_Constructor", Arg1);
+ ("??duplicate argument for pragma 'C'P'P_Constructor", Arg1);
return;
end if;
@@ -8219,7 +8261,7 @@ package body Sem_Prag is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("'G'N'A'T pragma cpp'_virtual is now obsolete and has " &
- "no effect?", N);
+ "no effect?j?", N);
end if;
end CPP_Virtual;
@@ -8234,7 +8276,7 @@ package body Sem_Prag is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("'G'N'A'T pragma cpp'_vtable is now obsolete and has " &
- "no effect?", N);
+ "no effect?j?", N);
end if;
end CPP_Vtable;
@@ -8719,9 +8761,9 @@ package body Sem_Prag is
if Elab_Warnings and not Dynamic_Elaboration_Checks then
Error_Msg_N
- ("?use of pragma Elaborate may not be safe", N);
+ ("?l?use of pragma Elaborate may not be safe", N);
Error_Msg_N
- ("?use pragma Elaborate_All instead if possible", N);
+ ("?l?use pragma Elaborate_All instead if possible", N);
end if;
end Elaborate;
@@ -9560,7 +9602,7 @@ package body Sem_Prag is
if not OpenVMS_On_Target then
if Chars (Get_Pragma_Arg (Arg1)) = Name_VAX_Float then
Error_Pragma
- ("?pragma% ignored (applies only to Open'V'M'S)");
+ ("??pragma% ignored (applies only to Open'V'M'S)");
end if;
return;
@@ -10288,15 +10330,19 @@ package body Sem_Prag is
D := Declaration_Node (E);
K := Nkind (D);
- if (K = N_Full_Type_Declaration
- and then (Is_Array_Type (E) or else Is_Record_Type (E)))
- or else
- ((Ekind (E) = E_Constant or else Ekind (E) = E_Variable)
- and then Nkind (D) = N_Object_Declaration
- and then Nkind (Object_Definition (D)) =
- N_Constrained_Array_Definition)
+ if K = N_Full_Type_Declaration
+ and then (Is_Array_Type (E) or else Is_Record_Type (E))
+ then
+ Independence_Checks.Append ((N, E));
+ Set_Has_Independent_Components (Base_Type (E));
+
+ elsif (Ekind (E) = E_Constant or else Ekind (E) = E_Variable)
+ and then Nkind (D) = N_Object_Declaration
+ and then Nkind (Object_Definition (D)) =
+ N_Constrained_Array_Definition
then
Independence_Checks.Append ((N, E));
+ Set_Has_Independent_Components (E);
else
Error_Pragma_Arg ("inappropriate entity for pragma%", Arg1);
@@ -11538,7 +11584,7 @@ package body Sem_Prag is
Check_Arg_Is_One_Of (Arg1, Name_D_Float, Name_G_Float);
if not OpenVMS_On_Target then
- Error_Pragma ("?pragma% ignored (applies only to Open'V'M'S)");
+ Error_Pragma ("??pragma% ignored (applies only to Open'V'M'S)");
end if;
-- D_Float case
@@ -12442,7 +12488,7 @@ package body Sem_Prag is
elsif VM_Target /= No_VM then
if not GNAT_Mode then
Error_Pragma
- ("?pragma% ignored in this configuration");
+ ("??pragma% ignored in this configuration");
end if;
-- Normal case where we do the pack action
@@ -12468,7 +12514,7 @@ package body Sem_Prag is
if VM_Target /= No_VM then
if not GNAT_Mode then
Error_Pragma
- ("?pragma% ignored in this configuration");
+ ("??pragma% ignored in this configuration");
end if;
-- Normal case of pack request active
@@ -12613,7 +12659,7 @@ package body Sem_Prag is
if Has_Pragma_Preelab_Init (Ent)
and then Warn_On_Redundant_Constructs
then
- Error_Pragma ("?duplicate pragma%!");
+ Error_Pragma ("?r?duplicate pragma%!");
else
Set_Has_Pragma_Preelab_Init (Ent);
end if;
@@ -12706,7 +12752,6 @@ package body Sem_Prag is
when Pragma_Postcondition => Postcondition : declare
In_Body : Boolean;
- pragma Warnings (Off, In_Body);
begin
GNAT_Pragma;
@@ -12714,10 +12759,22 @@ package body Sem_Prag is
Check_At_Most_N_Arguments (2);
Check_Optional_Identifier (Arg1, Name_Check);
- -- All we need to do here is call the common check procedure,
- -- the remainder of the processing is found in Sem_Ch6/Sem_Ch7.
+ -- Verify the proper placement of the pragma. The remainder of the
+ -- processing is found in Sem_Ch6/Sem_Ch7.
Check_Precondition_Postcondition (In_Body);
+
+ -- When the pragma is a source contruct and appears inside a body,
+ -- preanalyze the boolean_expression to detect illegal forward
+ -- references:
+
+ -- procedure P is
+ -- pragma Postcondition (X'Old ...);
+ -- X : ...
+
+ if Comes_From_Source (N) and then In_Body then
+ Preanalyze_Spec_Expression (Expression (Arg1), Any_Boolean);
+ end if;
end Postcondition;
------------------
@@ -13288,7 +13345,7 @@ package body Sem_Prag is
or else
Has_Rep_Pragma (Def_Id, Name_Psect_Object)
then
- Error_Msg_N ("?duplicate Common/Psect_Object pragma", N);
+ Error_Msg_N ("??duplicate Common/Psect_Object pragma", N);
end if;
if Ekind (Def_Id) = E_Constant then
@@ -13312,7 +13369,7 @@ package body Sem_Prag is
and then Warn_On_Export_Import
then
Error_Msg_N
- ("?object for pragma % has defaults", Internal);
+ ("?x?object for pragma % has defaults", Internal);
exit;
else
@@ -13496,7 +13553,7 @@ package body Sem_Prag is
and then Warn_On_Redundant_Constructs
then
Error_Msg_NE
- ("pragma Pure_Function on& is redundant?",
+ ("pragma Pure_Function on& is redundant?r?",
N, Entity (E_Id));
end if;
end if;
@@ -13702,8 +13759,10 @@ package body Sem_Prag is
Set_Ravenscar_Profile (N);
if Warn_On_Obsolescent_Feature then
- Error_Msg_N ("pragma Ravenscar is an obsolescent feature?", N);
- Error_Msg_N ("|use pragma Profile (Ravenscar) instead", N);
+ Error_Msg_N
+ ("pragma Ravenscar is an obsolescent feature?j?", N);
+ Error_Msg_N
+ ("|use pragma Profile (Ravenscar) instead?j?", N);
end if;
-------------------------
@@ -13721,8 +13780,10 @@ package body Sem_Prag is
if Warn_On_Obsolescent_Feature then
Error_Msg_N
- ("pragma Restricted_Run_Time is an obsolescent feature?", N);
- Error_Msg_N ("|use pragma Profile (Restricted) instead", N);
+ ("pragma Restricted_Run_Time is an obsolescent feature?j?",
+ N);
+ Error_Msg_N
+ ("|use pragma Profile (Restricted) instead?j?", N);
end if;
------------------
@@ -14913,7 +14974,7 @@ package body Sem_Prag is
end if;
if not AAMP_On_Target then
- Error_Pragma ("?pragma% ignored (applies only to AAMP)");
+ Error_Pragma ("??pragma% ignored (applies only to AAMP)");
end if;
----------------
@@ -15406,7 +15467,7 @@ package body Sem_Prag is
if Err then
Error_Msg
- ("?pragma Warnings On with no " &
+ ("??pragma Warnings On with no " &
"matching Warnings Off",
Loc);
end if;
@@ -15706,6 +15767,7 @@ package body Sem_Prag is
Pragma_Atomic_Components => 0,
Pragma_Attach_Handler => -1,
Pragma_Check => 99,
+ Pragma_Check_Float_Overflow => 0,
Pragma_Check_Name => 0,
Pragma_Check_Policy => 0,
Pragma_CIL_Constructor => -1,
diff --git a/gcc/ada/sem_prag.ads b/gcc/ada/sem_prag.ads
index 99711546cb5..9df7d5ab711 100644
--- a/gcc/ada/sem_prag.ads
+++ b/gcc/ada/sem_prag.ads
@@ -58,7 +58,8 @@ package Sem_Prag is
-- This function is used in connection with pragmas Assertion, Check,
-- Precondition, and Postcondition, to determine if Check pragmas (or
-- corresponding Assert, Precondition, or Postcondition pragmas) are
- -- currently disabled (as set by a Policy pragma with the Disabled
+ -- currently disabled (as set by a Check_Policy or Assertion_Policy pragma
+ -- with the Disable argument).
function Check_Enabled (Nam : Name_Id) return Boolean;
-- This function is used in connection with pragmas Assertion, Check,
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 445458ca687..5559f178419 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -577,7 +577,7 @@ package body Sem_Res is
-- Warn about the danger
Error_Msg_N
- ("?creation of & object may raise Storage_Error!",
+ ("??creation of & object may raise Storage_Error!",
Scope (Disc));
<<No_Danger>>
@@ -769,8 +769,8 @@ package body Sem_Res is
and then Nkind (Parent (P)) = N_Subprogram_Body
and then Is_Empty_List (Declarations (Parent (P)))
then
- Error_Msg_N ("!?infinite recursion", N);
- Error_Msg_N ("\!?Storage_Error will be raised at run time", N);
+ Error_Msg_N ("!??infinite recursion", N);
+ Error_Msg_N ("\!??Storage_Error will be raised at run time", N);
Insert_Action (N,
Make_Raise_Storage_Error (Sloc (N),
Reason => SE_Infinite_Recursion));
@@ -867,8 +867,8 @@ package body Sem_Res is
end if;
end loop;
- Error_Msg_N ("!?possible infinite recursion", N);
- Error_Msg_N ("\!?Storage_Error may be raised at run time", N);
+ Error_Msg_N ("!??possible infinite recursion", N);
+ Error_Msg_N ("\!??Storage_Error may be raised at run time", N);
return True;
end Check_Infinite_Recursion;
@@ -3095,7 +3095,7 @@ package body Sem_Res is
if Wrong_Order then
Error_Msg_N
- ("actuals for this call may be in wrong order?", N);
+ ("?P?actuals for this call may be in wrong order", N);
end if;
end;
end;
@@ -3963,14 +3963,14 @@ package body Sem_Res is
if Is_Controlling_Formal (F) then
Apply_Compile_Time_Constraint_Error
(N => A,
- Msg => "null value not allowed here?",
+ Msg => "null value not allowed here??",
Reason => CE_Access_Check_Failed);
elsif Ada_Version >= Ada_2005 then
Apply_Compile_Time_Constraint_Error
(N => A,
Msg => "(Ada 2005) null not allowed in "
- & "null-excluding formal?",
+ & "null-excluding formal??",
Reason => CE_Null_Not_Allowed);
end if;
end if;
@@ -4448,9 +4448,9 @@ package body Sem_Res is
Deepest_Type_Access_Level (Typ)
then
if In_Instance_Body then
- Error_Msg_N ("?type in allocator has deeper level than" &
+ Error_Msg_N ("??type in allocator has deeper level than" &
" designated class-wide type", E);
- Error_Msg_N ("\?Program_Error will be raised at run time",
+ Error_Msg_N ("\??Program_Error will be raised at run time",
E);
Rewrite (N,
Make_Raise_Program_Error (Sloc (N),
@@ -4556,8 +4556,8 @@ package body Sem_Res is
and then Ekind (Current_Scope) = E_Package
and then not In_Package_Body (Current_Scope)
then
- Error_Msg_N ("?cannot activate task before body seen", N);
- Error_Msg_N ("\?Program_Error will be raised at run time", N);
+ Error_Msg_N ("??cannot activate task before body seen", N);
+ Error_Msg_N ("\??Program_Error will be raised at run time", N);
end if;
-- Ada 2012 (AI05-0111-3): Detect an attempt to allocate a task or a
@@ -4569,8 +4569,8 @@ package body Sem_Res is
and then Present (Subpool_Handle_Name (N))
and then Has_Task (Desig_T)
then
- Error_Msg_N ("?cannot allocate task on subpool", N);
- Error_Msg_N ("\?Program_Error will be raised at run time", N);
+ Error_Msg_N ("??cannot allocate task on subpool", N);
+ Error_Msg_N ("\??Program_Error will be raised at run time", N);
Rewrite (N,
Make_Raise_Program_Error (Sloc (N),
@@ -5026,24 +5026,24 @@ package body Sem_Res is
then
Error_Msg_N
("float division by zero, " &
- "may generate '+'/'- infinity?", Right_Opnd (N));
+ "may generate '+'/'- infinity??", Right_Opnd (N));
-- For all other cases, we get a Constraint_Error
else
Apply_Compile_Time_Constraint_Error
- (N, "division by zero?", CE_Divide_By_Zero,
+ (N, "division by zero??", CE_Divide_By_Zero,
Loc => Sloc (Right_Opnd (N)));
end if;
when N_Op_Rem =>
Apply_Compile_Time_Constraint_Error
- (N, "rem with zero divisor?", CE_Divide_By_Zero,
+ (N, "rem with zero divisor??", CE_Divide_By_Zero,
Loc => Sloc (Right_Opnd (N)));
when N_Op_Mod =>
Apply_Compile_Time_Constraint_Error
- (N, "mod with zero divisor?", CE_Divide_By_Zero,
+ (N, "mod with zero divisor??", CE_Divide_By_Zero,
Loc => Sloc (Right_Opnd (N)));
-- Division by zero can only happen with division, rem,
@@ -5285,10 +5285,10 @@ package body Sem_Res is
then
Rtype := Etype (N);
Error_Msg_NE
- ("?& should not be used in entry body (RM C.7(17))",
+ ("??& should not be used in entry body (RM C.7(17))",
N, Nam);
Error_Msg_NE
- ("\Program_Error will be raised at run time?", N, Nam);
+ ("\Program_Error will be raised at run time??", N, Nam);
Rewrite (N,
Make_Raise_Program_Error (Loc,
Reason => PE_Current_Task_In_Entry_Body));
@@ -5578,9 +5578,9 @@ package body Sem_Res is
Set_Has_Recursive_Call (Nam);
Error_Msg_N
- ("?possible infinite recursion!", N);
+ ("??possible infinite recursion!", N);
Error_Msg_N
- ("\?Storage_Error may be raised at run time!", N);
+ ("\??Storage_Error may be raised at run time!", N);
end if;
exit Scope_Loop;
@@ -5898,8 +5898,8 @@ package body Sem_Res is
end loop;
if not Call_OK then
- Error_Msg_N ("!? cannot determine tag of result", N);
- Error_Msg_N ("!? Program_Error will be raised", N);
+ Error_Msg_N ("!?? cannot determine tag of result", N);
+ Error_Msg_N ("!?? Program_Error will be raised", N);
Insert_Action (N,
Make_Raise_Program_Error (Sloc (N),
Reason => PE_Explicit_Raise));
@@ -6100,7 +6100,7 @@ package body Sem_Res is
-- Check comparison on unordered enumeration
if Bad_Unordered_Enumeration_Reference (N, Etype (L)) then
- Error_Msg_N ("comparison on unordered enumeration type?", N);
+ Error_Msg_N ("comparison on unordered enumeration type?U?", N);
end if;
-- Evaluate the relation (note we do this after the above check since
@@ -6939,7 +6939,7 @@ package body Sem_Res is
and then Comes_From_Source (R)
then
Error_Msg_N -- CODEFIX
- ("?comparison with True is redundant!", R);
+ ("?r?comparison with True is redundant!", R);
end if;
Check_Unset_Reference (L);
@@ -7322,9 +7322,9 @@ package body Sem_Res is
and then Is_Bit_Packed_Array (Array_Type)
and then Is_LHS (N)
then
- Error_Msg_N ("?assignment to component of packed atomic array",
+ Error_Msg_N ("??assignment to component of packed atomic array",
Prefix (N));
- Error_Msg_N ("?\may cause unexpected accesses to atomic object",
+ Error_Msg_N ("??\may cause unexpected accesses to atomic object",
Prefix (N));
end if;
end Resolve_Indexed_Component;
@@ -7700,7 +7700,7 @@ package body Sem_Res is
while Present (Alt) loop
if Is_Static_Expression (Alt)
and then (Nkind_In (Alt, N_Integer_Literal,
- N_Character_Literal)
+ N_Character_Literal)
or else Nkind (Alt) in N_Has_Entity)
then
Nalts := Nalts + 1;
@@ -7709,7 +7709,7 @@ package body Sem_Res is
for J in 1 .. Nalts - 1 loop
if Alts (J).Val = Alts (Nalts).Val then
Error_Msg_Sloc := Sloc (Alts (J).Alt);
- Error_Msg_N ("duplicate of value given#?", Alt);
+ Error_Msg_N ("duplicate of value given#??", Alt);
end if;
end loop;
end if;
@@ -7838,7 +7838,7 @@ package body Sem_Res is
if not Inside_Init_Proc then
Insert_Action
(Compile_Time_Constraint_Error (N,
- "(Ada 2005) null not allowed in null-excluding objects?"),
+ "(Ada 2005) null not allowed in null-excluding objects??"),
Make_Raise_Constraint_Error (Loc,
Reason => CE_Access_Check_Failed));
else
@@ -8308,7 +8308,7 @@ package body Sem_Res is
and then not Is_Boolean_Type (Typ)
and then Parent_Is_Boolean
then
- Error_Msg_N ("?not expression should be parenthesized here!", N);
+ Error_Msg_N ("?q?not expression should be parenthesized here!", N);
end if;
-- Warn on double negation if checking redundant constructs
@@ -8319,7 +8319,7 @@ package body Sem_Res is
and then Root_Type (Typ) = Standard_Boolean
and then Nkind (Right_Opnd (N)) = N_Op_Not
then
- Error_Msg_N ("redundant double negation?", N);
+ Error_Msg_N ("redundant double negation?r?", N);
end if;
-- Complete resolution and evaluation of NOT
@@ -8459,7 +8459,7 @@ package body Sem_Res is
and then not First_Last_Ref
then
- Error_Msg ("subrange of unordered enumeration type?", Sloc (N));
+ Error_Msg ("subrange of unordered enumeration type?U?", Sloc (N));
end if;
Check_Unset_Reference (L);
@@ -8546,7 +8546,7 @@ package body Sem_Res is
and then Warn_On_Bad_Fixed_Value
then
Error_Msg_N
- ("?static fixed-point value is not a multiple of Small!",
+ ("?b?static fixed-point value is not a multiple of Small!",
N);
end if;
@@ -8796,9 +8796,9 @@ package body Sem_Res is
and then Is_LHS (N)
then
Error_Msg_N
- ("?assignment to component of packed atomic record", Prefix (N));
+ ("??assignment to component of packed atomic record", Prefix (N));
Error_Msg_N
- ("?\may cause unexpected accesses to atomic object", Prefix (N));
+ ("\??may cause unexpected accesses to atomic object", Prefix (N));
end if;
Analyze_Dimension (N);
@@ -8891,7 +8891,7 @@ package body Sem_Res is
-- of the First_Node call here.
Error_Msg_F
- ("?assertion would fail at run time!",
+ ("?A?assertion would fail at run time!",
Expression
(First (Pragma_Argument_Associations (Orig))));
end if;
@@ -8906,10 +8906,9 @@ package body Sem_Res is
declare
Expr : constant Node_Id :=
- Original_Node
- (Expression
- (Next (First
- (Pragma_Argument_Associations (Orig)))));
+ Original_Node
+ (Expression
+ (Next (First (Pragma_Argument_Associations (Orig)))));
begin
if Is_Entity_Name (Expr)
and then Entity (Expr) = Standard_False
@@ -8923,7 +8922,7 @@ package body Sem_Res is
-- comment above for an explanation of why we do this.
Error_Msg_F
- ("?check would fail at run time!",
+ ("?A?check would fail at run time!",
Expression
(Last (Pragma_Argument_Associations (Orig))));
end if;
@@ -9329,7 +9328,8 @@ package body Sem_Res is
or else Char_Val > Expr_Value (Comp_Typ_Hi)
then
Apply_Compile_Time_Constraint_Error
- (N, "character out of range?", CE_Range_Check_Failed,
+ (N, "character out of range??",
+ CE_Range_Check_Failed,
Loc => Source_Ptr (Int (Loc) + J));
end if;
end loop;
@@ -9474,11 +9474,10 @@ package body Sem_Res is
and then abs (Realval (Rop)) < Delta_Value (Standard_Duration)
then
Error_Msg_N
- ("?universal real operand can only " &
- "be interpreted as Duration!",
- Rop);
+ ("??universal real operand can only " &
+ "be interpreted as Duration!", Rop);
Error_Msg_N
- ("\?precision will be lost in the conversion!", Rop);
+ ("\??precision will be lost in the conversion!", Rop);
end if;
elsif Is_Numeric_Type (Typ)
@@ -9654,15 +9653,17 @@ package body Sem_Res is
-- entity, give the name of the entity in the message. If not,
-- just mention the expression.
+ -- Shoudn't we test Warn_On_Redundant_Constructs here ???
+
else
if Is_Entity_Name (Orig_N) then
Error_Msg_Node_2 := Orig_T;
Error_Msg_NE -- CODEFIX
- ("?redundant conversion, & is of type &!",
+ ("??redundant conversion, & is of type &!",
N, Entity (Orig_N));
else
Error_Msg_NE
- ("?redundant conversion, expression is of type&!",
+ ("??redundant conversion, expression is of type&!",
N, Orig_T);
end if;
end if;
@@ -9830,7 +9831,7 @@ package body Sem_Res is
if OK and then Hi >= Lo and then Lo >= 0 then
Error_Msg_N -- CODEFIX
- ("?abs applied to known non-negative value has no effect", N);
+ ("?r?abs applied to known non-negative value has no effect", N);
end if;
end if;
@@ -9968,8 +9969,10 @@ package body Sem_Res is
-- If we fall through warning should be issued
+ -- Shouldn't we test Warn_On_Questionable_Missing_Parens ???
+
Error_Msg_N
- ("?unary minus expression should be parenthesized here!", N);
+ ("??unary minus expression should be parenthesized here!", N);
end if;
end if;
end;
@@ -10443,9 +10446,11 @@ package body Sem_Res is
end loop;
if Nkind (N) = N_Real_Literal then
- Error_Msg_NE ("?real literal interpreted as }!", N, T1);
+ Error_Msg_NE
+ ("??real literal interpreted as }!", N, T1);
else
- Error_Msg_NE ("?universal_fixed expression interpreted as }!", N, T1);
+ Error_Msg_NE
+ ("??universal_fixed expression interpreted as }!", N, T1);
end if;
return T1;
@@ -10628,10 +10633,10 @@ package body Sem_Res is
then
if In_Instance_Body then
Error_Msg_N
- ("?source array type has " &
+ ("??source array type has " &
"deeper accessibility level than target", Operand);
Error_Msg_N
- ("\?Program_Error will be raised at run time",
+ ("\??Program_Error will be raised at run time",
Operand);
Rewrite (N,
Make_Raise_Program_Error (Sloc (N),
@@ -10915,10 +10920,10 @@ package body Sem_Res is
if In_Instance_Body then
Error_Msg_N
- ("?cannot convert local pointer to non-local access type",
+ ("??cannot convert local pointer to non-local access type",
Operand);
Error_Msg_N
- ("\?Program_Error will be raised at run time", Operand);
+ ("\??Program_Error will be raised at run time", Operand);
else
Error_Msg_N
@@ -10948,10 +10953,11 @@ package body Sem_Res is
if In_Instance_Body then
Error_Msg_N
- ("?cannot convert access discriminant to non-local" &
+ ("??cannot convert access discriminant to non-local" &
" access type", Operand);
Error_Msg_N
- ("\?Program_Error will be raised at run time", Operand);
+ ("\??Program_Error will be raised at run time",
+ Operand);
else
Error_Msg_N
("cannot convert access discriminant to non-local" &
@@ -11092,10 +11098,10 @@ package body Sem_Res is
if In_Instance_Body then
Error_Msg_N
- ("?cannot convert local pointer to non-local access type",
+ ("??cannot convert local pointer to non-local access type",
Operand);
Error_Msg_N
- ("\?Program_Error will be raised at run time", Operand);
+ ("\??Program_Error will be raised at run time", Operand);
else
-- Avoid generation of spurious error message
@@ -11130,10 +11136,10 @@ package body Sem_Res is
if In_Instance_Body then
Error_Msg_N
- ("?cannot convert access discriminant to non-local" &
- " access type", Operand);
+ ("??cannot convert access discriminant to non-local"
+ & " access type", Operand);
Error_Msg_N
- ("\?Program_Error will be raised at run time",
+ ("\??Program_Error will be raised at run time",
Operand);
else
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 7d3215e59c3..648362c658f 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -444,8 +444,8 @@ package body Sem_Util is
begin
if Has_Predicates (Typ) then
if Is_Generic_Actual_Type (Typ) then
- Error_Msg_FE (Msg & '?', N, Typ);
- Error_Msg_F ("\Program_Error will be raised at run time?", N);
+ Error_Msg_FE (Msg & "??", N, Typ);
+ Error_Msg_F ("\Program_Error will be raised at run time??", N);
Insert_Action (N,
Make_Raise_Program_Error (Sloc (N),
Reason => PE_Bad_Predicated_Generic_Type));
@@ -1576,7 +1576,7 @@ package body Sem_Util is
then
Error_Msg_N
("result may differ if evaluated "
- & "after other actual in expression?", Act1);
+ & "after other actual in expression??", Act1);
end if;
end if;
end loop;
@@ -1610,7 +1610,7 @@ package body Sem_Util is
while Present (S) and then S /= Standard_Standard loop
if Is_Protected_Type (S) then
Error_Msg_N
- ("potentially blocking operation in protected operation?", N);
+ ("potentially blocking operation in protected operation??", N);
return;
end if;
@@ -1724,7 +1724,7 @@ package body Sem_Util is
Object_Access_Level (Context)
then
Error_Msg_N
- ("?possible unprotected access to protected data", Expr);
+ ("??possible unprotected access to protected data", Expr);
end if;
end if;
end Check_Unprotected_Access;
@@ -2249,8 +2249,8 @@ package body Sem_Util is
Loc : Source_Ptr := No_Location;
Warn : Boolean := False) return Node_Id
is
- Msgc : String (1 .. Msg'Length + 2);
- -- Copy of message, with room for possible ? and ! at end
+ Msgc : String (1 .. Msg'Length + 3);
+ -- Copy of message, with room for possible ?? and ! at end
Msgl : Natural;
Wmsg : Boolean;
@@ -2291,11 +2291,15 @@ package body Sem_Util is
then
Msgl := Msgl + 1;
Msgc (Msgl) := '?';
+ Msgl := Msgl + 1;
+ Msgc (Msgl) := '?';
Wmsg := True;
elsif In_Instance_Not_Visible then
Msgl := Msgl + 1;
Msgc (Msgl) := '?';
+ Msgl := Msgl + 1;
+ Msgc (Msgl) := '?';
Wmsg := True;
-- Otherwise we have a real error message (Ada 95 static case)
@@ -2413,19 +2417,19 @@ package body Sem_Util is
and then not Comes_From_Source (Conc_Typ)
then
Error_Msg_NEL
- ("\?& will be raised at run time",
+ ("\??& will be raised at run time",
N, Standard_Constraint_Error, Eloc);
else
Error_Msg_NEL
- ("\?& will be raised for objects of this type",
+ ("\??& will be raised for objects of this type",
N, Standard_Constraint_Error, Eloc);
end if;
end;
else
Error_Msg_NEL
- ("\?& will be raised at run time",
+ ("\??& will be raised at run time",
N, Standard_Constraint_Error, Eloc);
end if;
@@ -3863,7 +3867,7 @@ package body Sem_Util is
Is_Potentially_Use_Visible (C))
then
Error_Msg_Sloc := Sloc (C);
- Error_Msg_N ("declaration hides &#?", Def_Id);
+ Error_Msg_N ("declaration hides &#?h?", Def_Id);
end if;
end Enter_Name;
@@ -11258,7 +11262,8 @@ package body Sem_Util is
-- sure this is a modification.
if Has_Pragma_Unmodified (Ent) and then Sure then
- Error_Msg_NE ("?pragma Unmodified given for &!", N, Ent);
+ Error_Msg_NE
+ ("??pragma Unmodified given for &!", N, Ent);
end if;
Set_Never_Set_In_Source (Ent, False);
@@ -11348,8 +11353,8 @@ package body Sem_Util is
then
Error_Msg_Sloc := Sloc (A);
Error_Msg_NE
- ("constant& may be modified via address clause#?",
- N, Entity (Prefix (Exp)));
+ ("constant& may be modified via address "
+ & "clause#??", N, Entity (Prefix (Exp)));
end if;
end;
end if;
@@ -11600,16 +11605,15 @@ package body Sem_Util is
end Return_Master_Scope_Depth_Of_Call;
end if;
- -- For convenience we handle qualified expressions, even though
- -- they aren't technically object names.
+ -- For convenience we handle qualified expressions, even though they
+ -- aren't technically object names.
elsif Nkind (Obj) = N_Qualified_Expression then
return Object_Access_Level (Expression (Obj));
- -- Otherwise return the scope level of Standard.
- -- (If there are cases that fall through
- -- to this point they will be treated as
- -- having global accessibility for now. ???)
+ -- Otherwise return the scope level of Standard. (If there are cases
+ -- that fall through to this point they will be treated as having
+ -- global accessibility for now. ???)
else
return Scope_Depth (Standard_Standard);
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 53ad6312daa..e24e72901dd 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -200,7 +200,7 @@ package body Sem_Warn is
if No (Asm_Input_Value) then
Error_Msg_F
- ("?code statement with no inputs should usually be Volatile!", N);
+ ("??code statement with no inputs should usually be Volatile!", N);
return;
end if;
@@ -208,7 +208,7 @@ package body Sem_Warn is
if No (Asm_Output_Variable) then
Error_Msg_F
- ("?code statement with no outputs should usually be Volatile!", N);
+ ("??code statement with no outputs should usually be Volatile!", N);
return;
end if;
end Check_Code_Statement;
@@ -707,9 +707,9 @@ package body Sem_Warn is
if No_Ref_Found (Loop_Statement) = OK then
Error_Msg_NE
- ("?variable& is not modified in loop body!", Ref, Var);
+ ("??variable& is not modified in loop body!", Ref, Var);
Error_Msg_N
- ("\?possible infinite loop!", Ref);
+ ("\??possible infinite loop!", Ref);
end if;
end Check_Infinite_Loop_Warning;
@@ -1057,7 +1057,7 @@ package body Sem_Warn is
-- the designated object).
if not Warnings_Off_E1 then
- Error_Msg_NE ("?& may be null!", UR, E1);
+ Error_Msg_NE ("??& may be null!", UR, E1);
end if;
goto Continue;
@@ -1083,7 +1083,7 @@ package body Sem_Warn is
and then not Is_Imported (E1)
then
Error_Msg_N
- ("?& is not modified, volatile has no effect!", E1);
+ ("?k?& is not modified, volatile has no effect!", E1);
-- Another special case, Exception_Occurrence, this catches
-- the case of exception choice (and a bit more too, but not
@@ -1105,7 +1105,7 @@ package body Sem_Warn is
then
if not Warnings_Off_E1 then
Error_Msg_N -- CODEFIX
- ("?& is not modified, "
+ ("?k?& is not modified, "
& "could be declared constant!",
E1);
end if;
@@ -1237,7 +1237,7 @@ package body Sem_Warn is
and then not Warnings_Off_E1
then
Output_Reference_Error
- ("?formal parameter& is read but "
+ ("?f?formal parameter& is read but "
& "never assigned!");
end if;
@@ -1245,7 +1245,7 @@ package body Sem_Warn is
and then not Warnings_Off_E1
then
Output_Reference_Error
- ("?formal parameter& is not referenced!");
+ ("?f?formal parameter& is not referenced!");
end if;
end if;
@@ -1257,14 +1257,14 @@ package body Sem_Warn is
and then not Warnings_Off_E1
then
Output_Reference_Error
- ("?variable& is read but never assigned!");
+ ("?v?variable& is read but never assigned!");
end if;
elsif not Has_Unreferenced (E1)
and then not Warnings_Off_E1
then
Output_Reference_Error -- CODEFIX
- ("?variable& is never read and never assigned!");
+ ("?v?variable& is never read and never assigned!");
end if;
-- Deal with special case where this variable is hidden
@@ -1275,12 +1275,12 @@ package body Sem_Warn is
and then not Warnings_Off_E1
then
Error_Msg_N
- ("?for loop implicitly declares loop variable!",
+ ("?v?for loop implicitly declares loop variable!",
Hiding_Loop_Variable (E1));
Error_Msg_Sloc := Sloc (E1);
Error_Msg_N
- ("\?declaration hides & declared#!",
+ ("\?v?declaration hides & declared#!",
Hiding_Loop_Variable (E1));
end if;
end if;
@@ -1321,7 +1321,8 @@ package body Sem_Warn is
then
if not Warnings_Off_E1 then
Error_Msg_NE
- ("?OUT parameter& not set before return", UR, E1);
+ ("?v?OUT parameter& not set before return",
+ UR, E1);
end if;
-- If the unset reference is a selected component
@@ -2111,7 +2112,7 @@ package body Sem_Warn is
if Entity (Nam) = Pack then
Error_Msg_Qual_Level := 1;
Error_Msg_NE -- CODEFIX
- ("?no entities of package& are referenced!",
+ ("?u?no entities of package& are referenced!",
Nam, Pack);
Error_Msg_Qual_Level := 0;
end if;
@@ -2308,7 +2309,7 @@ package body Sem_Warn is
elsif Has_Visible_Entities (Entity (Name (Item))) then
Error_Msg_N -- CODEFIX
- ("?unit& is not referenced!", Name (Item));
+ ("?u?unit& is not referenced!", Name (Item));
end if;
end if;
@@ -2385,7 +2386,7 @@ package body Sem_Warn is
Has_Unreferenced (Entity (Name (Item)))
then
Error_Msg_N -- CODEFIX
- ("?no entities of & are referenced!",
+ ("?u?no entities of & are referenced!",
Name (Item));
end if;
@@ -2401,7 +2402,7 @@ package body Sem_Warn is
and then not Has_Unreferenced (Pack)
then
Error_Msg_NE -- CODEFIX
- ("?no entities of & are referenced!",
+ ("?u?no entities of & are referenced!",
Unit_Declaration_Node (Pack),
Pack);
end if;
@@ -2451,12 +2452,12 @@ package body Sem_Warn is
elsif Unreferenced_In_Spec (Item) then
Error_Msg_N -- CODEFIX
- ("?unit& is not referenced in spec!",
+ ("?u?unit& is not referenced in spec!",
Name (Item));
elsif No_Entities_Ref_In_Spec (Item) then
Error_Msg_N -- CODEFIX
- ("?no entities of & are referenced in spec!",
+ ("?u?no entities of & are referenced in spec!",
Name (Item));
else
@@ -2469,7 +2470,7 @@ package body Sem_Warn is
if not Is_Visible_Renaming then
Error_Msg_N -- CODEFIX
- ("\?with clause might be moved to body!",
+ ("\?u?with clause might be moved to body!",
Name (Item));
end if;
@@ -2497,7 +2498,7 @@ package body Sem_Warn is
Set_Unreferenced_In_Spec (Item);
else
Error_Msg_N -- CODEFIX
- ("?unit& is never instantiated!", Name (Item));
+ ("?u?unit& is never instantiated!", Name (Item));
end if;
-- If unit was indeed instantiated, make sure that flag is
@@ -2506,9 +2507,9 @@ package body Sem_Warn is
elsif Unreferenced_In_Spec (Item) then
Error_Msg_N
- ("?unit& is not instantiated in spec!", Name (Item));
+ ("?u?unit& is not instantiated in spec!", Name (Item));
Error_Msg_N -- CODEFIX
- ("\?with clause can be moved to body!", Name (Item));
+ ("\?u?with clause can be moved to body!", Name (Item));
end if;
end if;
end if;
@@ -2520,9 +2521,7 @@ package body Sem_Warn is
-- Start of processing for Check_Unused_Withs
begin
- if not Opt.Check_Withs
- or else Operating_Mode = Check_Syntax
- then
+ if not Opt.Check_Withs or else Operating_Mode = Check_Syntax then
return;
end if;
@@ -2793,9 +2792,9 @@ package body Sem_Warn is
if not Is_Trivial_Subprogram (Scope (E1)) then
if Warn_On_Constant then
Error_Msg_N
- ("?formal parameter & is not modified!", E1);
+ ("?u?formal parameter & is not modified!", E1);
Error_Msg_N
- ("\?mode could be IN instead of `IN OUT`!", E1);
+ ("\?u?mode could be IN instead of `IN OUT`!", E1);
-- We do not generate warnings for IN OUT parameters
-- unless we have at least -gnatwu. This is deliberately
@@ -2805,7 +2804,7 @@ package body Sem_Warn is
elsif Check_Unreferenced then
Error_Msg_N
- ("?formal parameter& is read but "
+ ("?u?formal parameter& is read but "
& "never assigned!", E1);
end if;
end if;
@@ -2864,13 +2863,13 @@ package body Sem_Warn is
if Nkind (P) = N_With_Clause then
if Ekind (E) = E_Package then
Error_Msg_NE
- ("?with of obsolescent package& declared#", N, E);
+ ("??with of obsolescent package& declared#", N, E);
elsif Ekind (E) = E_Procedure then
Error_Msg_NE
- ("?with of obsolescent procedure& declared#", N, E);
+ ("??with of obsolescent procedure& declared#", N, E);
else
Error_Msg_NE
- ("?with of obsolescent function& declared#", N, E);
+ ("??with of obsolescent function& declared#", N, E);
end if;
-- If we do not have a with clause, then ignore any reference to an
@@ -2884,51 +2883,49 @@ package body Sem_Warn is
elsif Nkind (P) = N_Procedure_Call_Statement then
Error_Msg_NE
- ("?call to obsolescent procedure& declared#", N, E);
+ ("??call to obsolescent procedure& declared#", N, E);
-- Function call
elsif Nkind (P) = N_Function_Call then
Error_Msg_NE
- ("?call to obsolescent function& declared#", N, E);
+ ("??call to obsolescent function& declared#", N, E);
-- Reference to obsolescent type
elsif Is_Type (E) then
Error_Msg_NE
- ("?reference to obsolescent type& declared#", N, E);
+ ("??reference to obsolescent type& declared#", N, E);
-- Reference to obsolescent component
elsif Ekind_In (E, E_Component, E_Discriminant) then
Error_Msg_NE
- ("?reference to obsolescent component& declared#", N, E);
+ ("??reference to obsolescent component& declared#", N, E);
-- Reference to obsolescent variable
elsif Ekind (E) = E_Variable then
Error_Msg_NE
- ("?reference to obsolescent variable& declared#", N, E);
+ ("??reference to obsolescent variable& declared#", N, E);
-- Reference to obsolescent constant
- elsif Ekind (E) = E_Constant
- or else Ekind (E) in Named_Kind
- then
+ elsif Ekind (E) = E_Constant or else Ekind (E) in Named_Kind then
Error_Msg_NE
- ("?reference to obsolescent constant& declared#", N, E);
+ ("??reference to obsolescent constant& declared#", N, E);
-- Reference to obsolescent enumeration literal
elsif Ekind (E) = E_Enumeration_Literal then
Error_Msg_NE
- ("?reference to obsolescent enumeration literal& declared#", N, E);
+ ("??reference to obsolescent enumeration literal& declared#", N, E);
-- Generic message for any other case we missed
else
Error_Msg_NE
- ("?reference to obsolescent entity& declared#", N, E);
+ ("??reference to obsolescent entity& declared#", N, E);
end if;
-- Output additional warning if present
@@ -2938,7 +2935,7 @@ package body Sem_Warn is
String_To_Name_Buffer (Obsolescent_Warnings.Table (J).Msg);
Error_Msg_Strlen := Name_Len;
Error_Msg_String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
- Error_Msg_N ("\\?~", N);
+ Error_Msg_N ("\\??~", N);
exit;
end if;
end loop;
@@ -2992,21 +2989,21 @@ package body Sem_Warn is
elsif Warnings_Off_Used_Unmodified (E) then
Error_Msg_NE
- ("?could use Unmodified instead of "
+ ("?W?could use Unmodified instead of "
& "Warnings Off for &", Pragma_Identifier (N), E);
-- Used only in context where Unreferenced would have worked
elsif Warnings_Off_Used_Unreferenced (E) then
Error_Msg_NE
- ("?could use Unreferenced instead of "
+ ("?W?could use Unreferenced instead of "
& "Warnings Off for &", Pragma_Identifier (N), E);
-- Not used at all
else
Error_Msg_NE
- ("?pragma Warnings Off for & unused, "
+ ("?W?pragma Warnings Off for & unused, "
& "could be omitted", N, E);
end if;
end;
@@ -3178,9 +3175,20 @@ package body Sem_Warn is
if Constant_Condition_Warnings
and then Is_Known_Branch
- and then Comes_From_Source (Original_Node (C))
+ and then Comes_From_Source (Orig)
and then not In_Instance
then
+ -- Don't warn if comparison of result of attribute against a constant
+ -- value, since this is likely legitimate conditional compilation.
+
+ if Nkind (Orig) in N_Op_Compare
+ and then Compile_Time_Known_Value (Right_Opnd (Orig))
+ and then Nkind (Original_Node (Left_Opnd (Orig))) =
+ N_Attribute_Reference
+ then
+ return;
+ end if;
+
-- See if this is in a statement or a declaration
P := Parent (C);
@@ -3248,16 +3256,16 @@ package body Sem_Warn is
and then Nkind (Cond) /= N_Op_Not
then
Error_Msg_NE
- ("object & is always True?", Cond, Original_Node (C));
+ ("object & is always True?c?", Cond, Original_Node (C));
Track (Original_Node (C), Cond);
else
- Error_Msg_N ("condition is always True?", Cond);
+ Error_Msg_N ("condition is always True?c?", Cond);
Track (Cond, Cond);
end if;
else
- Error_Msg_N ("condition is always False?", Cond);
+ Error_Msg_N ("condition is always False?c?", Cond);
Track (Cond, Cond);
end if;
end;
@@ -3387,23 +3395,23 @@ package body Sem_Warn is
then
if Act1 = First_Actual (N) then
Error_Msg_FE
- ("`IN OUT` prefix overlaps with actual for&?",
- Act1, Form);
+ ("`IN OUT` prefix overlaps with "
+ & "actual for&?I?", Act1, Form);
else
-- For greater clarity, give name of formal.
Error_Msg_Node_2 := Form;
Error_Msg_FE
- ("writable actual for & overlaps with"
- & " actual for&?", Act1, Form);
+ ("writable actual for & overlaps with "
+ & "actual for&?I?", Act1, Form);
end if;
else
Error_Msg_Node_2 := Form;
Error_Msg_FE
("writable actual for & overlaps with"
- & " actual for&?", Act1, Form1);
+ & " actual for&?I?", Act1, Form1);
end if;
end;
end if;
@@ -3513,7 +3521,7 @@ package body Sem_Warn is
begin
Error_Msg_Uint_1 := Low_Bound;
Error_Msg_FE -- CODEFIX
- ("?index for& may assume lower bound of^", X, Ent);
+ ("?w?index for& may assume lower bound of^", X, Ent);
end Warn1;
-- Start of processing for Test_Suspicious_Index
@@ -3538,11 +3546,11 @@ package body Sem_Warn is
if Nkind (Original_Node (X)) = N_Integer_Literal then
if Intval (X) = Low_Bound then
Error_Msg_FE -- CODEFIX
- ("\suggested replacement: `&''First`", X, Ent);
+ ("\?w?suggested replacement: `&''First`", X, Ent);
else
Error_Msg_Uint_1 := Intval (X) - Low_Bound;
Error_Msg_FE -- CODEFIX
- ("\suggested replacement: `&''First + ^`", X, Ent);
+ ("\?w?suggested replacement: `&''First + ^`", X, Ent);
end if;
@@ -3648,7 +3656,7 @@ package body Sem_Warn is
-- Replacement subscript is now in string buffer
Error_Msg_FE -- CODEFIX
- ("\suggested replacement: `&~`", Original_Node (X), Ent);
+ ("\?w?suggested replacement: `&~`", Original_Node (X), Ent);
end if;
-- Case where subscript is of the form X'Length
@@ -3657,7 +3665,7 @@ package body Sem_Warn is
Warn1;
Error_Msg_Node_2 := Ent;
Error_Msg_FE
- ("\suggest replacement of `&''Length` by `&''Last`",
+ ("\?w?suggest replacement of `&''Length` by `&''Last`",
X, Ent);
-- Case where subscript is of the form X'Length - expression
@@ -3668,7 +3676,7 @@ package body Sem_Warn is
Warn1;
Error_Msg_Node_2 := Ent;
Error_Msg_FE
- ("\suggest replacement of `&''Length` by `&''Last`",
+ ("\?w?suggest replacement of `&''Length` by `&''Last`",
Left_Opnd (X), Ent);
end if;
end Test_Suspicious_Index;
@@ -3796,7 +3804,7 @@ package body Sem_Warn is
then
if not Has_Pragma_Unmodified_Check_Spec (E) then
Error_Msg_N -- CODEFIX
- ("?variable & is assigned but never read!", E);
+ ("?u?variable & is assigned but never read!", E);
end if;
Set_Last_Assignment (E, Empty);
@@ -3820,10 +3828,10 @@ package body Sem_Warn is
and then Comes_From_Source (Renamed_Object (E))
then
Error_Msg_N -- CODEFIX
- ("?renamed variable & is not referenced!", E);
+ ("?u?renamed variable & is not referenced!", E);
else
Error_Msg_N -- CODEFIX
- ("?variable & is not referenced!", E);
+ ("?u?variable & is not referenced!", E);
end if;
end if;
end if;
@@ -3833,10 +3841,10 @@ package body Sem_Warn is
and then Comes_From_Source (Renamed_Object (E))
then
Error_Msg_N -- CODEFIX
- ("?renamed constant & is not referenced!", E);
+ ("?u?renamed constant & is not referenced!", E);
else
Error_Msg_N -- CODEFIX
- ("?constant & is not referenced!", E);
+ ("?u?constant & is not referenced!", E);
end if;
when E_In_Parameter |
@@ -3845,8 +3853,8 @@ package body Sem_Warn is
-- Do not emit message for formals of a renaming, because
-- they are never referenced explicitly.
- if Nkind (Original_Node (Unit_Declaration_Node (Scope (E))))
- /= N_Subprogram_Renaming_Declaration
+ if Nkind (Original_Node (Unit_Declaration_Node (Scope (E)))) /=
+ N_Subprogram_Renaming_Declaration
then
-- Suppress this message for an IN OUT parameter of a
-- non-scalar type, since it is normal to have only an
@@ -3862,7 +3870,7 @@ package body Sem_Warn is
if not Is_Trivial_Subprogram (Scope (E)) then
Error_Msg_NE -- CODEFIX
- ("?formal parameter & is not referenced!",
+ ("?u?formal parameter & is not referenced!",
E, Spec_E);
end if;
end if;
@@ -3872,56 +3880,56 @@ package body Sem_Warn is
null;
when E_Discriminant =>
- Error_Msg_N ("?discriminant & is not referenced!", E);
+ Error_Msg_N ("?u?discriminant & is not referenced!", E);
when E_Named_Integer |
E_Named_Real =>
Error_Msg_N -- CODEFIX
- ("?named number & is not referenced!", E);
+ ("?u?named number & is not referenced!", E);
when Formal_Object_Kind =>
Error_Msg_N -- CODEFIX
- ("?formal object & is not referenced!", E);
+ ("?u?formal object & is not referenced!", E);
when E_Enumeration_Literal =>
Error_Msg_N -- CODEFIX
- ("?literal & is not referenced!", E);
+ ("?u?literal & is not referenced!", E);
when E_Function =>
Error_Msg_N -- CODEFIX
- ("?function & is not referenced!", E);
+ ("?u?function & is not referenced!", E);
when E_Procedure =>
Error_Msg_N -- CODEFIX
- ("?procedure & is not referenced!", E);
+ ("?u?procedure & is not referenced!", E);
when E_Package =>
Error_Msg_N -- CODEFIX
- ("?package & is not referenced!", E);
+ ("?u?package & is not referenced!", E);
when E_Exception =>
Error_Msg_N -- CODEFIX
- ("?exception & is not referenced!", E);
+ ("?u?exception & is not referenced!", E);
when E_Label =>
Error_Msg_N -- CODEFIX
- ("?label & is not referenced!", E);
+ ("?u?label & is not referenced!", E);
when E_Generic_Procedure =>
Error_Msg_N -- CODEFIX
- ("?generic procedure & is never instantiated!", E);
+ ("?u?generic procedure & is never instantiated!", E);
when E_Generic_Function =>
Error_Msg_N -- CODEFIX
- ("?generic function & is never instantiated!", E);
+ ("?u?generic function & is never instantiated!", E);
when Type_Kind =>
Error_Msg_N -- CODEFIX
- ("?type & is not referenced!", E);
+ ("?u?type & is not referenced!", E);
when others =>
Error_Msg_N -- CODEFIX
- ("?& is not referenced!", E);
+ ("?u?& is not referenced!", E);
end case;
-- Kill warnings on the entity on which the message has been posted
@@ -4023,12 +4031,12 @@ package body Sem_Warn is
N_Parameter_Association)
then
Error_Msg_NE
- ("?& modified by call, but value never "
+ ("?m?& modified by call, but value never "
& "referenced", LA, Ent);
else
Error_Msg_NE -- CODEFIX
- ("?useless assignment to&, value never "
+ ("?m?useless assignment to&, value never "
& "referenced!", LA, Ent);
end if;
end if;
@@ -4050,11 +4058,11 @@ package body Sem_Warn is
N_Parameter_Association)
then
Error_Msg_NE
- ("?& modified by call, but value overwritten #!",
+ ("?m?& modified by call, but value overwritten #!",
LA, Ent);
else
Error_Msg_NE -- CODEFIX
- ("?useless assignment to&, value overwritten #!",
+ ("?m?useless assignment to&, value overwritten #!",
LA, Ent);
end if;
end;
diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb
index 59d2aed4f99..64a7cdb68b4 100644
--- a/gcc/ada/sinput-l.adb
+++ b/gcc/ada/sinput-l.adb
@@ -668,7 +668,7 @@ package body Sinput.L is
if not Status then
Errout.Error_Msg
- ("?could not write processed file """ &
+ ("??could not write processed file """ &
Name_Buffer (1 .. Name_Len) & '"',
Lo);
end if;
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index bffa6004ba7..2cb296dd1be 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -366,6 +366,7 @@ package Snames is
Name_Assume_No_Invalid_Values : constant Name_Id := N + $; -- GNAT
Name_Attribute_Definition : constant Name_Id := N + $; -- GNAT
Name_C_Pass_By_Copy : constant Name_Id := N + $; -- GNAT
+ Name_Check_Float_Overflow : constant Name_Id := N + $; -- GNAT
Name_Check_Name : constant Name_Id := N + $; -- GNAT
Name_Check_Policy : constant Name_Id := N + $; -- GNAT
Name_Compile_Time_Error : constant Name_Id := N + $; -- GNAT
@@ -1665,6 +1666,7 @@ package Snames is
Pragma_Assume_No_Invalid_Values,
Pragma_Attribute_Definition,
Pragma_C_Pass_By_Copy,
+ Pragma_Check_Float_Overflow,
Pragma_Check_Name,
Pragma_Check_Policy,
Pragma_Compile_Time_Error,
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index e80708e67b0..bfa245fd9dc 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -1159,14 +1159,19 @@ package body Sprint is
when N_Case_Expression =>
declare
- Alt : Node_Id;
+ Has_Parens : constant Boolean := Paren_Count (Node) > 0;
+ Alt : Node_Id;
begin
-- The syntax for case_expression does not include parentheses,
-- but sometimes parentheses are required, so unconditionally
- -- generate them here.
+ -- generate them here unless already present.
- Write_Str_With_Col_Check_Sloc ("(case ");
+ if not Has_Parens then
+ Write_Char ('(');
+ end if;
+
+ Write_Str_With_Col_Check_Sloc ("case ");
Sprint_Node (Expression (Node));
Write_Str_With_Col_Check (" is");
@@ -1178,7 +1183,9 @@ package body Sprint is
Write_Char (',');
end loop;
- Write_Char (')');
+ if not Has_Parens then
+ Write_Char (')');
+ end if;
end;
when N_Case_Expression_Alternative =>
@@ -1963,15 +1970,19 @@ package body Sprint is
when N_If_Expression =>
declare
- Condition : constant Node_Id := First (Expressions (Node));
- Then_Expr : constant Node_Id := Next (Condition);
+ Has_Parens : constant Boolean := Paren_Count (Node) > 0;
+ Condition : constant Node_Id := First (Expressions (Node));
+ Then_Expr : constant Node_Id := Next (Condition);
begin
-- The syntax for if_expression does not include parentheses,
-- but sometimes parentheses are required, so unconditionally
- -- generate them here.
+ -- generate them here unless already present.
- Write_Str_With_Col_Check_Sloc ("(if ");
+ if not Has_Parens then
+ Write_Char ('(');
+ end if;
+ Write_Str_With_Col_Check_Sloc ("if ");
Sprint_Node (Condition);
Write_Str_With_Col_Check (" then ");
@@ -1979,11 +1990,16 @@ package body Sprint is
if Present (Then_Expr) then
Sprint_Node (Then_Expr);
- Write_Str_With_Col_Check (" else ");
- Sprint_Node (Next (Then_Expr));
+
+ if Present (Next (Then_Expr)) then
+ Write_Str_With_Col_Check (" else ");
+ Sprint_Node (Next (Then_Expr));
+ end if;
end if;
- Write_Char (')');
+ if not Has_Parens then
+ Write_Char (')');
+ end if;
end;
when N_If_Statement =>
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 920b2a5773a..ebb18b0c401 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -514,6 +514,12 @@ package body Switch.C is
Ptr := Ptr + 1;
Full_Path_Name_For_Brief_Errors := True;
+ -- -gnateF (Check_Float_Overflow)
+
+ when 'F' =>
+ Ptr := Ptr + 1;
+ Check_Float_Overflow := True;
+
-- -gnateG (save preprocessor output)
when 'G' =>
@@ -612,6 +618,7 @@ package body Switch.C is
when 'S' =>
Generate_SCO := True;
+ Generate_SCO_Instance_Table := True;
Ptr := Ptr + 1;
-- -gnatet (generate target dependent information)
diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb
index 0d769dc09f1..4f18ec11c54 100644
--- a/gcc/ada/switch-m.adb
+++ b/gcc/ada/switch-m.adb
@@ -214,6 +214,12 @@ package body Switch.M is
then
Add_Switch_Component (Switch_Chars);
+ -- Special case for -fstack-check (alias for
+ -- -fstack-check=specific)
+
+ elsif Switch_Chars = "-fstack-check" then
+ Add_Switch_Component ("-fstack-check=specific");
+
-- Take only into account switches that are transmitted to
-- gnat1 by the gcc driver and stored by gnat1 in the ALI file.
diff --git a/gcc/ada/targext.c b/gcc/ada/targext.c
index 6a9f970c286..f51301bda1d 100644
--- a/gcc/ada/targext.c
+++ b/gcc/ada/targext.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2005-2011, Free Software Foundation, Inc. *
+ * Copyright (C) 2005-2012, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -35,10 +35,6 @@
Note that, in order to have access to the TARGET_* macros used below,
the file must be compiled with IN_GCC defined, even for the library. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef IN_RTS
#include "tconfig.h"
#include "tsystem.h"
@@ -57,6 +53,10 @@ extern "C" {
#define TARGET_EXECUTABLE_SUFFIX ""
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
const char *__gnat_target_object_extension = TARGET_OBJECT_SUFFIX;
const char *__gnat_target_executable_extension = TARGET_EXECUTABLE_SUFFIX;
const char *__gnat_target_debuggable_extension = TARGET_EXECUTABLE_SUFFIX;
diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb
index ae801555d0b..5ed84083a8a 100644
--- a/gcc/ada/targparm.adb
+++ b/gcc/ada/targparm.adb
@@ -554,7 +554,7 @@ package body Targparm is
case K is
when AAM => AAMP_On_Target := Result;
when ACR => Always_Compatible_Rep_On_Target := Result;
- when ASD => Atomic_Sync_Default := Result;
+ when ASD => Atomic_Sync_Default_On_Target := Result;
when BDC => Backend_Divide_Checks_On_Target := Result;
when BOC => Backend_Overflow_Checks_On_Target := Result;
when CLA => Command_Line_Args_On_Target := Result;
diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads
index e3210c93664..5869f0c1013 100644
--- a/gcc/ada/targparm.ads
+++ b/gcc/ada/targparm.ads
@@ -388,7 +388,7 @@ package Targparm is
-- used at the source level, and the corresponding flag is false, then an
-- error message will be issued saying the feature is not supported.
- Atomic_Sync_Default : Boolean := True;
+ Atomic_Sync_Default_On_Target : Boolean := True;
-- Access to atomic variables requires memory barrier synchronization in
-- the general case to ensure proper behavior when such accesses are used
-- on a multi-processor to synchronize tasks (e.g. by using spin locks).
diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c
index 01b96548baf..2c8335de68b 100644
--- a/gcc/ada/tracebak.c
+++ b/gcc/ada/tracebak.c
@@ -287,10 +287,9 @@ __gnat_backtrace (void **array,
#error Unhandled darwin architecture.
#endif
-/*---------------------- PPC AIX/PPC Lynx 178/Older Darwin ------------------*/
+/*------------------------ PPC AIX/Older Darwin -------------------------*/
#elif ((defined (_POWER) && defined (_AIX)) || \
- (defined (__powerpc__) && defined (__Lynx__) && !defined(__ELF__)) || \
- (defined (__ppc__) && defined (__APPLE__)))
+(defined (__ppc__) && defined (__APPLE__)))
#define USE_GENERIC_UNWINDER
@@ -308,23 +307,9 @@ struct layout
should to feature a null backchain, AIX might expose a null return
address instead. */
-/* Then LynxOS-178 features yet another variation, with return_address
- == &__start, which we only add conditionally as this symbol is not
- necessarily present elsewhere. Beware that &bla returns the
- address of a descriptor when "bla" is a function. Getting the code
- address requires an extra dereference. */
-
-#if defined (__Lynx__)
-extern void __start();
-#define EXTRA_STOP_CONDITION(CURRENT) ((CURRENT)->return_address == *(void**)&__start)
-#else
-#define EXTRA_STOP_CONDITION(CURRENT) (0)
-#endif
-
#define STOP_FRAME(CURRENT, TOP_STACK) \
(((void *) (CURRENT) < (TOP_STACK)) \
- || (CURRENT)->return_address == NULL \
- || EXTRA_STOP_CONDITION(CURRENT))
+ || (CURRENT)->return_address == NULL)
/* The PPC ABI has an interesting specificity: the return address saved by a
function is located in it's caller's frame, and the save operation only
diff --git a/gcc/ada/tree_io.ads b/gcc/ada/tree_io.ads
index 9fa2121f4cd..1f5b90059eb 100644
--- a/gcc/ada/tree_io.ads
+++ b/gcc/ada/tree_io.ads
@@ -47,7 +47,7 @@ package Tree_IO is
Tree_Format_Error : exception;
-- Raised if a format error is detected in the input file
- ASIS_Version_Number : constant := 29;
+ ASIS_Version_Number : constant := 30;
-- ASIS Version. This is used to check for consistency between the compiler
-- used to generate trees and an ASIS application that is reading the
-- trees. It must be incremented whenever a change is made to the tree
@@ -58,6 +58,7 @@ package Tree_IO is
-- 28 Changes in Snames
-- 29 Changes in Sem_Ch3 (tree copying in case of discriminant constraint
-- for concurrent types).
+ -- 30 Add Check_Float_Overflow boolean to tree file
procedure Tree_Read_Initialize (Desc : File_Descriptor);
-- Called to initialize reading of a tree file. This call must be made
diff --git a/gcc/ada/ug_words b/gcc/ada/ug_words
index b1b45c407cb..10f03f5c6f3 100644
--- a/gcc/ada/ug_words
+++ b/gcc/ada/ug_words
@@ -58,10 +58,13 @@ gcc -c ^ GNAT COMPILE
-gnatC ^ /COMPRESS_NAMES
-gnatDG ^ /XDEBUG /EXPAND_SOURCEA
-gnatD ^ /XDEBUG
+-gnateA ^ /ALIASING_CHECK
-gnatec ^ /CONFIGURATION_PRAGMAS_FILE
--gnateE ^ /EXTRA_EXCEPTION_INFORMATION
+-gnated ^ /DISABLE_ATOMIC_SYNCHRONIZATION
-gnateD ^ /SYMBOL_PREPROCESSING
+-gnateE ^ /EXTRA_EXCEPTION_INFORMATION
-gnatef ^ /FULL_PATH_IN_BRIEF_MESSAGES
+-gnateF ^ /FLOAT_OVERFLOW_CHECK
-gnateG ^ /GENERATE_PROCESSED_SOURCE
-gnatei ^ /MAX_INSTANTIATIONS=
-gnateI ^ /MULTI_UNIT_INDEX=
@@ -69,6 +72,8 @@ gcc -c ^ GNAT COMPILE
-gnatep ^ /DATA_PREPROCESSING
-gnateP ^ /CATEGORIZATION_WARNINGS
-gnateS ^ /SCO_OUTPUT
+-gnatet ^ /TARGET_DEPENDENT_INFO
+-gnateV ^ /PARAMETER_VALIDITY_CHECK
-gnatE ^ /CHECKS=ELABORATION
-gnatf ^ /REPORT_ERRORS=FULL
-gnatF ^ /UPPERCASE_EXTERNALS
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index 6b6605d8eb6..769afdeba1a 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -167,6 +167,11 @@ begin
Write_Switch_Char ("Dnn");
Write_Line ("Debug expanded generated code (max line length = nn)");
+ -- Line for -gnatea switch
+
+ Write_Switch_Char ("ea");
+ Write_Line ("Delimiter for automatically added switches (internal switch)");
+
-- Line for -gnateA switch
Write_Switch_Char ("eA");
@@ -217,6 +222,11 @@ begin
Write_Switch_Char ("em=?");
Write_Line ("Specify mapping file, e.g. -gnatem=mapping");
+ -- Line for -gnateO=?
+
+ Write_Switch_Char ("eO=?");
+ Write_Line ("Specify an object path file (internal switch)");
+
-- Line for -gnatep switch
Write_Switch_Char ("ep=?");
@@ -242,6 +252,11 @@ begin
Write_Switch_Char ("eV");
Write_Line ("Validity checks on subprogram parameters");
+ -- Line for -gnatez switch
+
+ Write_Switch_Char ("ez");
+ Write_Line ("Delimiter for automatically added switches (internal switch)");
+
-- Line for -gnatE switch
Write_Switch_Char ("E");
@@ -526,8 +541,8 @@ begin
Write_Line (" .S* turn off warnings for overridden size clause");
Write_Line (" t turn on warnings for tracking deleted code");
Write_Line (" T* turn off warnings for tracking deleted code");
- Write_Line (" .t+ turn on warnings for suspicious contract");
- Write_Line (" .T* turn off warnings for suspicious contract");
+ Write_Line (" .t*+ turn on warnings for suspicious contract");
+ Write_Line (" .T turn off warnings for suspicious contract");
Write_Line (" u+ turn on warnings for unused entity");
Write_Line (" U* turn off warnings for unused entity");
Write_Line (" .u turn on warnings for unordered enumeration");
diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads
index 69fe509b3e2..ed6f1b5c4fc 100644
--- a/gcc/ada/vms_data.ads
+++ b/gcc/ada/vms_data.ads
@@ -1275,11 +1275,18 @@ package VMS_Data is
-- Equivalent to /12 (/2012 is the preferred usage).
S_GCC_Add : aliased constant S := "/ADD_PROJECT_SEARCH_DIR=*" &
- "-aP*";
+ "-aP*";
-- /ADD_PROJECT_SEARCH_PATH=(directory[,...])
--
-- Add directories to the project search path.
+ S_GCC_AlCheck : aliased constant S := "/ALIASING_CHECK " &
+ "-gnateA";
+ -- /NOALIASING_CHECK (D)
+ -- /ALIASING_CHECK
+ --
+ -- Check that there are no aliased parameters in subprogram calls.
+
S_GCC_Asm : aliased constant S := "/ASM " &
"-S,!-c";
-- /NOASM (D)
@@ -1398,6 +1405,14 @@ package VMS_Data is
"-gnatp,!-gnato,!-gnatE";
-- NODOC (see /CHECKS)
+ S_GCC_Chflov : aliased constant S := "/FLOAT_OVERFLOW_CHECK " &
+ "-gnateF";
+ -- /NOFLOAT_OVERFLOW_CHECK (D)
+ -- /FLOAT_OVERFLOW_CHECK
+ --
+ -- Set mode to check overflow for all floating-point operations including
+ -- those using an unconstrained predefined type (i.e. no infinities).
+
S_GCC_Compres : aliased constant S := "/COMPRESS_NAMES " &
"-gnatC";
-- /NOCOMPRESS_NAMES (D)
@@ -1414,7 +1429,8 @@ package VMS_Data is
"-gnatec>";
-- /CONFIGURATION_PRAGMAS_FILE=file
--
- -- Specify a configuration pragmas file that need to be taken into account
+ -- Specify a configuration pragmas file that needs to be taken into
+ -- account.
S_GCC_Current : aliased constant S := "/CURRENT_DIRECTORY " &
"!-I-";
@@ -1534,6 +1550,12 @@ package VMS_Data is
"!-g";
-- NODOC (see /Debug)
+ S_GCC_DisAtom : aliased constant S := "/DISABLE_ATOMIC_SYNCHRONIZATION " &
+ "-gnated";
+ -- /NODISABLE_ATOMIC_SYNCHRONIZATION (D)
+ -- /DISABLE_ATOMIC_SYNCHRONIZATION
+ -- Disable synchronization of atomic variables.
+
S_GCC_Dist : aliased constant S := "/DISTRIBUTION_STUBS=" &
"RECEIVER " &
"-gnatzr " &
@@ -2126,6 +2148,13 @@ package VMS_Data is
-- assertion, and the second digit sets the mode for expressions within
-- an assertion.
+ S_GCC_PValid : aliased constant S := "/PARAMETER_VALIDITY_CHECK " &
+ "-gnateV";
+ -- /NOPARAMETER_VALIDITY_CHECK (D)
+ -- /PARAMETER_VALIDITY_CHECK
+ --
+ -- Check validity of subprogram parameters.
+
S_GCC_Pointer : aliased constant S := "/POINTER_SIZE=" &
"64 " &
"-mmalloc64 " &
@@ -2837,6 +2866,13 @@ package VMS_Data is
--
-- All compiler tables start at nnn times usual starting size.
+ S_GCC_Target : aliased constant S := "/TARGET_DEPENDENT_INFO " &
+ "-gnatet";
+ -- /NOTARGET_DEPENDENT_INFO (D)
+ -- /TARGET_DEPENDENT_INFO
+ --
+ -- Generate target dependent information.
+
S_GCC_Trace : aliased constant S := "/TRACE_UNITS " &
"-gnatdc";
-- /TRACE_UNITS
@@ -3592,10 +3628,12 @@ package VMS_Data is
S_GCC_Ada_12 'Access,
S_GCC_Ada_2012'Access,
S_GCC_Add 'Access,
+ S_GCC_AlCheck 'Access,
S_GCC_Asm 'Access,
S_GCC_AValid 'Access,
S_GCC_CategW 'Access,
S_GCC_Checks 'Access,
+ S_GCC_Chflov 'Access,
S_GCC_ChecksX 'Access,
S_GCC_Compres 'Access,
S_GCC_Config 'Access,
@@ -3603,6 +3641,7 @@ package VMS_Data is
S_GCC_Debug 'Access,
S_GCC_DebugX 'Access,
S_GCC_Data 'Access,
+ S_GCC_DisAtom 'Access,
S_GCC_Dist 'Access,
S_GCC_DistX 'Access,
S_GCC_Error 'Access,
@@ -3645,6 +3684,7 @@ package VMS_Data is
S_GCC_Opt 'Access,
S_GCC_OptX 'Access,
S_GCC_Overflo 'Access,
+ S_GCC_PValid 'Access,
S_GCC_Pointer 'Access,
S_GCC_Polling 'Access,
S_GCC_Project 'Access,
@@ -3663,6 +3703,7 @@ package VMS_Data is
S_GCC_Symbol 'Access,
S_GCC_Syntax 'Access,
S_GCC_Table 'Access,
+ S_GCC_Target 'Access,
S_GCC_Trace 'Access,
S_GCC_Tree 'Access,
S_GCC_Trys 'Access,
@@ -6097,6 +6138,7 @@ package VMS_Data is
-- By default, the form of the line terminator depends on the platforms.
-- On Unix and VMS, it is a Line Feed (LF) character. On Windows (DOS),
-- It is a Carriage Return (CR) followed by a Line Feed.
+
-- The Options DOS and CRLF are equivalent. The options UNIX and LF are
-- also equivalent.
diff --git a/gcc/ada/warnsw.adb b/gcc/ada/warnsw.adb
index 7920ac90269..a8d31e45231 100644
--- a/gcc/ada/warnsw.adb
+++ b/gcc/ada/warnsw.adb
@@ -22,8 +22,8 @@
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-
-with Opt; use Opt;
+with Err_Vars; use Err_Vars;
+with Opt; use Opt;
package body Warnsw is
@@ -52,6 +52,12 @@ package body Warnsw is
when 'C' =>
Warn_On_Unrepped_Components := False;
+ when 'd' =>
+ Warning_Doc_Switch := True;
+
+ when 'D' =>
+ Warning_Doc_Switch := False;
+
when 'e' =>
Address_Clause_Overlay_Warnings := True;
Check_Unreferenced := True;
diff --git a/gcc/ada/warnsw.ads b/gcc/ada/warnsw.ads
index f802bb7790a..45983e95114 100644
--- a/gcc/ada/warnsw.ads
+++ b/gcc/ada/warnsw.ads
@@ -44,12 +44,13 @@ package Warnsw is
Warn_On_Overridden_Size : Boolean := False;
-- Warn when explicit record component clause or array component_size
-- clause specifies a size that overrides a size for the typen which was
- -- set with an explicit size clause. Off by default, set by -gnatw.s (but
- -- not -gnatwa).
+ -- set with an explicit size clause. Off by default, modified by use of
+ -- -gnatw.s/.S, but not set by -gnatwa.
Warn_On_Standard_Redefinition : Boolean := False;
-- Warn when a program defines an identifier that matches a name in
- -- Standard. Off by default, set by -gnatw.k (and also by -gnatwa).
+ -- Standard. Off by default, modified by use of -gnatw.k/.K, but not
+ -- affected by -gnatwa.
-----------------
-- Subprograms --
diff --git a/gcc/builtins.c b/gcc/builtins.c
index fb7b537ca2c..67c96df2689 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2031,7 +2031,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
if (optab_handler (builtin_optab, mode) != CODE_FOR_nothing
&& (!errno_set || !optimize_insn_for_size_p ()))
{
- target = gen_reg_rtx (mode);
+ rtx result = gen_reg_rtx (mode);
/* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform
@@ -2042,20 +2042,20 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
start_sequence ();
- /* Compute into TARGET.
- Set TARGET to wherever the result comes back. */
- target = expand_unop (mode, builtin_optab, op0, target, 0);
+ /* Compute into RESULT.
+ Set RESULT to wherever the result comes back. */
+ result = expand_unop (mode, builtin_optab, op0, result, 0);
- if (target != 0)
+ if (result != 0)
{
if (errno_set)
- expand_errno_check (exp, target);
+ expand_errno_check (exp, result);
/* Output the entire sequence. */
insns = get_insns ();
end_sequence ();
emit_insn (insns);
- return target;
+ return result;
}
/* If we were unable to expand via the builtin, stop the sequence
@@ -2078,7 +2078,7 @@ static rtx
expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
{
optab builtin_optab;
- rtx op0, op1, insns;
+ rtx op0, op1, insns, result;
int op1_type = REAL_TYPE;
tree fndecl = get_callee_fndecl (exp);
tree arg0, arg1;
@@ -2134,7 +2134,7 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
if (optab_handler (builtin_optab, mode) == CODE_FOR_nothing)
return NULL_RTX;
- target = gen_reg_rtx (mode);
+ result = gen_reg_rtx (mode);
if (! flag_errno_math || ! HONOR_NANS (mode))
errno_set = false;
@@ -2151,29 +2151,29 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
start_sequence ();
- /* Compute into TARGET.
- Set TARGET to wherever the result comes back. */
- target = expand_binop (mode, builtin_optab, op0, op1,
- target, 0, OPTAB_DIRECT);
+ /* Compute into RESULT.
+ Set RESULT to wherever the result comes back. */
+ result = expand_binop (mode, builtin_optab, op0, op1,
+ result, 0, OPTAB_DIRECT);
/* If we were unable to expand via the builtin, stop the sequence
(without outputting the insns) and call to the library function
with the stabilized argument list. */
- if (target == 0)
+ if (result == 0)
{
end_sequence ();
return expand_call (exp, target, target == const0_rtx);
}
if (errno_set)
- expand_errno_check (exp, target);
+ expand_errno_check (exp, result);
/* Output the entire sequence. */
insns = get_insns ();
end_sequence ();
emit_insn (insns);
- return target;
+ return result;
}
/* Expand a call to the builtin trinary math functions (fma).
@@ -2187,7 +2187,7 @@ static rtx
expand_builtin_mathfn_ternary (tree exp, rtx target, rtx subtarget)
{
optab builtin_optab;
- rtx op0, op1, op2, insns;
+ rtx op0, op1, op2, insns, result;
tree fndecl = get_callee_fndecl (exp);
tree arg0, arg1, arg2;
enum machine_mode mode;
@@ -2214,7 +2214,7 @@ expand_builtin_mathfn_ternary (tree exp, rtx target, rtx subtarget)
if (optab_handler (builtin_optab, mode) == CODE_FOR_nothing)
return NULL_RTX;
- target = gen_reg_rtx (mode);
+ result = gen_reg_rtx (mode);
/* Always stabilize the argument list. */
CALL_EXPR_ARG (exp, 0) = arg0 = builtin_save_expr (arg0);
@@ -2227,15 +2227,15 @@ expand_builtin_mathfn_ternary (tree exp, rtx target, rtx subtarget)
start_sequence ();
- /* Compute into TARGET.
- Set TARGET to wherever the result comes back. */
- target = expand_ternary_op (mode, builtin_optab, op0, op1, op2,
- target, 0);
+ /* Compute into RESULT.
+ Set RESULT to wherever the result comes back. */
+ result = expand_ternary_op (mode, builtin_optab, op0, op1, op2,
+ result, 0);
/* If we were unable to expand via the builtin, stop the sequence
(without outputting the insns) and call to the library function
with the stabilized argument list. */
- if (target == 0)
+ if (result == 0)
{
end_sequence ();
return expand_call (exp, target, target == const0_rtx);
@@ -2246,7 +2246,7 @@ expand_builtin_mathfn_ternary (tree exp, rtx target, rtx subtarget)
end_sequence ();
emit_insn (insns);
- return target;
+ return result;
}
/* Expand a call to the builtin sin and cos math functions.
@@ -2298,7 +2298,7 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
/* Before working hard, check whether the instruction is available. */
if (optab_handler (builtin_optab, mode) != CODE_FOR_nothing)
{
- target = gen_reg_rtx (mode);
+ rtx result = gen_reg_rtx (mode);
/* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform
@@ -2309,37 +2309,35 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
start_sequence ();
- /* Compute into TARGET.
- Set TARGET to wherever the result comes back. */
+ /* Compute into RESULT.
+ Set RESULT to wherever the result comes back. */
if (builtin_optab == sincos_optab)
{
- int result;
+ int ok;
switch (DECL_FUNCTION_CODE (fndecl))
{
CASE_FLT_FN (BUILT_IN_SIN):
- result = expand_twoval_unop (builtin_optab, op0, 0, target, 0);
+ ok = expand_twoval_unop (builtin_optab, op0, 0, result, 0);
break;
CASE_FLT_FN (BUILT_IN_COS):
- result = expand_twoval_unop (builtin_optab, op0, target, 0, 0);
+ ok = expand_twoval_unop (builtin_optab, op0, result, 0, 0);
break;
default:
gcc_unreachable ();
}
- gcc_assert (result);
+ gcc_assert (ok);
}
else
- {
- target = expand_unop (mode, builtin_optab, op0, target, 0);
- }
+ result = expand_unop (mode, builtin_optab, op0, result, 0);
- if (target != 0)
+ if (result != 0)
{
/* Output the entire sequence. */
insns = get_insns ();
end_sequence ();
emit_insn (insns);
- return target;
+ return result;
}
/* If we were unable to expand via the builtin, stop the sequence
@@ -2348,9 +2346,7 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
end_sequence ();
}
- target = expand_call (exp, target, target == const0_rtx);
-
- return target;
+ return expand_call (exp, target, target == const0_rtx);
}
/* Given an interclass math builtin decl FNDECL and it's argument ARG
@@ -2819,7 +2815,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target)
/* There's no easy way to detect the case we need to set EDOM. */
if (!flag_errno_math)
{
- target = gen_reg_rtx (mode);
+ rtx result = gen_reg_rtx (mode);
/* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform
@@ -2830,13 +2826,13 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target)
start_sequence ();
- if (expand_sfix_optab (target, op0, builtin_optab))
+ if (expand_sfix_optab (result, op0, builtin_optab))
{
/* Output the entire sequence. */
insns = get_insns ();
end_sequence ();
emit_insn (insns);
- return target;
+ return result;
}
/* If we were unable to expand via the builtin, stop the sequence
@@ -2863,9 +2859,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target)
return convert_to_mode (mode, target, 0);
}
- target = expand_call (exp, target, target == const0_rtx);
-
- return target;
+ return expand_call (exp, target, target == const0_rtx);
}
/* Expand a call to the powi built-in mathematical function. Return NULL_RTX if
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 872a6a0feed..012751330f3 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8742,8 +8742,12 @@ handle_target_attribute (tree *node, tree name, tree args, int flags,
warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
+ /* Do not strip invalid target attributes for targets which support function
+ multiversioning as the target string is used to determine versioned
+ functions. */
else if (! targetm.target_option.valid_attribute_p (*node, name, args,
- flags))
+ flags)
+ && ! targetm.target_option.supports_function_versions ())
*no_add_attrs = true;
return NULL_TREE;
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index b45493a16bb..c15e64945f4 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -1666,3 +1666,55 @@ loop_exits_from_bb_p (struct loop *loop, basic_block bb)
return false;
}
+
+/* Return location corresponding to the loop control condition if possible. */
+
+location_t
+get_loop_location (struct loop *loop)
+{
+ rtx insn = NULL;
+ struct niter_desc *desc = NULL;
+ edge exit;
+
+ /* For a for or while loop, we would like to return the location
+ of the for or while statement, if possible. To do this, look
+ for the branch guarding the loop back-edge. */
+
+ /* If this is a simple loop with an in_edge, then the loop control
+ branch is typically at the end of its source. */
+ desc = get_simple_loop_desc (loop);
+ if (desc->in_edge)
+ {
+ FOR_BB_INSNS_REVERSE (desc->in_edge->src, insn)
+ {
+ if (INSN_P (insn) && INSN_HAS_LOCATION (insn))
+ return INSN_LOCATION (insn);
+ }
+ }
+ /* If loop has a single exit, then the loop control branch
+ must be at the end of its source. */
+ if ((exit = single_exit (loop)))
+ {
+ FOR_BB_INSNS_REVERSE (exit->src, insn)
+ {
+ if (INSN_P (insn) && INSN_HAS_LOCATION (insn))
+ return INSN_LOCATION (insn);
+ }
+ }
+ /* Next check the latch, to see if it is non-empty. */
+ FOR_BB_INSNS_REVERSE (loop->latch, insn)
+ {
+ if (INSN_P (insn) && INSN_HAS_LOCATION (insn))
+ return INSN_LOCATION (insn);
+ }
+ /* Finally, if none of the above identifies the loop control branch,
+ return the first location in the loop header. */
+ FOR_BB_INSNS (loop->header, insn)
+ {
+ if (INSN_P (insn) && INSN_HAS_LOCATION (insn))
+ return INSN_LOCATION (insn);
+ }
+ /* If all else fails, simply return the current function location. */
+ return DECL_SOURCE_LOCATION (current_function_decl);
+}
+
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 9e2e02de93d..81e70d859c4 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -239,6 +239,7 @@ extern bool loop_exit_edge_p (const struct loop *, const_edge);
extern bool loop_exits_to_bb_p (struct loop *, basic_block);
extern bool loop_exits_from_bb_p (struct loop *, basic_block);
extern void mark_loop_exit_edges (void);
+extern location_t get_loop_location (struct loop *loop);
/* Loops & cfg manipulation. */
extern basic_block *get_loop_body (const struct loop *);
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 3af545671e1..444b4f0e957 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -2498,9 +2498,6 @@ verify_cgraph_node (struct cgraph_node *node)
{
if (this_cfun->cfg)
{
- /* The nodes we're interested in are never shared, so walk
- the tree ignoring duplicates. */
- struct pointer_set_t *visited_nodes = pointer_set_create ();
/* Reach the trees by walking over the CFG, and note the
enclosing basic-blocks in the call edges. */
FOR_EACH_BB_FN (this_block, this_cfun)
@@ -2550,7 +2547,6 @@ verify_cgraph_node (struct cgraph_node *node)
}
}
}
- pointer_set_destroy (visited_nodes);
}
else
/* No CFG available?! */
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 28c3497c566..d783862c667 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -1357,7 +1357,6 @@ static inline bool
symtab_real_symbol_p (symtab_node node)
{
struct cgraph_node *cnode;
- struct ipa_ref *ref;
if (!is_a <cgraph_node> (node))
return true;
@@ -1366,11 +1365,6 @@ symtab_real_symbol_p (symtab_node node)
return false;
if (cnode->abstract_and_needed)
return false;
- /* We keep virtual clones in symtab. */
- if (!cnode->analyzed
- || DECL_EXTERNAL (cnode->symbol.decl))
- return (cnode->callers
- || ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref));
return true;
}
#endif /* GCC_CGRAPH_H */
diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def
index 06cc9825d39..4b77009ab7d 100644
--- a/gcc/config/aarch64/aarch64-cores.def
+++ b/gcc/config/aarch64/aarch64-cores.def
@@ -34,5 +34,7 @@
This list currently contains example CPUs that implement AArch64, and
therefore serves as a template for adding more CPUs in the future. */
+AARCH64_CORE("cortex-a53", cortexa53, 8, AARCH64_FL_FPSIMD, generic)
+AARCH64_CORE("cortex-a57", cortexa57, 8, AARCH64_FL_FPSIMD, generic)
AARCH64_CORE("example-1", large, 8, AARCH64_FL_FPSIMD, generic)
AARCH64_CORE("example-2", small, 8, AARCH64_FL_FPSIMD, generic)
diff --git a/gcc/config/aarch64/aarch64-tune.md b/gcc/config/aarch64/aarch64-tune.md
index a654a91b43b..02699e35c3f 100644
--- a/gcc/config/aarch64/aarch64-tune.md
+++ b/gcc/config/aarch64/aarch64-tune.md
@@ -1,5 +1,5 @@
;; -*- buffer-read-only: t -*-
;; Generated automatically by gentune.sh from aarch64-cores.def
(define_attr "tune"
- "large,small"
+ "cortexa53,cortexa57,large,small"
(const (symbol_ref "((enum attr_tune) aarch64_tune)")))
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b466a4fbbdf..60f68d45369 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -28945,47 +28945,6 @@ dispatch_function_versions (tree dispatch_decl,
return 0;
}
-/* This function returns true if FN1 and FN2 are versions of the same function,
- that is, the targets of the function decls are different. This assumes
- that FN1 and FN2 have the same signature. */
-
-static bool
-ix86_function_versions (tree fn1, tree fn2)
-{
- tree attr1, attr2;
- struct cl_target_option *target1, *target2;
-
- if (TREE_CODE (fn1) != FUNCTION_DECL
- || TREE_CODE (fn2) != FUNCTION_DECL)
- return false;
-
- attr1 = DECL_FUNCTION_SPECIFIC_TARGET (fn1);
- attr2 = DECL_FUNCTION_SPECIFIC_TARGET (fn2);
-
- /* Atleast one function decl should have target attribute specified. */
- if (attr1 == NULL_TREE && attr2 == NULL_TREE)
- return false;
-
- if (attr1 == NULL_TREE)
- attr1 = target_option_default_node;
- else if (attr2 == NULL_TREE)
- attr2 = target_option_default_node;
-
- target1 = TREE_TARGET_OPTION (attr1);
- target2 = TREE_TARGET_OPTION (attr2);
-
- /* target1 and target2 must be different in some way. */
- if (target1->x_ix86_isa_flags == target2->x_ix86_isa_flags
- && target1->x_target_flags == target2->x_target_flags
- && target1->arch == target2->arch
- && target1->tune == target2->tune
- && target1->x_ix86_fpmath == target2->x_ix86_fpmath
- && target1->branch_cost == target2->branch_cost)
- return false;
-
- return true;
-}
-
/* Comparator function to be used in qsort routine to sort attribute
specification strings to "target". */
@@ -29098,6 +29057,60 @@ ix86_mangle_function_version_assembler_name (tree decl, tree id)
return get_identifier (assembler_name);
}
+/* This function returns true if FN1 and FN2 are versions of the same function,
+ that is, the target strings of the function decls are different. This assumes
+ that FN1 and FN2 have the same signature. */
+
+static bool
+ix86_function_versions (tree fn1, tree fn2)
+{
+ tree attr1, attr2;
+ const char *attr_str1, *attr_str2;
+ char *target1, *target2;
+ bool result;
+
+ if (TREE_CODE (fn1) != FUNCTION_DECL
+ || TREE_CODE (fn2) != FUNCTION_DECL)
+ return false;
+
+ attr1 = lookup_attribute ("target", DECL_ATTRIBUTES (fn1));
+ attr2 = lookup_attribute ("target", DECL_ATTRIBUTES (fn2));
+
+ /* At least one function decl should have the target attribute specified. */
+ if (attr1 == NULL_TREE && attr2 == NULL_TREE)
+ return false;
+
+ /* If one function does not have a target attribute, these are versions. */
+ if (attr1 == NULL_TREE || attr2 == NULL_TREE)
+ return true;
+
+ attr_str1 = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr1)));
+ attr_str2 = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr2)));
+
+ target1 = sorted_attr_string (attr_str1);
+ target2 = sorted_attr_string (attr_str2);
+
+ /* The sorted target strings must be different for fn1 and fn2
+ to be versions. */
+ if (strcmp (target1, target2) == 0)
+ result = false;
+ else
+ result = true;
+
+ free (target1);
+ free (target2);
+
+ return result;
+}
+
+/* This target supports function multiversioning. */
+
+static bool
+ix86_supports_function_versions (void)
+{
+ return true;
+}
+
static tree
ix86_mangle_decl_assembler_name (tree decl, tree id)
{
@@ -29195,7 +29208,7 @@ is_function_default_version (const tree decl)
{
return (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_FUNCTION_VERSIONED (decl)
- && DECL_FUNCTION_SPECIFIC_TARGET (decl) == NULL_TREE);
+ && lookup_attribute ("target", DECL_ATTRIBUTES (decl)) == NULL_TREE);
}
/* Make a dispatcher declaration for the multi-versioned function DECL.
@@ -29277,7 +29290,7 @@ ix86_get_function_versions_dispatcher (void *decl)
/* Set the dispatcher for all the versions. */
it_v = default_version_info;
- while (it_v->next != NULL)
+ while (it_v != NULL)
{
it_v->dispatcher_resolver = dispatch_decl;
it_v = it_v->next;
@@ -29613,15 +29626,9 @@ fold_builtin_cpu (tree fndecl, tree *args)
{"avx2", F_AVX2}
};
- static tree __processor_model_type = NULL_TREE;
- static tree __cpu_model_var = NULL_TREE;
-
- if (__processor_model_type == NULL_TREE)
- __processor_model_type = build_processor_model_struct ();
-
- if (__cpu_model_var == NULL_TREE)
- __cpu_model_var = make_var_decl (__processor_model_type,
- "__cpu_model");
+ tree __processor_model_type = build_processor_model_struct ();
+ tree __cpu_model_var = make_var_decl (__processor_model_type,
+ "__cpu_model");
gcc_assert ((args != NULL) && (*args != NULL));
@@ -42463,6 +42470,10 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val)
#undef TARGET_OPTION_FUNCTION_VERSIONS
#define TARGET_OPTION_FUNCTION_VERSIONS ix86_function_versions
+#undef TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS
+#define TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS \
+ ix86_supports_function_versions
+
#undef TARGET_CAN_INLINE_P
#define TARGET_CAN_INLINE_P ix86_can_inline_p
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 3b19b98b5ce..9be9b42146d 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -5845,19 +5845,16 @@ ia64_secondary_reload_class (enum reg_class rclass,
static int
ia64_unspec_may_trap_p (const_rtx x, unsigned flags)
{
- if (GET_CODE (x) == UNSPEC)
+ switch (XINT (x, 1))
{
- switch (XINT (x, 1))
- {
- case UNSPEC_LDA:
- case UNSPEC_LDS:
- case UNSPEC_LDSA:
- case UNSPEC_LDCCLR:
- case UNSPEC_CHKACLR:
- case UNSPEC_CHKS:
- /* These unspecs are just wrappers. */
- return may_trap_p_1 (XVECEXP (x, 0, 0), flags);
- }
+ case UNSPEC_LDA:
+ case UNSPEC_LDS:
+ case UNSPEC_LDSA:
+ case UNSPEC_LDCCLR:
+ case UNSPEC_CHKACLR:
+ case UNSPEC_CHKS:
+ /* These unspecs are just wrappers. */
+ return may_trap_p_1 (XVECEXP (x, 0, 0), flags);
}
return default_unspec_may_trap_p (x, flags);
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index 9c6a361c6b5..5cef94bc00e 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -2094,6 +2094,12 @@
""
"
{
+ /* A TLS symbol reference is not a valid move source operand.
+ pa_emit_move_sequence can only handle them prior to reload.
+ There is also no way to reload a TLS symbol reference, so
+ we must reject them after reload starts. */
+ if (PA_SYMBOL_REF_TLS_P (operands[1]) && !can_create_pseudo_p ())
+ FAIL;
if (pa_emit_move_sequence (operands, SImode, 0))
DONE;
}")
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d25c63c4310..bc663eabcc0 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -209,6 +209,7 @@ static short cached_can_issue_more;
static GTY(()) section *read_only_data_section;
static GTY(()) section *private_data_section;
static GTY(()) section *tls_data_section;
+static GTY(()) section *tls_private_data_section;
static GTY(()) section *read_only_private_data_section;
static GTY(()) section *sdata2_section;
static GTY(()) section *toc_section;
@@ -5825,6 +5826,15 @@ rs6000_delegitimize_address (rtx orig_x)
}
#endif
y = XVECEXP (y, 0, 0);
+
+#ifdef HAVE_AS_TLS
+ /* Do not associate thread-local symbols with the original
+ constant pool symbol. */
+ if (TARGET_XCOFF
+ && SYMBOL_REF_TLS_MODEL (get_pool_constant (y)) >= TLS_MODEL_REAL)
+ return orig_x;
+#endif
+
if (offset != NULL_RTX)
y = gen_rtx_PLUS (Pmode, y, offset);
if (!MEM_P (orig_x))
@@ -5898,10 +5908,29 @@ rs6000_got_sym (void)
static rtx
rs6000_legitimize_tls_address_aix (rtx addr, enum tls_model model)
{
- rtx sym, mem, tocref, tlsreg, tmpreg, dest;
+ rtx sym, mem, tocref, tlsreg, tmpreg, dest, tlsaddr;
+ const char *name;
+ char *tlsname;
+
+ name = XSTR (addr, 0);
+ /* Append TLS CSECT qualifier, unless the symbol already is qualified
+ or the symbol will be in TLS private data section. */
+ if (name[strlen (name) - 1] != ']'
+ && (TREE_PUBLIC (SYMBOL_REF_DECL (addr))
+ || bss_initializer_p (SYMBOL_REF_DECL (addr))))
+ {
+ tlsname = XALLOCAVEC (char, strlen (name) + 4);
+ strcpy (tlsname, name);
+ strcat (tlsname,
+ bss_initializer_p (SYMBOL_REF_DECL (addr)) ? "[UL]" : "[TL]");
+ tlsaddr = copy_rtx (addr);
+ XSTR (tlsaddr, 0) = ggc_strdup (tlsname);
+ }
+ else
+ tlsaddr = addr;
/* Place addr into TOC constant pool. */
- sym = force_const_mem (GET_MODE (addr), addr);
+ sym = force_const_mem (GET_MODE (tlsaddr), tlsaddr);
/* Output the TOC entry and create the MEM referencing the value. */
if (constant_pool_expr_p (XEXP (sym, 0))
@@ -5918,27 +5947,28 @@ rs6000_legitimize_tls_address_aix (rtx addr, enum tls_model model)
if (model == TLS_MODEL_GLOBAL_DYNAMIC
|| model == TLS_MODEL_LOCAL_DYNAMIC)
{
- rtx module = gen_reg_rtx (Pmode);
/* Create new TOC reference for @m symbol. */
- const char *name = XSTR (XVECEXP (XEXP (mem, 0), 0, 0), 0);
- char *name2 = XALLOCAVEC (char, strlen (name) + 1);
- strcpy (name2, "*LCM");
- strcat (name2, name + 3);
- tocref = create_TOC_reference (gen_rtx_SYMBOL_REF (Pmode,
- ggc_alloc_string (name2,
- strlen (name2))),
- NULL_RTX);
- rtx mem2 = gen_const_mem (Pmode, tocref);
- set_mem_alias_set (mem2, get_TOC_alias_set ());
+ name = XSTR (XVECEXP (XEXP (mem, 0), 0, 0), 0);
+ tlsname = XALLOCAVEC (char, strlen (name) + 1);
+ strcpy (tlsname, "*LCM");
+ strcat (tlsname, name + 3);
+ rtx modaddr = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tlsname));
+ SYMBOL_REF_FLAGS (modaddr) |= SYMBOL_FLAG_LOCAL;
+ tocref = create_TOC_reference (modaddr, NULL_RTX);
+ rtx modmem = gen_const_mem (Pmode, tocref);
+ set_mem_alias_set (modmem, get_TOC_alias_set ());
- dest = gen_reg_rtx (Pmode);
+ rtx modreg = gen_reg_rtx (Pmode);
+ emit_insn (gen_rtx_SET (VOIDmode, modreg, modmem));
+
tmpreg = gen_reg_rtx (Pmode);
emit_insn (gen_rtx_SET (VOIDmode, tmpreg, mem));
- emit_insn (gen_rtx_SET (VOIDmode, module, mem2));
+
+ dest = gen_reg_rtx (Pmode);
if (TARGET_32BIT)
- emit_insn (gen_tls_get_addrsi (dest, module, tmpreg));
+ emit_insn (gen_tls_get_addrsi (dest, modreg, tmpreg));
else
- emit_insn (gen_tls_get_addrdi (dest, module, tmpreg));
+ emit_insn (gen_tls_get_addrdi (dest, modreg, tmpreg));
return dest;
}
/* Obtain TLS pointer: 32 bit call or 64 bit GPR 13. */
@@ -22316,23 +22346,24 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
output_addr_const (file, x);
#if HAVE_AS_TLS
- if (TARGET_XCOFF && GET_CODE (base) == SYMBOL_REF)
+ if (TARGET_XCOFF && GET_CODE (base) == SYMBOL_REF
+ && SYMBOL_REF_TLS_MODEL (base) != 0)
{
if (SYMBOL_REF_TLS_MODEL (base) == TLS_MODEL_LOCAL_EXEC)
- fputs ("[TL]@le", file);
+ fputs ("@le", file);
else if (SYMBOL_REF_TLS_MODEL (base) == TLS_MODEL_INITIAL_EXEC)
- fputs ("[TL]@ie", file);
+ fputs ("@ie", file);
/* Use global-dynamic for local-dynamic. */
else if (SYMBOL_REF_TLS_MODEL (base) == TLS_MODEL_GLOBAL_DYNAMIC
|| SYMBOL_REF_TLS_MODEL (base) == TLS_MODEL_LOCAL_DYNAMIC)
{
- fputs ("[TL]\n", file);
+ putc ('\n', file);
(*targetm.asm_out.internal_label) (file, "LCM", labelno);
fputs ("\t.tc .", file);
RS6000_OUTPUT_BASENAME (file, name);
fputs ("[TC],", file);
output_addr_const (file, x);
- fputs ("[TL]@m", file);
+ fputs ("@m", file);
}
}
#endif
@@ -25705,6 +25736,11 @@ rs6000_xcoff_asm_init_sections (void)
rs6000_xcoff_output_tls_section_asm_op,
&xcoff_tls_data_section_name);
+ tls_private_data_section
+ = get_unnamed_section (SECTION_TLS,
+ rs6000_xcoff_output_tls_section_asm_op,
+ &xcoff_private_data_section_name);
+
read_only_private_data_section
= get_unnamed_section (0, rs6000_xcoff_output_readonly_section_asm_op,
&xcoff_private_data_section_name);
@@ -25758,7 +25794,18 @@ rs6000_xcoff_select_section (tree decl, int reloc,
{
#if HAVE_AS_TLS
if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
- return tls_data_section;
+ {
+ if (TREE_PUBLIC (decl))
+ return tls_data_section;
+ else if (bss_initializer_p (decl))
+ {
+ /* Convert to COMMON to emit in BSS. */
+ DECL_COMMON (decl) = 1;
+ return tls_comm_section;
+ }
+ else
+ return tls_private_data_section;
+ }
else
#endif
if (TREE_PUBLIC (decl))
@@ -25857,10 +25904,12 @@ rs6000_xcoff_file_start (void)
main_input_filename, ".bss_");
rs6000_gen_section_name (&xcoff_private_data_section_name,
main_input_filename, ".rw_");
- rs6000_gen_section_name (&xcoff_tls_data_section_name,
- main_input_filename, ".tls_");
rs6000_gen_section_name (&xcoff_read_only_section_name,
main_input_filename, ".ro_");
+ rs6000_gen_section_name (&xcoff_tls_data_section_name,
+ main_input_filename, ".tls_");
+ rs6000_gen_section_name (&xcoff_tbss_section_name,
+ main_input_filename, ".tbss_[UL]");
fputs ("\t.file\t", asm_out_file);
output_quoted_string (asm_out_file, main_input_filename);
@@ -25886,6 +25935,31 @@ rs6000_xcoff_file_end (void)
? "\t.long _section_.text\n" : "\t.llong _section_.text\n",
asm_out_file);
}
+
+#ifdef HAVE_AS_TLS
+static void
+rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
+{
+ rtx symbol;
+ int flags;
+
+ default_encode_section_info (decl, rtl, first);
+
+ /* Careful not to prod global register variables. */
+ if (!MEM_P (rtl))
+ return;
+ symbol = XEXP (rtl, 0);
+ if (GET_CODE (symbol) != SYMBOL_REF)
+ return;
+
+ flags = SYMBOL_REF_FLAGS (symbol);
+
+ if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
+ flags &= ~SYMBOL_FLAG_HAS_BLOCK_INFO;
+
+ SYMBOL_REF_FLAGS (symbol) = flags;
+}
+#endif /* HAVE_AS_TLS */
#endif /* TARGET_XCOFF */
/* Compute a (partial) cost for rtx X. Return true if the complete
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 03ad9280386..0fa3d88c15b 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -10022,6 +10022,7 @@
[(set (reg:P 3)
(unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
(clobber (reg:P 0))
+ (clobber (reg:P 4))
(clobber (reg:P 5))
(clobber (reg:P 11))
(clobber (reg:CC CR0_REGNO))
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index 15f8bbf5e3e..4c12e1f4671 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -98,6 +98,9 @@
#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
#define TARGET_STRIP_NAME_ENCODING rs6000_xcoff_strip_name_encoding
#define TARGET_SECTION_TYPE_FLAGS rs6000_xcoff_section_type_flags
+#ifdef HAVE_AS_TLS
+#define TARGET_ENCODE_SECTION_INFO rs6000_xcoff_encode_section_info
+#endif
/* FP save and restore routines. */
#define SAVE_FP_PREFIX "._savef"
@@ -308,8 +311,8 @@
#define ASM_OUTPUT_TLS_COMMON(FILE, DECL, NAME, SIZE) \
do { fputs(COMMON_ASM_OP, (FILE)); \
RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
- fputs("[UL]", (FILE)); \
- fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)); \
+ fprintf ((FILE), "[UL],"HOST_WIDE_INT_PRINT_UNSIGNED"\n", \
+ (SIZE)); \
} while (0)
#endif
diff --git a/gcc/configure b/gcc/configure
index f4f6593114d..ecdbea403d6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -10321,9 +10321,9 @@ $as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
# We will need to find libiberty.h and ansidecl.h
saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
+CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
saved_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include"
+CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
for ac_func in getenv atol asprintf sbrk abort atof getcwd getwd \
strsignal strstr stpcpy strverscmp \
errno snprintf vsnprintf vasprintf malloc realloc calloc \
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 7abe7cf5b98..447a0ca3056 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1098,9 +1098,9 @@ AM_LANGINFO_CODESET
# We will need to find libiberty.h and ansidecl.h
saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
+CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
saved_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include"
+CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
strsignal strstr stpcpy strverscmp \
errno snprintf vsnprintf vasprintf malloc realloc calloc \
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f6abef63682..f2148f72667 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,24 @@
+2013-01-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/54325
+ * call.c (build_new_method_call_1): Don't use build_value_init for
+ user-provided default constructors.
+
+ * decl.c (check_default_argument): Use LOOKUP_IMPLICIT.
+
+ PR c++/55032
+ PR c++/55245
+ * tree.c (build_cplus_array_type): Copy layout information
+ to main variant if necessary.
+
+2012-12-28 Kai Tietz <ktietz@redhat.com>
+
+ * rtti.c (LONGPTR_T): New helper-macro.
+ (get_pseudo_ti_init): Initialize offset_type by LONGPTR_T
+ type instead of 'long' type.
+ (create_tinfo_types): Use for offset/flags field LONGPTR_T
+ type instead of 'long' type.
+
2012-12-19 Jason Merrill <jason@redhat.com>
PR c++/55724
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index bba5d9fdba5..ad39637c8b7 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7534,6 +7534,9 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
build_special_member_call. */
if (CONSTRUCTOR_NELTS (init_list) == 0
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)
+ /* For a user-provided default constructor, use the normal
+ mechanisms so that protected access works. */
+ && !type_has_user_provided_default_constructor (basetype)
&& !processing_template_decl)
init = build_value_init (basetype, complain);
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 82b2c0a3810..0aecabb380e 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1096,8 +1096,6 @@ add_method (tree type, tree method, tree using_decl)
&& TREE_CODE (method) == FUNCTION_DECL
&& !DECL_EXTERN_C_P (fn)
&& !DECL_EXTERN_C_P (method)
- && (DECL_FUNCTION_SPECIFIC_TARGET (fn)
- || DECL_FUNCTION_SPECIFIC_TARGET (method))
&& targetm.target_option.function_versions (fn, method))
{
/* Mark functions as versions if necessary. Modify the mangled
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 64bd4b5d2c0..52ceefce03b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10829,7 +10829,7 @@ check_default_argument (tree decl, tree arg)
parameter type. */
++cp_unevaluated_operand;
perform_implicit_conversion_flags (decl_type, arg, tf_warning_or_error,
- LOOKUP_NORMAL);
+ LOOKUP_IMPLICIT);
--cp_unevaluated_operand;
if (warn_zero_as_null_pointer_constant
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index b13ec171bbb..de28371c679 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -89,6 +89,12 @@ typedef enum tinfo_kind
/* ... abi::__vmi_type_info<I> */
} tinfo_kind;
+/* Helper macro to get maximum scalar-width of pointer or of the 'long'-type.
+ This of interest for llp64 targets. */
+#define LONGPTR_T \
+ integer_types[(POINTER_SIZE <= TYPE_PRECISION (integer_types[itk_long]) \
+ ? itk_long : itk_long_long)]
+
/* A vector of all tinfo decls that haven't yet been emitted. */
vec<tree, va_gc> *unemitted_tinfo_decls;
@@ -1116,7 +1122,7 @@ get_pseudo_ti_init (tree type, unsigned tk_index)
tree binfo = TYPE_BINFO (type);
int nbases = BINFO_N_BASE_BINFOS (binfo);
vec<tree, va_gc> *base_accesses = BINFO_BASE_ACCESSES (binfo);
- tree offset_type = integer_types[itk_long];
+ tree offset_type = LONGPTR_T;
tree base_inits = NULL_TREE;
int ix;
vec<constructor_elt, va_gc> *init_vec = NULL;
@@ -1420,7 +1426,7 @@ create_tinfo_types (void)
fields = field;
field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, integer_types[itk_long]);
+ FIELD_DECL, NULL_TREE, LONGPTR_T);
DECL_CHAIN (field) = fields;
fields = field;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index c4302371b73..c658582052b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -809,6 +809,15 @@ build_cplus_array_type (tree elt_type, tree index_type)
t = build_array_type (elt_type, index_type);
}
+ /* Push these needs up so that initialization takes place
+ more easily. */
+ bool needs_ctor
+ = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
+ TYPE_NEEDS_CONSTRUCTING (t) = needs_ctor;
+ bool needs_dtor
+ = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = needs_dtor;
+
/* We want TYPE_MAIN_VARIANT of an array to strip cv-quals from the
element type as well, so fix it up if needed. */
if (elt_type != TYPE_MAIN_VARIANT (elt_type))
@@ -818,6 +827,27 @@ build_cplus_array_type (tree elt_type, tree index_type)
if (TYPE_MAIN_VARIANT (t) != m)
{
+ if (COMPLETE_TYPE_P (t) && !COMPLETE_TYPE_P (m))
+ {
+ /* m was built before the element type was complete, so we
+ also need to copy the layout info from t. */
+ tree size = TYPE_SIZE (t);
+ tree size_unit = TYPE_SIZE_UNIT (t);
+ unsigned int align = TYPE_ALIGN (t);
+ unsigned int user_align = TYPE_USER_ALIGN (t);
+ enum machine_mode mode = TYPE_MODE (t);
+ for (tree var = m; var; var = TYPE_NEXT_VARIANT (var))
+ {
+ TYPE_SIZE (var) = size;
+ TYPE_SIZE_UNIT (var) = size_unit;
+ TYPE_ALIGN (var) = align;
+ TYPE_USER_ALIGN (var) = user_align;
+ SET_TYPE_MODE (var, mode);
+ TYPE_NEEDS_CONSTRUCTING (var) = needs_ctor;
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (var) = needs_dtor;
+ }
+ }
+
TYPE_MAIN_VARIANT (t) = m;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
TYPE_NEXT_VARIANT (m) = t;
@@ -828,12 +858,6 @@ build_cplus_array_type (tree elt_type, tree index_type)
if (TYPE_SIZE (t) && EXPR_P (TYPE_SIZE (t)))
TREE_NO_WARNING (TYPE_SIZE (t)) = 1;
- /* Push these needs up so that initialization takes place
- more easily. */
- TYPE_NEEDS_CONSTRUCTING (t)
- = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
- TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
- = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
return t;
}
diff --git a/gcc/cprop.c b/gcc/cprop.c
index ec896a46062..463f81ff73b 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1496,7 +1496,7 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
rtx insn, note;
edge e, edest;
int change;
- int may_be_loop_header;
+ int may_be_loop_header = false;
unsigned removed_p;
unsigned i;
edge_iterator ei;
@@ -1510,27 +1510,22 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
if (note)
find_used_regs (&XEXP (note, 0), NULL);
- /* Determine whether there are more latch edges. Threading through
- a loop header with more than one latch is delicate, see e.g.
- tree-ssa-threadupdate.c:thread_through_loop_header. */
if (current_loops)
{
- may_be_loop_header = bb == bb->loop_father->header;
- if (may_be_loop_header
- && bb->loop_father->latch == NULL)
+ /* If we are to preserve loop structure then do not bypass
+ a loop header. This will either rotate the loop, create
+ multiple entry loops or even irreducible regions. */
+ if (bb == bb->loop_father->header)
return 0;
}
else
{
- unsigned n_back_edges = 0;
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & EDGE_DFS_BACK)
- n_back_edges++;
-
- may_be_loop_header = n_back_edges > 0;
-
- if (n_back_edges > 1)
- return 0;
+ {
+ may_be_loop_header = true;
+ break;
+ }
}
change = 0;
@@ -1619,17 +1614,6 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
&& dest != old_dest
&& dest != EXIT_BLOCK_PTR)
{
- if (current_loops != NULL
- && e->src->loop_father->latch == e->src)
- {
- /* ??? Now we are creating (or may create) a loop
- with multiple entries. Simply mark it for
- removal. Alternatively we could not do this
- threading. */
- e->src->loop_father->header = NULL;
- e->src->loop_father->latch = NULL;
- }
-
redirect_edge_and_branch_force (e, dest);
/* Copy the register setter to the redirected edge.
diff --git a/gcc/doc/contrib.texi b/gcc/doc/contrib.texi
index e4d656d4948..94971ec7ccd 100644
--- a/gcc/doc/contrib.texi
+++ b/gcc/doc/contrib.texi
@@ -623,7 +623,8 @@ entire libstdc++ testsuite namespace-compatible.
@item
Mark Mitchell for his direction via the steering committee, mountains of
C++ work, load/store hoisting out of loops, alias analysis improvements,
-ISO C @code{restrict} support, and serving as release manager for GCC 3.x.
+ISO C @code{restrict} support, and serving as release manager from 2000
+to 2011.
@item
Alan Modra for various GNU/Linux bits and testing.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 75aa8672758..55a103700f6 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9909,6 +9909,11 @@ different target specific attributes, that is, they are compiled for
different target machines.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS (void)
+This target hook returns @code{true} if the target supports function
+multiversioning.
+@end deftypefn
+
@deftypefn {Target Hook} bool TARGET_CAN_INLINE_P (tree @var{caller}, tree @var{callee})
This target hook returns @code{false} if the @var{caller} function
cannot inline @var{callee}, based on target specific information. By
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 95fab189c70..e820f77be45 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -9770,6 +9770,11 @@ different target specific attributes, that is, they are compiled for
different target machines.
@end deftypefn
+@hook TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS
+This target hook returns @code{true} if the target supports function
+multiversioning.
+@end deftypefn
+
@hook TARGET_CAN_INLINE_P
This target hook returns @code{false} if the @var{caller} function
cannot inline @var{callee}, based on target specific information. By
diff --git a/gcc/double-int.h b/gcc/double-int.h
index f4eb6ab0a77..b3f33863287 100644
--- a/gcc/double-int.h
+++ b/gcc/double-int.h
@@ -20,10 +20,6 @@ along with GCC; see the file COPYING3. If not see
#ifndef DOUBLE_INT_H
#define DOUBLE_INT_H
-#ifndef GENERATOR_FILE
-#include <gmp.h>
-#endif
-
/* A large integer is currently represented as a pair of HOST_WIDE_INTs.
It therefore represents a number with precision of
2 * HOST_BITS_PER_WIDE_INT bits (it is however possible that the
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 2887a57b512..7e1d6d7c599 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -265,7 +265,9 @@ dump_loc (int dump_kind, FILE *dfile, source_location loc)
DECL_SOURCE_FILE (current_function_decl),
DECL_SOURCE_LINE (current_function_decl));
else
- fprintf (dfile, "\n%d: ", LOCATION_LINE (loc));
+ fprintf (dfile, "\n%s:%d: note: ",
+ LOCATION_FILE (loc),
+ LOCATION_LINE (loc));
}
}
diff --git a/gcc/expr.c b/gcc/expr.c
index 9d9e5b9abf5..e7b77707de8 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9960,7 +9960,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
&& GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT
&& modifier != EXPAND_CONST_ADDRESS
- && modifier != EXPAND_INITIALIZER)
+ && modifier != EXPAND_INITIALIZER
+ && modifier != EXPAND_MEMORY)
/* If the field is volatile, we always want an aligned
access. Do this in following two situations:
1. the access is not already naturally
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index db7383c57f2..5045220f038 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,56 @@
+2012-12-28 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/55692
+ * check.c (gfc_check_associated): Remove a "gcc_assert (0)".
+
+2012-12-28 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/55763
+ * check.c (gfc_check_move_alloc): Handle unlimited polymorphic.
+ * trans-intrinsic.c (conv_intrinsic_move_alloc): Ditto.
+
+2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/48976
+ * gfortran.h (gfc_inquire struct): Add pointer for inquire stream.
+ * io.c (io_tag): Add tag for inquire stream. (match_inquire_element):
+ Add matcher for new tag. (gfc_resolve_inquire): Resolve new tag.
+ * ioparm.def: Add new parameter for inquire stream.
+ * trans-io.c (gfc_trans_inquire): Add tranlste code for inquire
+ stream.
+
+2012-12-23 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54884
+ * module.c (write_symbol1_recursion): Set attr.public_use.
+ * interface.c (check_sym_interfaces, check_uop_interfaces,
+ gfc_check_interfaces): Remove attr.public_use code.
+ * resolve.c (resolve_function, resolve_variable,
+ resolve_typebound_procedure): Ditto.
+
+2012-12-22 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/55763
+ * module.c (mio_component): Don't skip _hash's initializer.
+ * resolve.c (resolve_select_type): Add an assert.
+ * trans-expr.c (gfc_conv_procedure_call): Handle
+ INTENT(OUT) for UNLIMIT_POLY.
+
+2012-12-21 Richard Biener <rguenther@suse.de>
+
+ PR bootstrap/54659
+ * gfortran.h: Do not include gmp.h here.
+
+2012-12-21 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/55763
+ * match.c (select_type_set_tmp): Return is a derived type or
+ class typespec has no derived type.
+ * resolve.c (resolve_fl_var_and_proc): Exclude select type
+ temporaries from 'pointer'.
+ (resolve_symbol): Exclude select type temporaries from tests
+ for assumed size and assumed rank.
+
2012-12-20 Janus Weil <janus@gcc.gnu.org>
PR fortran/36044
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 793ad75d701..4e8b046439d 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -895,12 +895,10 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr *target)
where = &pointer->where;
- if (pointer->expr_type == EXPR_VARIABLE || pointer->expr_type == EXPR_FUNCTION)
- attr1 = gfc_expr_attr (pointer);
- else if (pointer->expr_type == EXPR_NULL)
+ if (pointer->expr_type == EXPR_NULL)
goto null_arg;
- else
- gcc_assert (0); /* Pointer must be a variable or a function. */
+
+ attr1 = gfc_expr_attr (pointer);
if (!attr1.pointer && !attr1.proc_pointer)
{
@@ -2791,18 +2789,15 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to)
return FAILURE;
}
- if (to->ts.kind != from->ts.kind)
+ /* CLASS arguments: Make sure the vtab of from is present. */
+ if (to->ts.type == BT_CLASS && !UNLIMITED_POLY (from))
{
- gfc_error ("The FROM and TO arguments of the MOVE_ALLOC intrinsic at %L"
- " must be of the same kind %d/%d", &to->where, from->ts.kind,
- to->ts.kind);
- return FAILURE;
+ if (from->ts.type == BT_CLASS || from->ts.type == BT_DERIVED)
+ gfc_find_derived_vtab (from->ts.u.derived);
+ else
+ gfc_find_intrinsic_vtab (&from->ts);
}
- /* CLASS arguments: Make sure the vtab of from is present. */
- if (to->ts.type == BT_CLASS)
- gfc_find_derived_vtab (from->ts.u.derived);
-
return SUCCESS;
}
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index ec0c61f09c9..a419af3ad40 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1699,7 +1699,6 @@ gfc_intrinsic_sym;
EXPR_COMPCALL Function (or subroutine) call of a procedure pointer
component or type-bound procedure. */
-#include <gmp.h>
#include <mpfr.h>
#include <mpc.h>
#define GFC_RND_MODE GMP_RNDN
@@ -2009,7 +2008,8 @@ typedef struct
*name, *access, *sequential, *direct, *form, *formatted,
*unformatted, *recl, *nextrec, *blank, *position, *action, *read,
*write, *readwrite, *delim, *pad, *iolength, *iomsg, *convert, *strm_pos,
- *asynchronous, *decimal, *encoding, *pending, *round, *sign, *size, *id;
+ *asynchronous, *decimal, *encoding, *pending, *round, *sign, *size, *id,
+ *iqstream;
gfc_st_label *err;
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 908db747c04..b587d4ad069 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1582,9 +1582,6 @@ check_sym_interfaces (gfc_symbol *sym)
for (p = sym->generic; p; p = p->next)
{
- if (sym->attr.access != ACCESS_PRIVATE)
- p->sym->attr.public_used = 1;
-
if (p->sym->attr.mod_proc
&& (p->sym->attr.if_source != IFSRC_DECL
|| p->sym->attr.procedure))
@@ -1610,16 +1607,11 @@ check_uop_interfaces (gfc_user_op *uop)
char interface_name[100];
gfc_user_op *uop2;
gfc_namespace *ns;
- gfc_interface *p;
sprintf (interface_name, "operator interface '%s'", uop->name);
if (check_interface0 (uop->op, interface_name))
return;
- if (uop->access != ACCESS_PRIVATE)
- for (p = uop->op; p; p = p->next)
- p->sym->attr.public_used = 1;
-
for (ns = gfc_current_ns; ns; ns = ns->parent)
{
uop2 = gfc_find_uop (uop->name, ns);
@@ -1689,7 +1681,6 @@ void
gfc_check_interfaces (gfc_namespace *ns)
{
gfc_namespace *old_ns, *ns2;
- gfc_interface *p;
char interface_name[100];
int i;
@@ -1714,10 +1705,6 @@ gfc_check_interfaces (gfc_namespace *ns)
if (check_interface0 (ns->op[i], interface_name))
continue;
- for (p = ns->op[i]; p; p = p->next)
- p->sym->attr.public_used = 1;
-
-
if (ns->op[i])
gfc_check_operator_interface (ns->op[i]->sym, (gfc_intrinsic_op) i,
ns->op[i]->where);
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index bd84f1fc48a..7eb52a974d7 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -97,7 +97,8 @@ static const io_tag
tag_eor = {"EOR", " eor =", " %l", BT_UNKNOWN},
tag_id = {"ID", " id =", " %v", BT_INTEGER},
tag_pending = {"PENDING", " pending =", " %v", BT_LOGICAL},
- tag_newunit = {"NEWUNIT", " newunit =", " %v", BT_INTEGER};
+ tag_newunit = {"NEWUNIT", " newunit =", " %v", BT_INTEGER},
+ tag_s_iqstream = {"STREAM", " stream =", " %v", BT_CHARACTER};
static gfc_dt *current_dt;
@@ -3912,6 +3913,7 @@ match_inquire_element (gfc_inquire *inquire)
RETM m = match_out_tag (&tag_strm_out, &inquire->strm_pos);
RETM m = match_vtag (&tag_pending, &inquire->pending);
RETM m = match_vtag (&tag_id, &inquire->id);
+ RETM m = match_vtag (&tag_s_iqstream, &inquire->iqstream);
RETM return MATCH_NO;
}
@@ -4101,6 +4103,7 @@ gfc_resolve_inquire (gfc_inquire *inquire)
INQUIRE_RESOLVE_TAG (&tag_pending, inquire->pending);
INQUIRE_RESOLVE_TAG (&tag_size, inquire->size);
INQUIRE_RESOLVE_TAG (&tag_s_decimal, inquire->decimal);
+ INQUIRE_RESOLVE_TAG (&tag_s_iqstream, inquire->iqstream);
#undef INQUIRE_RESOLVE_TAG
if (gfc_reference_st_label (inquire->err, ST_LABEL_TARGET) == FAILURE)
diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def
index 5ccd869732f..c9c271d886d 100644
--- a/gcc/fortran/ioparm.def
+++ b/gcc/fortran/ioparm.def
@@ -88,6 +88,7 @@ IOPARM (inquire, sign, 1 << 4, char1)
IOPARM (inquire, pending, 1 << 5, pint4)
IOPARM (inquire, size, 1 << 6, pintio)
IOPARM (inquire, id, 1 << 7, pint4)
+IOPARM (inquire, iqstream, 1 << 8, char1)
IOPARM (wait, common, 0, common)
IOPARM (wait, id, 1 << 7, pint4)
#ifndef IOPARM_dt_list_format
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 6322fae6fda..ca8f08c6822 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -5293,6 +5293,9 @@ select_type_set_tmp (gfc_typespec *ts)
if (tmp == NULL)
{
+ if (!ts->u.derived)
+ return;
+
if (ts->type == BT_CLASS)
sprintf (name, "__tmp_class_%s", ts->u.derived->name);
else
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 168f933936a..e19c6d9d71f 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -2603,7 +2603,8 @@ mio_component (gfc_component *c, int vtype)
c->attr.class_ok = 1;
c->attr.access = MIO_NAME (gfc_access) (c->attr.access, access_types);
- if (!vtype || strcmp (c->name, "_final") == 0)
+ if (!vtype || strcmp (c->name, "_final") == 0
+ || strcmp (c->name, "_hash") == 0)
mio_expr (&c->initializer);
if (c->attr.proc_pointer)
@@ -5237,6 +5238,7 @@ write_symbol1_recursion (sorted_pointer_info *sp)
p1->u.wsym.state = WRITTEN;
write_symbol (p1->integer, p1->u.wsym.sym);
+ p1->u.wsym.sym->attr.public_used = 1;
write_symbol1_recursion (sp->right);
}
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 6208a819c13..873400abb39 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -3129,12 +3129,6 @@ resolve_function (gfc_expr *expr)
return FAILURE;
}
- if (sym && specification_expr && sym->attr.function
- && gfc_current_ns->proc_name
- && gfc_current_ns->proc_name->attr.flavor == FL_MODULE)
- sym->attr.public_used = 1;
-
-
/* Switch off assumed size checking and do this again for certain kinds
of procedure, once the procedure itself is resolved. */
need_full_assumed_size++;
@@ -5360,19 +5354,6 @@ resolve_variable (gfc_expr *e)
if (check_assumed_size_reference (sym, e))
return FAILURE;
- /* If a PRIVATE variable is used in the specification expression of the
- result variable, it might be accessed from outside the module and can
- thus not be TREE_PUBLIC() = 0.
- TODO: sym->attr.public_used only has to be set for the result variable's
- type-parameter expression and not for dummies or automatic variables.
- Additionally, it only has to be set if the function is either PUBLIC or
- used in a generic interface or TBP; unfortunately,
- proc_name->attr.public_used can get set at a later stage. */
- if (specification_expr && sym->attr.access == ACCESS_PRIVATE
- && !sym->attr.function && !sym->attr.use_assoc
- && gfc_current_ns->proc_name && gfc_current_ns->proc_name->attr.function)
- sym->attr.public_used = 1;
-
/* Deal with forward references to entries during resolve_code, to
satisfy, at least partially, 12.5.2.5. */
if (gfc_current_ns->entries
@@ -8484,7 +8465,7 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
gfc_expr *e;
ivtab = gfc_find_intrinsic_vtab (&c->ts);
- gcc_assert (ivtab);
+ gcc_assert (ivtab && CLASS_DATA (ivtab)->initializer);
e = CLASS_DATA (ivtab)->initializer;
c->low = c->high = gfc_copy_expr (e);
}
@@ -11056,7 +11037,7 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
}
else
{
- pointer = sym->attr.pointer;
+ pointer = sym->attr.pointer && !sym->attr.select_type_temporary;
allocatable = sym->attr.allocatable;
dimension = sym->attr.dimension;
}
@@ -12146,7 +12127,6 @@ resolve_typebound_procedure (gfc_symtree* stree)
gcc_assert (stree->n.tb->u.specific);
proc = stree->n.tb->u.specific->n.sym;
where = stree->n.tb->where;
- proc->attr.public_used = 1;
/* Default access should already be resolved from the parser. */
gcc_assert (stree->n.tb->access != ACCESS_UNKNOWN);
@@ -13315,7 +13295,7 @@ resolve_symbol (gfc_symbol *sym)
gcc_assert (as->type != AS_IMPLIED_SHAPE);
if (((as->type == AS_ASSUMED_SIZE && !as->cp_was_assumed)
|| as->type == AS_ASSUMED_SHAPE)
- && sym->attr.dummy == 0)
+ && !sym->attr.dummy && !sym->attr.select_type_temporary)
{
if (as->type == AS_ASSUMED_SIZE)
gfc_error ("Assumed size array at %L must be a dummy argument",
@@ -13326,7 +13306,8 @@ resolve_symbol (gfc_symbol *sym)
return;
}
/* TS 29113, C535a. */
- if (as->type == AS_ASSUMED_RANK && !sym->attr.dummy)
+ if (as->type == AS_ASSUMED_RANK && !sym->attr.dummy
+ && !sym->attr.select_type_temporary)
{
gfc_error ("Assumed-rank array at %L must be a dummy argument",
&sym->declared_at);
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index ad266845ae7..452f2bcf974 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -4302,7 +4302,14 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
null_pointer_node);
gfc_add_expr_to_block (&block, tmp);
- if (fsym->ts.type == BT_CLASS)
+ if (fsym->ts.type == BT_CLASS && UNLIMITED_POLY (fsym))
+ {
+ gfc_add_modify (&block, ptr,
+ fold_convert (TREE_TYPE (ptr),
+ null_pointer_node));
+ gfc_add_expr_to_block (&block, tmp);
+ }
+ else if (fsym->ts.type == BT_CLASS)
{
gfc_symbol *vtab;
vtab = gfc_find_derived_vtab (fsym->ts.u.derived);
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index b9d13ccaecd..5a89be1a98d 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -7373,8 +7373,13 @@ conv_intrinsic_move_alloc (gfc_code *code)
if (from_expr->ts.type == BT_CLASS)
{
- vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
- gcc_assert (vtab);
+ if (UNLIMITED_POLY (from_expr))
+ vtab = NULL;
+ else
+ {
+ vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
+ gcc_assert (vtab);
+ }
gfc_free_expr (from_expr2);
gfc_init_se (&from_se, NULL);
@@ -7386,13 +7391,23 @@ conv_intrinsic_move_alloc (gfc_code *code)
from_se.expr));
/* Reset _vptr component to declared type. */
- tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
- gfc_add_modify_loc (input_location, &block, from_se.expr,
- fold_convert (TREE_TYPE (from_se.expr), tmp));
+ if (UNLIMITED_POLY (from_expr))
+ gfc_add_modify_loc (input_location, &block, from_se.expr,
+ fold_convert (TREE_TYPE (from_se.expr),
+ null_pointer_node));
+ else
+ {
+ tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
+ gfc_add_modify_loc (input_location, &block, from_se.expr,
+ fold_convert (TREE_TYPE (from_se.expr), tmp));
+ }
}
else
{
- vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
+ if (from_expr->ts.type != BT_DERIVED)
+ vtab = gfc_find_intrinsic_vtab (&from_expr->ts);
+ else
+ vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
gcc_assert (vtab);
tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
gfc_add_modify_loc (input_location, &block, to_se.expr,
@@ -7415,8 +7430,13 @@ conv_intrinsic_move_alloc (gfc_code *code)
if (from_expr->ts.type == BT_CLASS)
{
- vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
- gcc_assert (vtab);
+ if (UNLIMITED_POLY (from_expr))
+ vtab = NULL;
+ else
+ {
+ vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
+ gcc_assert (vtab);
+ }
from_se.want_pointer = 1;
from_expr2 = gfc_copy_expr (from_expr);
@@ -7427,13 +7447,23 @@ conv_intrinsic_move_alloc (gfc_code *code)
from_se.expr));
/* Reset _vptr component to declared type. */
- tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
- gfc_add_modify_loc (input_location, &block, from_se.expr,
- fold_convert (TREE_TYPE (from_se.expr), tmp));
+ if (UNLIMITED_POLY (from_expr))
+ gfc_add_modify_loc (input_location, &block, from_se.expr,
+ fold_convert (TREE_TYPE (from_se.expr),
+ null_pointer_node));
+ else
+ {
+ tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
+ gfc_add_modify_loc (input_location, &block, from_se.expr,
+ fold_convert (TREE_TYPE (from_se.expr), tmp));
+ }
}
else
{
- vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
+ if (from_expr->ts.type != BT_DERIVED)
+ vtab = gfc_find_intrinsic_vtab (&from_expr->ts);
+ else
+ vtab = gfc_find_derived_vtab (from_expr->ts.u.derived);
gcc_assert (vtab);
tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab));
gfc_add_modify_loc (input_location, &block, to_se.expr,
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 940129eb05f..921edd042ea 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -1364,6 +1364,9 @@ gfc_trans_inquire (gfc_code * code)
if (p->id)
mask2 |= set_parameter_ref (&block, &post_block,var, IOPARM_inquire_id,
p->id);
+ if (p->iqstream)
+ mask2 |= set_string (&block, &post_block, var, IOPARM_inquire_iqstream,
+ p->iqstream);
if (mask2)
mask |= set_parameter_const (&block, var, IOPARM_inquire_flags2, mask2);
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 477e6ed32f7..6d6b14b1109 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-21 Ian Lance Taylor <iant@google.com>
+
+ PR bootstrap/54659
+ * go-system.h: Don't include <cstdio>.
+
2012-12-18 Ian Lance Taylor <iant@google.com>
PR go/55201
diff --git a/gcc/go/go-system.h b/gcc/go/go-system.h
index 2decc555df5..85160cd4910 100644
--- a/gcc/go/go-system.h
+++ b/gcc/go/go-system.h
@@ -125,15 +125,6 @@ struct hash<T*>
// system.h.
#include <iostream>
-// Some versions of gmp.h assume that #include <iostream> will define
-// std::FILE. This is not true with libstdc++ 4.3 and later. This is
-// fixed in GMP 4.3, but at this point we don't know which version of
-// GMP is in use. Since the top level configure script accepts GMP
-// 4.2, at least for now we #include <cstdio> to ensure that GMP 4.2
-// will work. FIXME: This can be removed when we require GMP 4.3 or
-// later.
-#include <cstdio>
-
#include "system.h"
#include "ansidecl.h"
#include "coretypes.h"
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index f10627295b8..9abd2247f37 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -8,8 +8,6 @@
#include <algorithm>
-#include <gmp.h>
-
#include "toplev.h"
#include "intl.h"
#include "tree.h"
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index 66e05a7bcfd..152c2232454 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -7,7 +7,6 @@
#ifndef GO_EXPRESSIONS_H
#define GO_EXPRESSIONS_H
-#include <gmp.h>
#include <mpfr.h>
#include "operator.h"
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc
index 7159dfb6244..2ffc5085be8 100644
--- a/gcc/go/gofrontend/gogo-tree.cc
+++ b/gcc/go/gofrontend/gogo-tree.cc
@@ -6,8 +6,6 @@
#include "go-system.h"
-#include <gmp.h>
-
#include "toplev.h"
#include "tree.h"
#include "gimple.h"
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 41f9665e724..735b4c81204 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -29,6 +29,7 @@ Gogo::Gogo(Backend* backend, Linemap* linemap, int, int pointer_size)
package_(NULL),
functions_(),
globals_(new Bindings(NULL)),
+ file_block_names_(),
imports_(),
imported_unsafe_(false),
packages_(),
@@ -1243,6 +1244,33 @@ Gogo::define_global_names()
else if (no->is_unknown())
no->unknown_value()->set_real_named_object(global_no);
}
+
+ // Give an error if any name is defined in both the package block
+ // and the file block. For example, this can happen if one file
+ // imports "fmt" and another file defines a global variable fmt.
+ for (Bindings::const_declarations_iterator p =
+ this->package_->bindings()->begin_declarations();
+ p != this->package_->bindings()->end_declarations();
+ ++p)
+ {
+ if (p->second->is_unknown()
+ && p->second->unknown_value()->real_named_object() == NULL)
+ {
+ // No point in warning about an undefined name, as we will
+ // get other errors later anyhow.
+ continue;
+ }
+ File_block_names::const_iterator pf =
+ this->file_block_names_.find(p->second->name());
+ if (pf != this->file_block_names_.end())
+ {
+ std::string n = p->second->message_name();
+ error_at(p->second->location(),
+ "%qs defined as both imported name and global name",
+ n.c_str());
+ inform(pf->second, "%qs imported here", n.c_str());
+ }
+ }
}
// Clear out names in file scope.
@@ -1250,7 +1278,7 @@ Gogo::define_global_names()
void
Gogo::clear_file_scope()
{
- this->package_->bindings()->clear_file_scope();
+ this->package_->bindings()->clear_file_scope(this);
// Warn about packages which were imported but not used.
bool quiet = saw_errors();
@@ -4855,7 +4883,7 @@ Bindings::Bindings(Bindings* enclosing)
// Clear imports.
void
-Bindings::clear_file_scope()
+Bindings::clear_file_scope(Gogo* gogo)
{
Contour::iterator p = this->bindings_.begin();
while (p != this->bindings_.end())
@@ -4875,7 +4903,10 @@ Bindings::clear_file_scope()
if (keep)
++p;
else
- p = this->bindings_.erase(p);
+ {
+ gogo->add_file_block_name(p->second->name(), p->second->location());
+ p = this->bindings_.erase(p);
+ }
}
}
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index cffdd219118..f96ffcdfdb9 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -377,6 +377,11 @@ class Gogo
void
add_named_object(Named_object*);
+ // Add an identifier to the list of names seen in the file block.
+ void
+ add_file_block_name(const std::string& name, Location location)
+ { this->file_block_names_[name] = location; }
+
// Mark all local variables in current bindings as used. This is
// used when there is a parse error to avoid useless errors.
void
@@ -678,6 +683,10 @@ class Gogo
// This is used for initialization dependency analysis.
typedef std::map<Variable*, Named_object*> Var_deps;
+ // Type used to map identifiers in the file block to the location
+ // where they were defined.
+ typedef Unordered_map(std::string, Location) File_block_names;
+
// Type used to queue writing a type specific function.
struct Specific_type_function
{
@@ -710,6 +719,8 @@ class Gogo
// The global binding contour. This includes the builtin functions
// and the package we are compiling.
Bindings* globals_;
+ // The list of names we have seen in the file block.
+ File_block_names file_block_names_;
// Mapping from import file names to packages.
Imports imports_;
// Whether the magic unsafe package was imported.
@@ -2265,7 +2276,7 @@ class Bindings
// Clear all names in file scope from the bindings.
void
- clear_file_scope();
+ clear_file_scope(Gogo*);
// Look up a name in this binding contour and in any enclosing
// binding contours. This returns NULL if the name is not found.
diff --git a/gcc/go/gofrontend/lex.h b/gcc/go/gofrontend/lex.h
index fc9258b880a..383a9178780 100644
--- a/gcc/go/gofrontend/lex.h
+++ b/gcc/go/gofrontend/lex.h
@@ -7,7 +7,6 @@
#ifndef GO_LEX_H
#define GO_LEX_H
-#include <gmp.h>
#include <mpfr.h>
#include "operator.h"
diff --git a/gcc/go/gofrontend/runtime.cc b/gcc/go/gofrontend/runtime.cc
index 059263db44e..ecc508d0dcc 100644
--- a/gcc/go/gofrontend/runtime.cc
+++ b/gcc/go/gofrontend/runtime.cc
@@ -6,8 +6,6 @@
#include "go-system.h"
-#include <gmp.h>
-
#include "gogo.h"
#include "types.h"
#include "expressions.h"
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index fb1322f42f3..7870dad729e 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -6,8 +6,6 @@
#include "go-system.h"
-#include <gmp.h>
-
#include "go-c.h"
#include "types.h"
#include "expressions.h"
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 44d6a61f8e6..c0aeb91acff 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -6,8 +6,6 @@
#include "go-system.h"
-#include <gmp.h>
-
#include "toplev.h"
#include "intl.h"
#include "tree.h"
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 8f5b1f2641c..3e03b31d17d 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -1,5 +1,5 @@
/* Inlining decision heuristics.
- Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011, 2012, 2013
Free Software Foundation, Inc.
Contributed by Jan Hubicka
@@ -127,8 +127,7 @@ static void inline_node_duplication_hook (struct cgraph_node *,
struct cgraph_node *, void *);
static void inline_edge_removal_hook (struct cgraph_edge *, void *);
static void inline_edge_duplication_hook (struct cgraph_edge *,
- struct cgraph_edge *,
- void *);
+ struct cgraph_edge *, void *);
/* VECtor holding inline summaries.
In GGC memory because conditions might point to constant trees. */
@@ -200,6 +199,7 @@ false_predicate_p (struct predicate *p)
/* Return predicate that is set true when function is not inlined. */
+
static inline struct predicate
not_inlined_predicate (void)
{
@@ -254,7 +254,7 @@ add_condition (struct inline_summary *summary, int operand_num,
&& c->val == val
&& c->agg_contents == agg_contents
&& (!agg_contents || (c->offset == offset && c->by_ref == by_ref)))
- return single_cond_predicate (i + predicate_first_dynamic_condition);
+ return single_cond_predicate (i + predicate_first_dynamic_condition);
}
/* Too many conditions. Give up and return constant true. */
if (i == NUM_CONDITIONS - predicate_first_dynamic_condition)
@@ -321,7 +321,7 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause)
insert_here = i2;
/* If clause implies p->clause[i], then p->clause[i] becomes redundant.
- Otherwise the p->clause[i] has to stay. */
+ Otherwise the p->clause[i] has to stay. */
if ((p->clause[i] & clause) != clause)
i2++;
}
@@ -335,26 +335,27 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause)
continue;
cc1 = &(*conditions)[c1 - predicate_first_dynamic_condition];
/* We have no way to represent !CHANGED and !IS_NOT_CONSTANT
- and thus there is no point for looking for them. */
- if (cc1->code == CHANGED
- || cc1->code == IS_NOT_CONSTANT)
+ and thus there is no point for looking for them. */
+ if (cc1->code == CHANGED || cc1->code == IS_NOT_CONSTANT)
continue;
for (c2 = c1 + 1; c2 <= NUM_CONDITIONS; c2++)
if (clause & (1 << c2))
{
- condition *cc1 = &(*conditions)[c1 - predicate_first_dynamic_condition];
- condition *cc2 = &(*conditions)[c2 - predicate_first_dynamic_condition];
+ condition *cc1 =
+ &(*conditions)[c1 - predicate_first_dynamic_condition];
+ condition *cc2 =
+ &(*conditions)[c2 - predicate_first_dynamic_condition];
if (cc1->operand_num == cc2->operand_num
&& cc1->val == cc2->val
&& cc2->code != IS_NOT_CONSTANT
&& cc2->code != CHANGED
- && cc1->code == invert_tree_comparison
- (cc2->code,
- HONOR_NANS (TYPE_MODE (TREE_TYPE (cc1->val)))))
+ && cc1->code == invert_tree_comparison
+ (cc2->code,
+ HONOR_NANS (TYPE_MODE (TREE_TYPE (cc1->val)))))
return;
}
}
-
+
/* We run out of variants. Be conservative in positive direction. */
if (i2 == MAX_CLAUSES)
@@ -362,7 +363,7 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause)
/* Keep clauses in decreasing order. This makes equivalence testing easy. */
p->clause[i2 + 1] = 0;
if (insert_here >= 0)
- for (;i2 > insert_here; i2--)
+ for (; i2 > insert_here; i2--)
p->clause[i2] = p->clause[i2 - 1];
else
insert_here = i2;
@@ -390,7 +391,7 @@ and_predicates (conditions conditions,
{
gcc_checking_assert (i < MAX_CLAUSES);
}
-
+
/* Combine the predicates rest. */
for (; p2->clause[i]; i++)
{
@@ -410,11 +411,11 @@ predicates_equal_p (struct predicate *p, struct predicate *p2)
for (i = 0; p->clause[i]; i++)
{
gcc_checking_assert (i < MAX_CLAUSES);
- gcc_checking_assert (p->clause [i] > p->clause[i + 1]);
+ gcc_checking_assert (p->clause[i] > p->clause[i + 1]);
gcc_checking_assert (!p2->clause[i]
- || p2->clause [i] > p2->clause[i + 1]);
+ || p2->clause[i] > p2->clause[i + 1]);
if (p->clause[i] != p2->clause[i])
- return false;
+ return false;
}
return !p2->clause[i];
}
@@ -423,10 +424,11 @@ predicates_equal_p (struct predicate *p, struct predicate *p2)
/* Return P | P2. */
static struct predicate
-or_predicates (conditions conditions, struct predicate *p, struct predicate *p2)
+or_predicates (conditions conditions,
+ struct predicate *p, struct predicate *p2)
{
struct predicate out = true_predicate ();
- int i,j;
+ int i, j;
/* Avoid busy work. */
if (false_predicate_p (p2) || true_predicate_p (p))
@@ -440,8 +442,8 @@ or_predicates (conditions conditions, struct predicate *p, struct predicate *p2)
for (i = 0; p->clause[i]; i++)
for (j = 0; p2->clause[j]; j++)
{
- gcc_checking_assert (i < MAX_CLAUSES && j < MAX_CLAUSES);
- add_clause (conditions, &out, p->clause[i] | p2->clause[j]);
+ gcc_checking_assert (i < MAX_CLAUSES && j < MAX_CLAUSES);
+ add_clause (conditions, &out, p->clause[i] | p2->clause[j]);
}
return out;
}
@@ -466,7 +468,7 @@ evaluate_predicate (struct predicate *p, clause_t possible_truths)
{
gcc_checking_assert (i < MAX_CLAUSES);
if (!(p->clause[i] & possible_truths))
- return false;
+ return false;
}
return true;
}
@@ -508,23 +510,25 @@ predicate_probability (conditions conds,
{
if (i2 >= predicate_first_dynamic_condition)
{
- condition *c = &(*conds)[i2 - predicate_first_dynamic_condition];
+ condition *c =
+ &(*conds)[i2 - predicate_first_dynamic_condition];
if (c->code == CHANGED
- && (c->operand_num
- < (int) inline_param_summary.length ()))
+ && (c->operand_num <
+ (int) inline_param_summary.length ()))
{
- int iprob = inline_param_summary[c->operand_num].change_prob;
+ int iprob =
+ inline_param_summary[c->operand_num].change_prob;
this_prob = MAX (this_prob, iprob);
}
else
this_prob = REG_BR_PROB_BASE;
- }
- else
- this_prob = REG_BR_PROB_BASE;
+ }
+ else
+ this_prob = REG_BR_PROB_BASE;
}
combined_prob = MIN (this_prob, combined_prob);
if (!combined_prob)
- return 0;
+ return 0;
}
}
return combined_prob;
@@ -580,7 +584,7 @@ dump_clause (FILE *f, conditions conds, clause_t clause)
if (found)
fprintf (f, " || ");
found = true;
- dump_condition (f, conds, i);
+ dump_condition (f, conds, i);
}
fprintf (f, ")");
}
@@ -599,7 +603,7 @@ dump_predicate (FILE *f, conditions conds, struct predicate *pred)
{
if (i)
fprintf (f, " && ");
- dump_clause (f, conds, pred->clause[i]);
+ dump_clause (f, conds, pred->clause[i]);
}
fprintf (f, "\n");
}
@@ -683,7 +687,7 @@ account_size_time (struct inline_summary *summary, int size, int time,
if (predicates_equal_p (&e->predicate, pred))
{
found = true;
- break;
+ break;
}
if (i == 256)
{
@@ -692,14 +696,16 @@ account_size_time (struct inline_summary *summary, int size, int time,
e = &(*summary->entry)[0];
gcc_assert (!e->predicate.clause[0]);
if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\t\tReached limit on number of entries, ignoring the predicate.");
+ fprintf (dump_file,
+ "\t\tReached limit on number of entries, "
+ "ignoring the predicate.");
}
if (dump_file && (dump_flags & TDF_DETAILS) && (time || size))
{
- fprintf (dump_file, "\t\tAccounting size:%3.2f, time:%3.2f on %spredicate:",
- ((double)size) / INLINE_SIZE_SCALE,
- ((double)time) / INLINE_TIME_SCALE,
- found ? "" : "new ");
+ fprintf (dump_file,
+ "\t\tAccounting size:%3.2f, time:%3.2f on %spredicate:",
+ ((double) size) / INLINE_SIZE_SCALE,
+ ((double) time) / INLINE_TIME_SCALE, found ? "" : "new ");
dump_predicate (dump_file, summary->conds, pred);
}
if (!found)
@@ -728,13 +734,13 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate)
if (predicate && !true_predicate_p (predicate))
{
if (!es->predicate)
- es->predicate = (struct predicate *)pool_alloc (edge_predicate_pool);
+ es->predicate = (struct predicate *) pool_alloc (edge_predicate_pool);
*es->predicate = *predicate;
}
else
{
if (es->predicate)
- pool_free (edge_predicate_pool, es->predicate);
+ pool_free (edge_predicate_pool, es->predicate);
es->predicate = NULL;
}
}
@@ -744,8 +750,7 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate)
static void
set_hint_predicate (struct predicate **p, struct predicate new_predicate)
{
- if (false_predicate_p (&new_predicate)
- || true_predicate_p (&new_predicate))
+ if (false_predicate_p (&new_predicate) || true_predicate_p (&new_predicate))
{
if (*p)
pool_free (edge_predicate_pool, *p);
@@ -754,7 +759,7 @@ set_hint_predicate (struct predicate **p, struct predicate new_predicate)
else
{
if (!*p)
- *p = (struct predicate *)pool_alloc (edge_predicate_pool);
+ *p = (struct predicate *) pool_alloc (edge_predicate_pool);
**p = new_predicate;
}
}
@@ -769,9 +774,10 @@ set_hint_predicate (struct predicate **p, struct predicate new_predicate)
static clause_t
evaluate_conditions_for_known_args (struct cgraph_node *node,
- bool inline_p,
- vec<tree> known_vals,
- vec<ipa_agg_jump_function_p> known_aggs)
+ bool inline_p,
+ vec<tree> known_vals,
+ vec<ipa_agg_jump_function_p>
+ known_aggs)
{
clause_t clause = inline_p ? 0 : 1 << predicate_not_inlined_condition;
struct inline_summary *info = inline_summary (node);
@@ -784,9 +790,9 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
tree res;
/* We allow call stmt to have fewer arguments than the callee function
- (especially for K&R style programs). So bound check here (we assume
- known_aggs vector, if non-NULL, has the same length as
- known_vals). */
+ (especially for K&R style programs). So bound check here (we assume
+ known_aggs vector, if non-NULL, has the same length as
+ known_vals). */
gcc_checking_assert (!known_aggs.exists ()
|| (known_vals.length () == known_aggs.length ()));
if (c->operand_num >= (int) known_vals.length ())
@@ -801,8 +807,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
if (c->code == CHANGED
&& !c->by_ref
- && (known_vals[c->operand_num]
- == error_mark_node))
+ && (known_vals[c->operand_num] == error_mark_node))
continue;
if (known_aggs.exists ())
@@ -828,8 +833,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
if (c->code == IS_NOT_CONSTANT || c->code == CHANGED)
continue;
res = fold_binary_to_constant (c->code, boolean_type_node, val, c->val);
- if (res
- && integer_zerop (res))
+ if (res && integer_zerop (res))
continue;
clause |= 1 << (i + predicate_first_dynamic_condition);
}
@@ -841,12 +845,13 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
static void
evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
- clause_t *clause_ptr,
- vec<tree> *known_vals_ptr,
- vec<tree> *known_binfos_ptr,
- vec<ipa_agg_jump_function_p> *known_aggs_ptr)
+ clause_t *clause_ptr,
+ vec<tree> *known_vals_ptr,
+ vec<tree> *known_binfos_ptr,
+ vec<ipa_agg_jump_function_p> *known_aggs_ptr)
{
- struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL);
+ struct cgraph_node *callee =
+ cgraph_function_or_thunk_node (e->callee, NULL);
struct inline_summary *info = inline_summary (callee);
vec<tree> known_vals = vNULL;
vec<ipa_agg_jump_function_p> known_aggs = vNULL;
@@ -860,8 +865,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
if (ipa_node_params_vector.exists ()
&& !e->call_stmt_cannot_inline_p
- && ((clause_ptr && info->conds)
- || known_vals_ptr || known_binfos_ptr))
+ && ((clause_ptr && info->conds) || known_vals_ptr || known_binfos_ptr))
{
struct ipa_node_params *parms_info;
struct ipa_edge_args *args = IPA_EDGE_REF (e);
@@ -869,9 +873,9 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
int i, count = ipa_get_cs_argument_count (args);
if (e->caller->global.inlined_to)
- parms_info = IPA_NODE_REF (e->caller->global.inlined_to);
+ parms_info = IPA_NODE_REF (e->caller->global.inlined_to);
else
- parms_info = IPA_NODE_REF (e->caller);
+ parms_info = IPA_NODE_REF (e->caller);
if (count && (info->conds || known_vals_ptr))
known_vals.safe_grow_cleared (count);
@@ -888,7 +892,8 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
{
if (known_vals.exists () && TREE_CODE (cst) != TREE_BINFO)
known_vals[i] = cst;
- else if (known_binfos_ptr != NULL && TREE_CODE (cst) == TREE_BINFO)
+ else if (known_binfos_ptr != NULL
+ && TREE_CODE (cst) == TREE_BINFO)
(*known_binfos_ptr)[i] = cst;
}
else if (inline_p && !es->param[i].change_prob)
@@ -940,8 +945,7 @@ inline_summary_alloc (void)
inline_edge_summary_vec.safe_grow_cleared (cgraph_edge_max_uid + 1);
if (!edge_predicate_pool)
edge_predicate_pool = create_alloc_pool ("edge predicates",
- sizeof (struct predicate),
- 10);
+ sizeof (struct predicate), 10);
}
/* We are called multiple time for given function; clear
@@ -950,7 +954,7 @@ inline_summary_alloc (void)
static void
reset_inline_edge_summary (struct cgraph_edge *e)
{
- if (e->uid < (int)inline_edge_summary_vec.length ())
+ if (e->uid < (int) inline_edge_summary_vec.length ())
{
struct inline_edge_summary *es = inline_edge_summary (e);
@@ -1005,10 +1009,11 @@ reset_inline_summary (struct cgraph_node *node)
/* Hook that is called by cgraph.c when a node is removed. */
static void
-inline_node_removal_hook (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
+inline_node_removal_hook (struct cgraph_node *node,
+ void *data ATTRIBUTE_UNUSED)
{
struct inline_summary *info;
- if (vec_safe_length (inline_summary_vec) <= (unsigned)node->uid)
+ if (vec_safe_length (inline_summary_vec) <= (unsigned) node->uid)
return;
info = inline_summary (node);
reset_inline_summary (node);
@@ -1054,8 +1059,7 @@ remap_hint_predicate_after_duplication (struct predicate **p,
return;
new_predicate = remap_predicate_after_duplication (*p,
- possible_truths,
- info);
+ possible_truths, info);
/* We do not want to free previous predicate; it is used by node origin. */
*p = NULL;
set_hint_predicate (p, new_predicate);
@@ -1065,29 +1069,28 @@ remap_hint_predicate_after_duplication (struct predicate **p,
/* Hook that is called by cgraph.c when a node is duplicated. */
static void
-inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
+inline_node_duplication_hook (struct cgraph_node *src,
+ struct cgraph_node *dst,
ATTRIBUTE_UNUSED void *data)
{
struct inline_summary *info;
inline_summary_alloc ();
info = inline_summary (dst);
- memcpy (info, inline_summary (src),
- sizeof (struct inline_summary));
+ memcpy (info, inline_summary (src), sizeof (struct inline_summary));
/* TODO: as an optimization, we may avoid copying conditions
that are known to be false or true. */
info->conds = vec_safe_copy (info->conds);
/* When there are any replacements in the function body, see if we can figure
out that something was optimized out. */
- if (ipa_node_params_vector.exists ()
- && dst->clone.tree_map)
+ if (ipa_node_params_vector.exists () && dst->clone.tree_map)
{
vec<size_time_entry, va_gc> *entry = info->entry;
/* Use SRC parm info since it may not be copied yet. */
struct ipa_node_params *parms_info = IPA_NODE_REF (src);
vec<tree> known_vals = vNULL;
int count = ipa_get_param_count (parms_info);
- int i,j;
+ int i, j;
clause_t possible_truths;
struct predicate true_pred = true_predicate ();
size_time_entry *e;
@@ -1098,15 +1101,13 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
info->entry = 0;
known_vals.safe_grow_cleared (count);
for (i = 0; i < count; i++)
- {
+ {
tree t = ipa_get_param (parms_info, i);
struct ipa_replace_map *r;
for (j = 0; vec_safe_iterate (dst->clone.tree_map, j, &r); j++)
{
- if (r->old_tree == t
- && r->replace_p
- && !r->ref_p)
+ if (r->old_tree == t && r->replace_p && !r->ref_p)
{
known_vals[i] = r->new_tree;
break;
@@ -1114,16 +1115,17 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
}
}
possible_truths = evaluate_conditions_for_known_args (dst, false,
- known_vals, vNULL);
+ known_vals,
+ vNULL);
known_vals.release ();
account_size_time (info, 0, 0, &true_pred);
/* Remap size_time vectors.
- Simplify the predicate by prunning out alternatives that are known
- to be false.
- TODO: as on optimization, we can also eliminate conditions known
- to be true. */
+ Simplify the predicate by prunning out alternatives that are known
+ to be false.
+ TODO: as on optimization, we can also eliminate conditions known
+ to be true. */
for (i = 0; vec_safe_iterate (entry, i, &e); i++)
{
struct predicate new_predicate;
@@ -1137,7 +1139,7 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
}
/* Remap edge predicates with the same simplification as above.
- Also copy constantness arrays. */
+ Also copy constantness arrays. */
for (edge = dst->callees; edge; edge = edge->next_callee)
{
struct predicate new_predicate;
@@ -1160,7 +1162,7 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
}
/* Remap indirect edge predicates with the same simplificaiton as above.
- Also copy constantness arrays. */
+ Also copy constantness arrays. */
for (edge = dst->indirect_calls; edge; edge = edge->next_callee)
{
struct predicate new_predicate;
@@ -1181,21 +1183,17 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
edge_set_predicate (edge, &new_predicate);
}
remap_hint_predicate_after_duplication (&info->loop_iterations,
- possible_truths,
- info);
+ possible_truths, info);
remap_hint_predicate_after_duplication (&info->loop_stride,
- possible_truths,
- info);
+ possible_truths, info);
remap_hint_predicate_after_duplication (&info->array_index,
- possible_truths,
- info);
+ possible_truths, info);
/* If inliner or someone after inliner will ever start producing
- non-trivial clones, we will get trouble with lack of information
- about updating self sizes, because size vectors already contains
- sizes of the calees. */
- gcc_assert (!inlined_to_p
- || !optimized_out_size);
+ non-trivial clones, we will get trouble with lack of information
+ about updating self sizes, because size vectors already contains
+ sizes of the calees. */
+ gcc_assert (!inlined_to_p || !optimized_out_size);
}
else
{
@@ -1226,7 +1224,8 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
/* Hook that is called by cgraph.c when a node is duplicated. */
static void
-inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
+inline_edge_duplication_hook (struct cgraph_edge *src,
+ struct cgraph_edge *dst,
ATTRIBUTE_UNUSED void *data)
{
struct inline_edge_summary *info;
@@ -1234,8 +1233,7 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
inline_summary_alloc ();
info = inline_edge_summary (dst);
srcinfo = inline_edge_summary (src);
- memcpy (info, srcinfo,
- sizeof (struct inline_edge_summary));
+ memcpy (info, srcinfo, sizeof (struct inline_edge_summary));
info->predicate = NULL;
edge_set_predicate (dst, srcinfo->predicate);
info->param = srcinfo->param.copy ();
@@ -1245,7 +1243,8 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
/* Keep edge cache consistent across edge removal. */
static void
-inline_edge_removal_hook (struct cgraph_edge *edge, void *data ATTRIBUTE_UNUSED)
+inline_edge_removal_hook (struct cgraph_edge *edge,
+ void *data ATTRIBUTE_UNUSED)
{
if (edge_growth_cache.exists ())
reset_edge_growth_cache (edge);
@@ -1279,28 +1278,27 @@ free_growth_caches (void)
Indent by INDENT. */
static void
-dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
+dump_inline_edge_summary (FILE *f, int indent, struct cgraph_node *node,
struct inline_summary *info)
{
struct cgraph_edge *edge;
for (edge = node->callees; edge; edge = edge->next_callee)
{
struct inline_edge_summary *es = inline_edge_summary (edge);
- struct cgraph_node *callee = cgraph_function_or_thunk_node (edge->callee, NULL);
+ struct cgraph_node *callee =
+ cgraph_function_or_thunk_node (edge->callee, NULL);
int i;
- fprintf (f, "%*s%s/%i %s\n%*s loop depth:%2i freq:%4i size:%2i time: %2i callee size:%2i stack:%2i",
- indent, "", cgraph_node_name (callee),
- callee->uid,
- !edge->inline_failed ? "inlined"
- : cgraph_inline_failed_string (edge->inline_failed),
- indent, "",
- es->loop_depth,
- edge->frequency,
- es->call_stmt_size,
- es->call_stmt_time,
- (int)inline_summary (callee)->size / INLINE_SIZE_SCALE,
- (int)inline_summary (callee)->estimated_stack_size);
+ fprintf (f,
+ "%*s%s/%i %s\n%*s loop depth:%2i freq:%4i size:%2i"
+ " time: %2i callee size:%2i stack:%2i",
+ indent, "", cgraph_node_name (callee), callee->uid,
+ !edge->inline_failed
+ ? "inlined" : cgraph_inline_failed_string (edge-> inline_failed),
+ indent, "", es->loop_depth, edge->frequency,
+ es->call_stmt_size, es->call_stmt_time,
+ (int) inline_summary (callee)->size / INLINE_SIZE_SCALE,
+ (int) inline_summary (callee)->estimated_stack_size);
if (es->predicate)
{
@@ -1308,9 +1306,9 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
dump_predicate (f, info->conds, es->predicate);
}
else
- fprintf (f, "\n");
+ fprintf (f, "\n");
if (es->param.exists ())
- for (i = 0; i < (int)es->param.length (); i++)
+ for (i = 0; i < (int) es->param.length (); i++)
{
int prob = es->param[i].change_prob;
@@ -1323,13 +1321,13 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
}
if (!edge->inline_failed)
{
- fprintf (f, "%*sStack frame offset %i, callee self size %i,"
+ fprintf (f, "%*sStack frame offset %i, callee self size %i,"
" callee size %i\n",
- indent+2, "",
- (int)inline_summary (callee)->stack_frame_offset,
- (int)inline_summary (callee)->estimated_self_stack_size,
- (int)inline_summary (callee)->estimated_stack_size);
- dump_inline_edge_summary (f, indent+2, callee, info);
+ indent + 2, "",
+ (int) inline_summary (callee)->stack_frame_offset,
+ (int) inline_summary (callee)->estimated_self_stack_size,
+ (int) inline_summary (callee)->estimated_stack_size);
+ dump_inline_edge_summary (f, indent + 2, callee, info);
}
}
for (edge = node->indirect_calls; edge; edge = edge->next_callee)
@@ -1338,10 +1336,8 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
fprintf (f, "%*sindirect call loop depth:%2i freq:%4i size:%2i"
" time: %2i",
indent, "",
- es->loop_depth,
- edge->frequency,
- es->call_stmt_size,
- es->call_stmt_time);
+ es->loop_depth,
+ edge->frequency, es->call_stmt_size, es->call_stmt_time);
if (es->predicate)
{
fprintf (f, "predicate: ");
@@ -1354,7 +1350,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
void
-dump_inline_summary (FILE * f, struct cgraph_node *node)
+dump_inline_summary (FILE *f, struct cgraph_node *node)
{
if (node->analyzed)
{
@@ -1367,22 +1363,17 @@ dump_inline_summary (FILE * f, struct cgraph_node *node)
fprintf (f, " always_inline");
if (s->inlinable)
fprintf (f, " inlinable");
- fprintf (f, "\n self time: %i\n",
- s->self_time);
+ fprintf (f, "\n self time: %i\n", s->self_time);
fprintf (f, " global time: %i\n", s->time);
- fprintf (f, " self size: %i\n",
- s->self_size);
+ fprintf (f, " self size: %i\n", s->self_size);
fprintf (f, " global size: %i\n", s->size);
fprintf (f, " self stack: %i\n",
(int) s->estimated_self_stack_size);
- fprintf (f, " global stack: %i\n",
- (int) s->estimated_stack_size);
+ fprintf (f, " global stack: %i\n", (int) s->estimated_stack_size);
if (s->growth)
- fprintf (f, " estimated growth:%i\n",
- (int) s->growth);
+ fprintf (f, " estimated growth:%i\n", (int) s->growth);
if (s->scc_no)
- fprintf (f, " In SCC: %i\n",
- (int) s->scc_no);
+ fprintf (f, " In SCC: %i\n", (int) s->scc_no);
for (i = 0; vec_safe_iterate (s->entry, i, &e); i++)
{
fprintf (f, " size:%f, time:%f, predicate:",
@@ -1452,7 +1443,7 @@ initialize_inline_failed (struct cgraph_edge *e)
static bool
mark_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef ATTRIBUTE_UNUSED,
- void *data)
+ void *data)
{
bool *b = (bool *) data;
*b = true;
@@ -1563,116 +1554,117 @@ eliminated_by_inlining_prob (gimple stmt)
switch (code)
{
- case GIMPLE_RETURN:
- return 2;
- case GIMPLE_ASSIGN:
- if (gimple_num_ops (stmt) != 2)
- return 0;
-
- rhs_code = gimple_assign_rhs_code (stmt);
-
- /* Casts of parameters, loads from parameters passed by reference
- and stores to return value or parameters are often free after
- inlining dua to SRA and further combining.
- Assume that half of statements goes away. */
- if (rhs_code == CONVERT_EXPR
- || rhs_code == NOP_EXPR
- || rhs_code == VIEW_CONVERT_EXPR
- || rhs_code == ADDR_EXPR
- || gimple_assign_rhs_class (stmt) == GIMPLE_SINGLE_RHS)
- {
- tree rhs = gimple_assign_rhs1 (stmt);
- tree lhs = gimple_assign_lhs (stmt);
- tree inner_rhs = get_base_address (rhs);
- tree inner_lhs = get_base_address (lhs);
- bool rhs_free = false;
- bool lhs_free = false;
-
- if (!inner_rhs)
- inner_rhs = rhs;
- if (!inner_lhs)
- inner_lhs = lhs;
-
- /* Reads of parameter are expected to be free. */
- if (unmodified_parm (stmt, inner_rhs))
- rhs_free = true;
- /* Match expressions of form &this->field. Those will most likely
- combine with something upstream after inlining. */
- else if (TREE_CODE (inner_rhs) == ADDR_EXPR)
- {
- tree op = get_base_address (TREE_OPERAND (inner_rhs, 0));
- if (TREE_CODE (op) == PARM_DECL)
- rhs_free = true;
- else if (TREE_CODE (op) == MEM_REF
- && unmodified_parm (stmt, TREE_OPERAND (op, 0)))
- rhs_free = true;
- }
-
- /* When parameter is not SSA register because its address is taken
- and it is just copied into one, the statement will be completely
- free after inlining (we will copy propagate backward). */
- if (rhs_free && is_gimple_reg (lhs))
- return 2;
-
- /* Reads of parameters passed by reference
- expected to be free (i.e. optimized out after inlining). */
- if (TREE_CODE(inner_rhs) == MEM_REF
- && unmodified_parm (stmt, TREE_OPERAND (inner_rhs, 0)))
- rhs_free = true;
-
- /* Copying parameter passed by reference into gimple register is
- probably also going to copy propagate, but we can't be quite
- sure. */
- if (rhs_free && is_gimple_reg (lhs))
- lhs_free = true;
-
- /* Writes to parameters, parameters passed by value and return value
- (either dirrectly or passed via invisible reference) are free.
-
- TODO: We ought to handle testcase like
- struct a {int a,b;};
- struct a
- retrurnsturct (void)
- {
- struct a a ={1,2};
- return a;
- }
-
- This translate into:
-
- retrurnsturct ()
- {
- int a$b;
- int a$a;
- struct a a;
- struct a D.2739;
-
- <bb 2>:
- D.2739.a = 1;
- D.2739.b = 2;
- return D.2739;
-
- }
- For that we either need to copy ipa-split logic detecting writes
- to return value. */
- if (TREE_CODE (inner_lhs) == PARM_DECL
- || TREE_CODE (inner_lhs) == RESULT_DECL
- || (TREE_CODE(inner_lhs) == MEM_REF
- && (unmodified_parm (stmt, TREE_OPERAND (inner_lhs, 0))
- || (TREE_CODE (TREE_OPERAND (inner_lhs, 0)) == SSA_NAME
- && SSA_NAME_VAR (TREE_OPERAND (inner_lhs, 0))
- && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND
- (inner_lhs, 0))) == RESULT_DECL))))
- lhs_free = true;
- if (lhs_free
- && (is_gimple_reg (rhs) || is_gimple_min_invariant (rhs)))
- rhs_free = true;
- if (lhs_free && rhs_free)
- return 1;
- }
- return 0;
- default:
+ case GIMPLE_RETURN:
+ return 2;
+ case GIMPLE_ASSIGN:
+ if (gimple_num_ops (stmt) != 2)
return 0;
+
+ rhs_code = gimple_assign_rhs_code (stmt);
+
+ /* Casts of parameters, loads from parameters passed by reference
+ and stores to return value or parameters are often free after
+ inlining dua to SRA and further combining.
+ Assume that half of statements goes away. */
+ if (rhs_code == CONVERT_EXPR
+ || rhs_code == NOP_EXPR
+ || rhs_code == VIEW_CONVERT_EXPR
+ || rhs_code == ADDR_EXPR
+ || gimple_assign_rhs_class (stmt) == GIMPLE_SINGLE_RHS)
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree inner_rhs = get_base_address (rhs);
+ tree inner_lhs = get_base_address (lhs);
+ bool rhs_free = false;
+ bool lhs_free = false;
+
+ if (!inner_rhs)
+ inner_rhs = rhs;
+ if (!inner_lhs)
+ inner_lhs = lhs;
+
+ /* Reads of parameter are expected to be free. */
+ if (unmodified_parm (stmt, inner_rhs))
+ rhs_free = true;
+ /* Match expressions of form &this->field. Those will most likely
+ combine with something upstream after inlining. */
+ else if (TREE_CODE (inner_rhs) == ADDR_EXPR)
+ {
+ tree op = get_base_address (TREE_OPERAND (inner_rhs, 0));
+ if (TREE_CODE (op) == PARM_DECL)
+ rhs_free = true;
+ else if (TREE_CODE (op) == MEM_REF
+ && unmodified_parm (stmt, TREE_OPERAND (op, 0)))
+ rhs_free = true;
+ }
+
+ /* When parameter is not SSA register because its address is taken
+ and it is just copied into one, the statement will be completely
+ free after inlining (we will copy propagate backward). */
+ if (rhs_free && is_gimple_reg (lhs))
+ return 2;
+
+ /* Reads of parameters passed by reference
+ expected to be free (i.e. optimized out after inlining). */
+ if (TREE_CODE (inner_rhs) == MEM_REF
+ && unmodified_parm (stmt, TREE_OPERAND (inner_rhs, 0)))
+ rhs_free = true;
+
+ /* Copying parameter passed by reference into gimple register is
+ probably also going to copy propagate, but we can't be quite
+ sure. */
+ if (rhs_free && is_gimple_reg (lhs))
+ lhs_free = true;
+
+ /* Writes to parameters, parameters passed by value and return value
+ (either dirrectly or passed via invisible reference) are free.
+
+ TODO: We ought to handle testcase like
+ struct a {int a,b;};
+ struct a
+ retrurnsturct (void)
+ {
+ struct a a ={1,2};
+ return a;
+ }
+
+ This translate into:
+
+ retrurnsturct ()
+ {
+ int a$b;
+ int a$a;
+ struct a a;
+ struct a D.2739;
+
+ <bb 2>:
+ D.2739.a = 1;
+ D.2739.b = 2;
+ return D.2739;
+
+ }
+ For that we either need to copy ipa-split logic detecting writes
+ to return value. */
+ if (TREE_CODE (inner_lhs) == PARM_DECL
+ || TREE_CODE (inner_lhs) == RESULT_DECL
+ || (TREE_CODE (inner_lhs) == MEM_REF
+ && (unmodified_parm (stmt, TREE_OPERAND (inner_lhs, 0))
+ || (TREE_CODE (TREE_OPERAND (inner_lhs, 0)) == SSA_NAME
+ && SSA_NAME_VAR (TREE_OPERAND (inner_lhs, 0))
+ && TREE_CODE (SSA_NAME_VAR (TREE_OPERAND
+ (inner_lhs,
+ 0))) == RESULT_DECL))))
+ lhs_free = true;
+ if (lhs_free
+ && (is_gimple_reg (rhs) || is_gimple_min_invariant (rhs)))
+ rhs_free = true;
+ if (lhs_free && rhs_free)
+ return 1;
+ }
+ return 0;
+ default:
+ return 0;
}
}
@@ -1682,8 +1674,8 @@ eliminated_by_inlining_prob (gimple stmt)
static void
set_cond_stmt_execution_predicate (struct ipa_node_params *info,
- struct inline_summary *summary,
- basic_block bb)
+ struct inline_summary *summary,
+ basic_block bb)
{
gimple last;
tree op;
@@ -1696,8 +1688,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
tree op2;
last = last_stmt (bb);
- if (!last
- || gimple_code (last) != GIMPLE_COND)
+ if (!last || gimple_code (last) != GIMPLE_COND)
return;
if (!is_gimple_ip_invariant (gimple_cond_rhs (last)))
return;
@@ -1709,8 +1700,8 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
{
code = gimple_cond_code (last);
inverted_code
- = invert_tree_comparison (code,
- HONOR_NANS (TYPE_MODE (TREE_TYPE (op))));
+ = invert_tree_comparison (code,
+ HONOR_NANS (TYPE_MODE (TREE_TYPE (op))));
FOR_EACH_EDGE (e, ei, bb->succs)
{
@@ -1719,7 +1710,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
? code : inverted_code,
gimple_cond_rhs (last));
e->aux = pool_alloc (edge_predicate_pool);
- *(struct predicate *)e->aux = p;
+ *(struct predicate *) e->aux = p;
}
}
@@ -1727,9 +1718,9 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
return;
/* Special case
if (builtin_constant_p (op))
- constant_code
+ constant_code
else
- nonconstant_code.
+ nonconstant_code.
Here we can predicate nonconstant_code. We can't
really handle constant_code since we have no predicate
for this and also the constant code is not known to be
@@ -1743,16 +1734,16 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
|| gimple_call_num_args (set_stmt) != 1)
return;
op2 = gimple_call_arg (set_stmt, 0);
- if (!unmodified_parm_or_parm_agg_item (info, set_stmt, op2, &index, &aggpos))
+ if (!unmodified_parm_or_parm_agg_item
+ (info, set_stmt, op2, &index, &aggpos))
return;
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (e->flags & EDGE_FALSE_VALUE)
- {
- struct predicate p = add_condition (summary, index, &aggpos,
- IS_NOT_CONSTANT, NULL_TREE);
- e->aux = pool_alloc (edge_predicate_pool);
- *(struct predicate *)e->aux = p;
- }
+ FOR_EACH_EDGE (e, ei, bb->succs) if (e->flags & EDGE_FALSE_VALUE)
+ {
+ struct predicate p = add_condition (summary, index, &aggpos,
+ IS_NOT_CONSTANT, NULL_TREE);
+ e->aux = pool_alloc (edge_predicate_pool);
+ *(struct predicate *) e->aux = p;
+ }
}
@@ -1761,8 +1752,8 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
static void
set_switch_stmt_execution_predicate (struct ipa_node_params *info,
- struct inline_summary *summary,
- basic_block bb)
+ struct inline_summary *summary,
+ basic_block bb)
{
gimple last;
tree op;
@@ -1774,8 +1765,7 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
size_t case_idx;
last = last_stmt (bb);
- if (!last
- || gimple_code (last) != GIMPLE_SWITCH)
+ if (!last || gimple_code (last) != GIMPLE_SWITCH)
return;
op = gimple_switch_index (last);
if (!unmodified_parm_or_parm_agg_item (info, last, op, &index, &aggpos))
@@ -1784,9 +1774,9 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
FOR_EACH_EDGE (e, ei, bb->succs)
{
e->aux = pool_alloc (edge_predicate_pool);
- *(struct predicate *)e->aux = false_predicate ();
+ *(struct predicate *) e->aux = false_predicate ();
}
- n = gimple_switch_num_labels(last);
+ n = gimple_switch_num_labels (last);
for (case_idx = 0; case_idx < n; ++case_idx)
{
tree cl = gimple_switch_label (last, case_idx);
@@ -1798,8 +1788,8 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
max = CASE_HIGH (cl);
/* For default we might want to construct predicate that none
- of cases is met, but it is bit hard to do not having negations
- of conditionals handy. */
+ of cases is met, but it is bit hard to do not having negations
+ of conditionals handy. */
if (!min && !max)
p = true_predicate ();
else if (!max)
@@ -1811,8 +1801,8 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
p2 = add_condition (summary, index, &aggpos, LE_EXPR, max);
p = and_predicates (summary->conds, &p1, &p2);
}
- *(struct predicate *)e->aux
- = or_predicates (summary->conds, &p, (struct predicate *)e->aux);
+ *(struct predicate *) e->aux
+ = or_predicates (summary->conds, &p, (struct predicate *) e->aux);
}
}
@@ -1838,7 +1828,7 @@ compute_bb_predicates (struct cgraph_node *node,
/* Entry block is always executable. */
ENTRY_BLOCK_PTR_FOR_FUNCTION (my_function)->aux
= pool_alloc (edge_predicate_pool);
- *(struct predicate *)ENTRY_BLOCK_PTR_FOR_FUNCTION (my_function)->aux
+ *(struct predicate *) ENTRY_BLOCK_PTR_FOR_FUNCTION (my_function)->aux
= true_predicate ();
/* A simple dataflow propagation of predicates forward in the CFG.
@@ -1848,19 +1838,19 @@ compute_bb_predicates (struct cgraph_node *node,
done = true;
FOR_EACH_BB_FN (bb, my_function)
{
- struct predicate p = false_predicate ();
- edge e;
- edge_iterator ei;
+ struct predicate p = false_predicate ();
+ edge e;
+ edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (e->src->aux)
{
struct predicate this_bb_predicate
- = *(struct predicate *)e->src->aux;
+ = *(struct predicate *) e->src->aux;
if (e->aux)
this_bb_predicate
- = and_predicates (summary->conds, &this_bb_predicate,
- (struct predicate *)e->aux);
+ = and_predicates (summary->conds, &this_bb_predicate,
+ (struct predicate *) e->aux);
p = or_predicates (summary->conds, &p, &this_bb_predicate);
if (true_predicate_p (&p))
break;
@@ -1874,12 +1864,12 @@ compute_bb_predicates (struct cgraph_node *node,
{
done = false;
bb->aux = pool_alloc (edge_predicate_pool);
- *((struct predicate *)bb->aux) = p;
+ *((struct predicate *) bb->aux) = p;
}
- else if (!predicates_equal_p (&p, (struct predicate *)bb->aux))
+ else if (!predicates_equal_p (&p, (struct predicate *) bb->aux))
{
done = false;
- *((struct predicate *)bb->aux) = p;
+ *((struct predicate *) bb->aux) = p;
}
}
}
@@ -1895,9 +1885,9 @@ typedef struct predicate predicate_t;
static struct predicate
will_be_nonconstant_expr_predicate (struct ipa_node_params *info,
- struct inline_summary *summary,
- tree expr,
- vec<predicate_t> nonconstant_names)
+ struct inline_summary *summary,
+ tree expr,
+ vec<predicate_t> nonconstant_names)
{
tree parm;
int index;
@@ -1906,19 +1896,17 @@ will_be_nonconstant_expr_predicate (struct ipa_node_params *info,
expr = TREE_OPERAND (expr, 0);
parm = unmodified_parm (NULL, expr);
- if (parm
- && (index = ipa_get_param_decl_index (info, parm)) >= 0)
+ if (parm && (index = ipa_get_param_decl_index (info, parm)) >= 0)
return add_condition (summary, index, NULL, CHANGED, NULL_TREE);
if (is_gimple_min_invariant (expr))
return false_predicate ();
if (TREE_CODE (expr) == SSA_NAME)
return nonconstant_names[SSA_NAME_VERSION (expr)];
- if (BINARY_CLASS_P (expr)
- || COMPARISON_CLASS_P (expr))
+ if (BINARY_CLASS_P (expr) || COMPARISON_CLASS_P (expr))
{
struct predicate p1 = will_be_nonconstant_expr_predicate
- (info, summary, TREE_OPERAND (expr, 0),
- nonconstant_names);
+ (info, summary, TREE_OPERAND (expr, 0),
+ nonconstant_names);
struct predicate p2;
if (true_predicate_p (&p1))
return p1;
@@ -1930,8 +1918,8 @@ will_be_nonconstant_expr_predicate (struct ipa_node_params *info,
else if (TREE_CODE (expr) == COND_EXPR)
{
struct predicate p1 = will_be_nonconstant_expr_predicate
- (info, summary, TREE_OPERAND (expr, 0),
- nonconstant_names);
+ (info, summary, TREE_OPERAND (expr, 0),
+ nonconstant_names);
struct predicate p2;
if (true_predicate_p (&p1))
return p1;
@@ -2018,7 +2006,8 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
}
if (is_load)
- op_non_const = add_condition (summary, base_index, &aggpos, CHANGED, NULL);
+ op_non_const =
+ add_condition (summary, base_index, &aggpos, CHANGED, NULL);
else
op_non_const = false_predicate ();
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
@@ -2026,8 +2015,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
tree parm = unmodified_parm (stmt, use);
int index;
- if (parm
- && (index = ipa_get_param_decl_index (info, parm)) >= 0)
+ if (parm && (index = ipa_get_param_decl_index (info, parm)) >= 0)
{
if (index != base_index)
p = add_condition (summary, index, NULL, CHANGED, NULL_TREE);
@@ -2041,7 +2029,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
if (gimple_code (stmt) == GIMPLE_ASSIGN
&& TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME)
nonconstant_names[SSA_NAME_VERSION (gimple_assign_lhs (stmt))]
- = op_non_const;
+ = op_non_const;
return op_non_const;
}
@@ -2055,15 +2043,16 @@ struct record_modified_bb_info
set except for info->stmt. */
static bool
-record_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef,
- void *data)
+record_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, void *data)
{
- struct record_modified_bb_info *info = (struct record_modified_bb_info *) data;
+ struct record_modified_bb_info *info =
+ (struct record_modified_bb_info *) data;
if (SSA_NAME_DEF_STMT (vdef) == info->stmt)
return false;
bitmap_set_bit (info->bb_set,
SSA_NAME_IS_DEFAULT_DEF (vdef)
- ? ENTRY_BLOCK_PTR->index : gimple_bb (SSA_NAME_DEF_STMT (vdef))->index);
+ ? ENTRY_BLOCK_PTR->index
+ : gimple_bb (SSA_NAME_DEF_STMT (vdef))->index);
return false;
}
@@ -2081,6 +2070,7 @@ param_change_prob (gimple stmt, int i)
basic_block bb = gimple_bb (stmt);
tree base;
+ /* Global invariants neve change. */
if (is_gimple_min_invariant (op))
return 0;
/* We would have to do non-trivial analysis to really work out what
@@ -2104,10 +2094,10 @@ param_change_prob (gimple stmt, int i)
if (!init_freq)
init_freq = 1;
if (init_freq < bb->frequency)
- return MAX ((init_freq * REG_BR_PROB_BASE +
- bb->frequency / 2) / bb->frequency, 1);
+ return MAX ((init_freq * REG_BR_PROB_BASE +
+ bb->frequency / 2) / bb->frequency, 1);
else
- return REG_BR_PROB_BASE;
+ return REG_BR_PROB_BASE;
}
base = get_base_address (op);
@@ -2130,13 +2120,13 @@ param_change_prob (gimple stmt, int i)
NULL);
if (bitmap_bit_p (info.bb_set, bb->index))
{
- BITMAP_FREE (info.bb_set);
+ BITMAP_FREE (info.bb_set);
return REG_BR_PROB_BASE;
}
/* Assume that every memory is initialized at entry.
- TODO: Can we easilly determine if value is always defined
- and thus we may skip entry block? */
+ TODO: Can we easilly determine if value is always defined
+ and thus we may skip entry block? */
if (ENTRY_BLOCK_PTR->frequency)
max = ENTRY_BLOCK_PTR->frequency;
else
@@ -2144,13 +2134,13 @@ param_change_prob (gimple stmt, int i)
EXECUTE_IF_SET_IN_BITMAP (info.bb_set, 0, index, bi)
max = MIN (max, BASIC_BLOCK (index)->frequency);
-
+
BITMAP_FREE (info.bb_set);
if (max < bb->frequency)
- return MAX ((max * REG_BR_PROB_BASE +
+ return MAX ((max * REG_BR_PROB_BASE +
bb->frequency / 2) / bb->frequency, 1);
else
- return REG_BR_PROB_BASE;
+ return REG_BR_PROB_BASE;
}
return REG_BR_PROB_BASE;
}
@@ -2251,19 +2241,18 @@ predicate_for_phi_result (struct inline_summary *summary, gimple phi,
static struct predicate
array_index_predicate (struct inline_summary *info,
- vec<predicate_t> nonconstant_names, tree op)
+ vec< predicate_t> nonconstant_names, tree op)
{
struct predicate p = false_predicate ();
while (handled_component_p (op))
{
- if (TREE_CODE (op) == ARRAY_REF
- || TREE_CODE (op) == ARRAY_RANGE_REF)
- {
+ if (TREE_CODE (op) == ARRAY_REF || TREE_CODE (op) == ARRAY_RANGE_REF)
+ {
if (TREE_CODE (TREE_OPERAND (op, 1)) == SSA_NAME)
- p = or_predicates (info->conds, &p,
- &nonconstant_names[
- SSA_NAME_VERSION (TREE_OPERAND (op, 1))]);
- }
+ p = or_predicates (info->conds, &p,
+ &nonconstant_names[SSA_NAME_VERSION
+ (TREE_OPERAND (op, 1))]);
+ }
op = TREE_OPERAND (op, 0);
}
return p;
@@ -2304,7 +2293,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
if (ipa_node_params_vector.exists ())
{
parms_info = IPA_NODE_REF (node);
- nonconstant_names.safe_grow_cleared(SSANAMES (my_function)->length());
+ nonconstant_names.safe_grow_cleared
+ (SSANAMES (my_function)->length ());
}
}
@@ -2335,7 +2325,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
if (parms_info)
{
if (bb->aux)
- bb_predicate = *(struct predicate *)bb->aux;
+ bb_predicate = *(struct predicate *) bb->aux;
else
bb_predicate = false_predicate ();
}
@@ -2384,26 +2374,33 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
fprintf (dump_file, " ");
print_gimple_stmt (dump_file, stmt, 0, 0);
fprintf (dump_file, "\t\tfreq:%3.2f size:%3i time:%3i\n",
- ((double)freq)/CGRAPH_FREQ_BASE, this_size, this_time);
+ ((double) freq) / CGRAPH_FREQ_BASE, this_size,
+ this_time);
}
if (gimple_assign_load_p (stmt) && nonconstant_names.exists ())
{
struct predicate this_array_index;
- this_array_index = array_index_predicate (info, nonconstant_names,
- gimple_assign_rhs1 (stmt));
+ this_array_index =
+ array_index_predicate (info, nonconstant_names,
+ gimple_assign_rhs1 (stmt));
if (!false_predicate_p (&this_array_index))
- array_index = and_predicates (info->conds, &array_index, &this_array_index);
+ array_index =
+ and_predicates (info->conds, &array_index,
+ &this_array_index);
}
if (gimple_store_p (stmt) && nonconstant_names.exists ())
{
struct predicate this_array_index;
- this_array_index = array_index_predicate (info, nonconstant_names,
- gimple_get_lhs (stmt));
+ this_array_index =
+ array_index_predicate (info, nonconstant_names,
+ gimple_get_lhs (stmt));
if (!false_predicate_p (&this_array_index))
- array_index = and_predicates (info->conds, &array_index, &this_array_index);
+ array_index =
+ and_predicates (info->conds, &array_index,
+ &this_array_index);
}
-
+
if (is_gimple_call (stmt))
{
@@ -2411,8 +2408,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
struct inline_edge_summary *es = inline_edge_summary (edge);
/* Special case: results of BUILT_IN_CONSTANT_P will be always
- resolved as constant. We however don't want to optimize
- out the cgraph edges. */
+ resolved as constant. We however don't want to optimize
+ out the cgraph edges. */
if (nonconstant_names.exists ()
&& gimple_call_builtin_p (stmt, BUILT_IN_CONSTANT_P)
&& gimple_call_lhs (stmt)
@@ -2420,11 +2417,11 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
{
struct predicate false_p = false_predicate ();
nonconstant_names[SSA_NAME_VERSION (gimple_call_lhs (stmt))]
- = false_p;
+ = false_p;
}
if (ipa_node_params_vector.exists ())
{
- int count = gimple_call_num_args (stmt);
+ int count = gimple_call_num_args (stmt);
int i;
if (count)
@@ -2444,12 +2441,12 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
}
/* TODO: When conditional jump or swithc is known to be constant, but
- we did not translate it into the predicates, we really can account
+ we did not translate it into the predicates, we really can account
just maximum of the possible paths. */
if (parms_info)
will_be_nonconstant
- = will_be_nonconstant_predicate (parms_info, info,
- stmt, nonconstant_names);
+ = will_be_nonconstant_predicate (parms_info, info,
+ stmt, nonconstant_names);
if (this_time || this_size)
{
struct predicate p;
@@ -2458,7 +2455,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
prob = eliminated_by_inlining_prob (stmt);
if (prob == 1 && dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\t\t50%% will be eliminated by inlining\n");
+ fprintf (dump_file,
+ "\t\t50%% will be eliminated by inlining\n");
if (prob == 2 && dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\t\tWill be eliminated by inlining\n");
@@ -2477,8 +2475,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
}
/* We account everything but the calls. Calls have their own
- size/time info attached to cgraph edges. This is necessary
- in order to make the cost disappear after inlining. */
+ size/time info attached to cgraph edges. This is necessary
+ in order to make the cost disappear after inlining. */
if (!is_gimple_call (stmt))
{
if (prob)
@@ -2516,38 +2514,42 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
scev_initialize ();
FOR_EACH_LOOP (li, loop, 0)
{
- vec<edge> exits;
- edge ex;
+ vec<edge> exits;
+ edge ex;
unsigned int j, i;
struct tree_niter_desc niter_desc;
basic_block *body = get_loop_body (loop);
- bb_predicate = *(struct predicate *)loop->header->aux;
+ bb_predicate = *(struct predicate *) loop->header->aux;
exits = get_loop_exit_edges (loop);
- FOR_EACH_VEC_ELT (exits, j, ex)
+ FOR_EACH_VEC_ELT (exits, j, ex)
if (number_of_iterations_exit (loop, ex, &niter_desc, false)
&& !is_gimple_min_invariant (niter_desc.niter))
- {
- predicate will_be_nonconstant
- = will_be_nonconstant_expr_predicate (parms_info, info,
- niter_desc.niter, nonconstant_names);
- if (!true_predicate_p (&will_be_nonconstant))
- will_be_nonconstant = and_predicates (info->conds,
- &bb_predicate,
- &will_be_nonconstant);
- if (!true_predicate_p (&will_be_nonconstant)
- && !false_predicate_p (&will_be_nonconstant))
- /* This is slightly inprecise. We may want to represent each loop with
- independent predicate. */
- loop_iterations = and_predicates (info->conds, &loop_iterations, &will_be_nonconstant);
- }
- exits.release ();
+ {
+ predicate will_be_nonconstant
+ = will_be_nonconstant_expr_predicate (parms_info, info,
+ niter_desc.niter,
+ nonconstant_names);
+ if (!true_predicate_p (&will_be_nonconstant))
+ will_be_nonconstant = and_predicates (info->conds,
+ &bb_predicate,
+ &will_be_nonconstant);
+ if (!true_predicate_p (&will_be_nonconstant)
+ && !false_predicate_p (&will_be_nonconstant))
+ /* This is slightly inprecise. We may want to represent each
+ loop with independent predicate. */
+ loop_iterations =
+ and_predicates (info->conds, &loop_iterations,
+ &will_be_nonconstant);
+ }
+ exits.release ();
- for (i = 0; i < loop->num_nodes; i++)
+ for (i = 0; i < loop->num_nodes; i++)
{
gimple_stmt_iterator gsi;
- bb_predicate = *(struct predicate *)body[i]->aux;
- for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ bb_predicate = *(struct predicate *) body[i]->aux;
+ for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
affine_iv iv;
@@ -2555,30 +2557,36 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
tree use;
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
- {
- predicate will_be_nonconstant;
-
- if (!simple_iv (loop, loop_containing_stmt (stmt), use, &iv, true)
- || is_gimple_min_invariant (iv.step))
- continue;
+ {
+ predicate will_be_nonconstant;
+
+ if (!simple_iv
+ (loop, loop_containing_stmt (stmt), use, &iv, true)
+ || is_gimple_min_invariant (iv.step))
+ continue;
+ will_be_nonconstant
+ = will_be_nonconstant_expr_predicate (parms_info, info,
+ iv.step,
+ nonconstant_names);
+ if (!true_predicate_p (&will_be_nonconstant))
will_be_nonconstant
- = will_be_nonconstant_expr_predicate (parms_info, info,
- iv.step, nonconstant_names);
- if (!true_predicate_p (&will_be_nonconstant))
- will_be_nonconstant = and_predicates (info->conds,
- &bb_predicate,
- &will_be_nonconstant);
- if (!true_predicate_p (&will_be_nonconstant)
- && !false_predicate_p (&will_be_nonconstant))
- /* This is slightly inprecise. We may want to represent each loop with
- independent predicate. */
- loop_stride = and_predicates (info->conds, &loop_stride, &will_be_nonconstant);
- }
+ = and_predicates (info->conds,
+ &bb_predicate,
+ &will_be_nonconstant);
+ if (!true_predicate_p (&will_be_nonconstant)
+ && !false_predicate_p (&will_be_nonconstant))
+ /* This is slightly inprecise. We may want to represent
+ each loop with independent predicate. */
+ loop_stride =
+ and_predicates (info->conds, &loop_stride,
+ &will_be_nonconstant);
+ }
}
}
free (body);
}
- set_hint_predicate (&inline_summary (node)->loop_iterations, loop_iterations);
+ set_hint_predicate (&inline_summary (node)->loop_iterations,
+ loop_iterations);
set_hint_predicate (&inline_summary (node)->loop_stride, loop_stride);
scev_finalize ();
}
@@ -2691,8 +2699,7 @@ compute_inline_parameters (struct cgraph_node *node, bool early)
info->estimated_stack_size = info->estimated_self_stack_size;
#ifdef ENABLE_CHECKING
inline_update_overall_summary (node);
- gcc_assert (info->time == info->self_time
- && info->size == info->self_size);
+ gcc_assert (info->time == info->self_time && info->size == info->self_size);
#endif
pop_cfun ();
@@ -2709,24 +2716,24 @@ compute_inline_parameters_for_current (void)
return 0;
}
-struct gimple_opt_pass pass_inline_parameters =
+struct gimple_opt_pass pass_inline_parameters =
{
{
GIMPLE_PASS,
- "inline_param", /* name */
- OPTGROUP_INLINE, /* optinfo_flags */
- NULL, /* gate */
- compute_inline_parameters_for_current,/* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_INLINE_PARAMETERS, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0 /* todo_flags_finish */
- }
+ "inline_param", /* name */
+ OPTGROUP_INLINE, /* optinfo_flags */
+ NULL, /* gate */
+ compute_inline_parameters_for_current, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_INLINE_PARAMETERS, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+ }
};
@@ -2776,7 +2783,6 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time,
vec<tree> known_binfos,
vec<ipa_agg_jump_function_p> known_aggs,
inline_hints *hints)
-
{
struct inline_edge_summary *es = inline_edge_summary (e);
int call_size = es->call_stmt_size;
@@ -2784,12 +2790,11 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time,
if (!e->callee
&& estimate_edge_devirt_benefit (e, &call_size, &call_time,
known_vals, known_binfos, known_aggs)
- && hints
- && cgraph_maybe_hot_edge_p (e))
+ && hints && cgraph_maybe_hot_edge_p (e))
*hints |= INLINE_HINT_indirect_call;
*size += call_size * INLINE_SIZE_SCALE;
*time += call_time * prob / REG_BR_PROB_BASE
- * e->frequency * (INLINE_TIME_SCALE / CGRAPH_FREQ_BASE);
+ * e->frequency * (INLINE_TIME_SCALE / CGRAPH_FREQ_BASE);
if (*time > MAX_TIME * INLINE_TIME_SCALE)
*time = MAX_TIME * INLINE_TIME_SCALE;
}
@@ -2812,26 +2817,29 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, int *time,
for (e = node->callees; e; e = e->next_callee)
{
struct inline_edge_summary *es = inline_edge_summary (e);
- if (!es->predicate || evaluate_predicate (es->predicate, possible_truths))
+ if (!es->predicate
+ || evaluate_predicate (es->predicate, possible_truths))
{
if (e->inline_failed)
{
/* Predicates of calls shall not use NOT_CHANGED codes,
- sowe do not need to compute probabilities. */
+ sowe do not need to compute probabilities. */
estimate_edge_size_and_time (e, size, time, REG_BR_PROB_BASE,
- known_vals, known_binfos, known_aggs,
- hints);
+ known_vals, known_binfos,
+ known_aggs, hints);
}
else
estimate_calls_size_and_time (e->callee, size, time, hints,
possible_truths,
- known_vals, known_binfos, known_aggs);
+ known_vals, known_binfos,
+ known_aggs);
}
}
for (e = node->indirect_calls; e; e = e->next_callee)
{
struct inline_edge_summary *es = inline_edge_summary (e);
- if (!es->predicate || evaluate_predicate (es->predicate, possible_truths))
+ if (!es->predicate
+ || evaluate_predicate (es->predicate, possible_truths))
estimate_edge_size_and_time (e, size, time, REG_BR_PROB_BASE,
known_vals, known_binfos, known_aggs,
hints);
@@ -2849,10 +2857,10 @@ estimate_node_size_and_time (struct cgraph_node *node,
vec<tree> known_vals,
vec<tree> known_binfos,
vec<ipa_agg_jump_function_p> known_aggs,
- int *ret_size, int *ret_time,
+ int *ret_size, int *ret_time,
inline_hints *ret_hints,
vec<inline_param_summary_t>
- inline_param_summary)
+ inline_param_summary)
{
struct inline_summary *info = inline_summary (node);
size_time_entry *e;
@@ -2861,24 +2869,21 @@ estimate_node_size_and_time (struct cgraph_node *node,
inline_hints hints = 0;
int i;
- if (dump_file
- && (dump_flags & TDF_DETAILS))
+ if (dump_file && (dump_flags & TDF_DETAILS))
{
bool found = false;
fprintf (dump_file, " Estimating body: %s/%i\n"
- " Known to be false: ",
- cgraph_node_name (node),
- node->uid);
+ " Known to be false: ", cgraph_node_name (node), node->uid);
for (i = predicate_not_inlined_condition;
i < (predicate_first_dynamic_condition
- + (int)vec_safe_length (info->conds)); i++)
+ + (int) vec_safe_length (info->conds)); i++)
if (!(possible_truths & (1 << i)))
{
if (found)
fprintf (dump_file, ", ");
found = true;
- dump_condition (dump_file, info->conds, i);
+ dump_condition (dump_file, info->conds, i);
}
}
@@ -2887,7 +2892,7 @@ estimate_node_size_and_time (struct cgraph_node *node,
{
size += e->size;
gcc_checking_assert (e->time >= 0);
- gcc_checking_assert (time >= 0);
+ gcc_checking_assert (time >= 0);
if (!inline_param_summary.exists ())
time += e->time;
else
@@ -2898,25 +2903,25 @@ estimate_node_size_and_time (struct cgraph_node *node,
inline_param_summary);
gcc_checking_assert (prob >= 0);
gcc_checking_assert (prob <= REG_BR_PROB_BASE);
- time += ((gcov_type)e->time * prob) / REG_BR_PROB_BASE;
+ time += ((gcov_type) e->time * prob) / REG_BR_PROB_BASE;
}
- if (time > MAX_TIME * INLINE_TIME_SCALE)
- time = MAX_TIME * INLINE_TIME_SCALE;
- gcc_checking_assert (time >= 0);
-
+ if (time > MAX_TIME * INLINE_TIME_SCALE)
+ time = MAX_TIME * INLINE_TIME_SCALE;
+ gcc_checking_assert (time >= 0);
+
}
gcc_checking_assert (size >= 0);
gcc_checking_assert (time >= 0);
if (info->loop_iterations
&& !evaluate_predicate (info->loop_iterations, possible_truths))
- hints |=INLINE_HINT_loop_iterations;
+ hints |= INLINE_HINT_loop_iterations;
if (info->loop_stride
&& !evaluate_predicate (info->loop_stride, possible_truths))
- hints |=INLINE_HINT_loop_stride;
+ hints |= INLINE_HINT_loop_stride;
if (info->array_index
&& !evaluate_predicate (info->array_index, possible_truths))
- hints |=INLINE_HINT_array_index;
+ hints |= INLINE_HINT_array_index;
if (info->scc_no)
hints |= INLINE_HINT_in_scc;
if (DECL_DECLARED_INLINE_P (node->symbol.decl))
@@ -2929,9 +2934,8 @@ estimate_node_size_and_time (struct cgraph_node *node,
time = RDIV (time, INLINE_TIME_SCALE);
size = RDIV (size, INLINE_SIZE_SCALE);
- if (dump_file
- && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\n size:%i time:%i\n", (int)size, (int)time);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n size:%i time:%i\n", (int) size, (int) time);
if (ret_time)
*ret_time = time;
if (ret_size)
@@ -2949,11 +2953,11 @@ estimate_node_size_and_time (struct cgraph_node *node,
void
estimate_ipcp_clone_size_and_time (struct cgraph_node *node,
- vec<tree> known_vals,
- vec<tree> known_binfos,
- vec<ipa_agg_jump_function_p> known_aggs,
- int *ret_size, int *ret_time,
- inline_hints *hints)
+ vec<tree> known_vals,
+ vec<tree> known_binfos,
+ vec<ipa_agg_jump_function_p> known_aggs,
+ int *ret_size, int *ret_time,
+ inline_hints *hints)
{
clause_t clause;
@@ -2982,8 +2986,7 @@ remap_predicate (struct inline_summary *info,
struct predicate *p,
vec<int> operand_map,
vec<int> offset_map,
- clause_t possible_truths,
- struct predicate *toplev_predicate)
+ clause_t possible_truths, struct predicate *toplev_predicate)
{
int i;
struct predicate out = true_predicate ();
@@ -2999,7 +3002,7 @@ remap_predicate (struct inline_summary *info,
gcc_assert (i < MAX_CLAUSES);
- for (cond = 0; cond < NUM_CONDITIONS; cond ++)
+ for (cond = 0; cond < NUM_CONDITIONS; cond++)
/* Do we have condition we can't disprove? */
if (clause & possible_truths & (1 << cond))
{
@@ -3008,42 +3011,42 @@ remap_predicate (struct inline_summary *info,
inlined function. */
if (cond >= predicate_first_dynamic_condition)
{
- struct condition *c;
-
- c = &(*callee_info->conds)[cond
- - predicate_first_dynamic_condition];
- /* See if we can remap condition operand to caller's operand.
- Otherwise give up. */
- if (!operand_map.exists ()
- || (int)operand_map.length () <= c->operand_num
- || operand_map[c->operand_num] == -1
- /* TODO: For non-aggregate conditions, adding an offset is
- basically an arithmetic jump function processing which
- we should support in future. */
- || ((!c->agg_contents || !c->by_ref)
- && offset_map[c->operand_num] > 0)
- || (c->agg_contents && c->by_ref
- && offset_map[c->operand_num] < 0))
- cond_predicate = true_predicate ();
- else
- {
- struct agg_position_info ap;
- HOST_WIDE_INT offset_delta = offset_map[c->operand_num];
- if (offset_delta < 0)
- {
- gcc_checking_assert (!c->agg_contents || !c->by_ref);
- offset_delta = 0;
- }
- gcc_assert (!c->agg_contents
- || c->by_ref
- || offset_delta == 0);
- ap.offset = c->offset + offset_delta;
- ap.agg_contents = c->agg_contents;
- ap.by_ref = c->by_ref;
- cond_predicate = add_condition (info,
- operand_map[c->operand_num],
- &ap, c->code, c->val);
- }
+ struct condition *c;
+
+ c = &(*callee_info->conds)[cond
+ -
+ predicate_first_dynamic_condition];
+ /* See if we can remap condition operand to caller's operand.
+ Otherwise give up. */
+ if (!operand_map.exists ()
+ || (int) operand_map.length () <= c->operand_num
+ || operand_map[c->operand_num] == -1
+ /* TODO: For non-aggregate conditions, adding an offset is
+ basically an arithmetic jump function processing which
+ we should support in future. */
+ || ((!c->agg_contents || !c->by_ref)
+ && offset_map[c->operand_num] > 0)
+ || (c->agg_contents && c->by_ref
+ && offset_map[c->operand_num] < 0))
+ cond_predicate = true_predicate ();
+ else
+ {
+ struct agg_position_info ap;
+ HOST_WIDE_INT offset_delta = offset_map[c->operand_num];
+ if (offset_delta < 0)
+ {
+ gcc_checking_assert (!c->agg_contents || !c->by_ref);
+ offset_delta = 0;
+ }
+ gcc_assert (!c->agg_contents
+ || c->by_ref || offset_delta == 0);
+ ap.offset = c->offset + offset_delta;
+ ap.agg_contents = c->agg_contents;
+ ap.by_ref = c->by_ref;
+ cond_predicate = add_condition (info,
+ operand_map[c->operand_num],
+ &ap, c->code, c->val);
+ }
}
/* Fixed conditions remains same, construct single
condition predicate. */
@@ -3065,8 +3068,7 @@ remap_predicate (struct inline_summary *info,
Compute peak stack usage. */
static void
-inline_update_callee_summaries (struct cgraph_node *node,
- int depth)
+inline_update_callee_summaries (struct cgraph_node *node, int depth)
{
struct cgraph_edge *e;
struct inline_summary *callee_info = inline_summary (node);
@@ -3075,12 +3077,11 @@ inline_update_callee_summaries (struct cgraph_node *node,
callee_info->stack_frame_offset
= caller_info->stack_frame_offset
- + caller_info->estimated_self_stack_size;
+ + caller_info->estimated_self_stack_size;
peak = callee_info->stack_frame_offset
- + callee_info->estimated_self_stack_size;
- if (inline_summary (node->global.inlined_to)->estimated_stack_size
- < peak)
- inline_summary (node->global.inlined_to)->estimated_stack_size = peak;
+ + callee_info->estimated_self_stack_size;
+ if (inline_summary (node->global.inlined_to)->estimated_stack_size < peak)
+ inline_summary (node->global.inlined_to)->estimated_stack_size = peak;
cgraph_propagate_frequency (node);
for (e = node->callees; e; e = e->next_callee)
{
@@ -3108,7 +3109,7 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge,
struct ipa_edge_args *args = IPA_EDGE_REF (edge);
struct inline_edge_summary *es = inline_edge_summary (edge);
struct inline_edge_summary *inlined_es
- = inline_edge_summary (inlined_edge);
+ = inline_edge_summary (inlined_edge);
for (i = 0; i < ipa_get_cs_argument_count (args); i++)
{
@@ -3129,7 +3130,7 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge,
es->param[i].change_prob = prob;
}
}
- }
+ }
}
/* Update edge summaries of NODE after INLINED_EDGE has been inlined.
@@ -3140,14 +3141,14 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge,
Also update change probabilities. */
static void
-remap_edge_summaries (struct cgraph_edge *inlined_edge,
- struct cgraph_node *node,
- struct inline_summary *info,
- struct inline_summary *callee_info,
- vec<int> operand_map,
- vec<int> offset_map,
- clause_t possible_truths,
- struct predicate *toplev_predicate)
+remap_edge_summaries (struct cgraph_edge *inlined_edge,
+ struct cgraph_node *node,
+ struct inline_summary *info,
+ struct inline_summary *callee_info,
+ vec<int> operand_map,
+ vec<int> offset_map,
+ clause_t possible_truths,
+ struct predicate *toplev_predicate)
{
struct cgraph_edge *e;
for (e = node->callees; e; e = e->next_callee)
@@ -3163,12 +3164,11 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge,
{
p = remap_predicate (info, callee_info,
es->predicate, operand_map, offset_map,
- possible_truths,
- toplev_predicate);
+ possible_truths, toplev_predicate);
edge_set_predicate (e, &p);
/* TODO: We should remove the edge for code that will be
- optimized out, but we need to keep verifiers and tree-inline
- happy. Make it cold for now. */
+ optimized out, but we need to keep verifiers and tree-inline
+ happy. Make it cold for now. */
if (false_predicate_p (&p))
{
e->count = 0;
@@ -3227,17 +3227,13 @@ remap_hint_predicate (struct inline_summary *info,
p = remap_predicate (info, callee_info,
*hint,
operand_map, offset_map,
- possible_truths,
- toplev_predicate);
- if (!false_predicate_p (&p)
- && !true_predicate_p (&p))
+ possible_truths, toplev_predicate);
+ if (!false_predicate_p (&p) && !true_predicate_p (&p))
{
if (!*hint)
set_hint_predicate (hint, p);
else
- **hint = and_predicates (info->conds,
- *hint,
- &p);
+ **hint = and_predicates (info->conds, *hint, &p);
}
}
@@ -3312,19 +3308,19 @@ inline_merge_summary (struct cgraph_edge *edge)
&toplev_predicate);
if (!false_predicate_p (&p))
{
- gcov_type add_time = ((gcov_type)e->time * edge->frequency
+ gcov_type add_time = ((gcov_type) e->time * edge->frequency
+ CGRAPH_FREQ_BASE / 2) / CGRAPH_FREQ_BASE;
int prob = predicate_probability (callee_info->conds,
&e->predicate,
clause, es->param);
- add_time = ((gcov_type)add_time * prob) / REG_BR_PROB_BASE;
+ add_time = ((gcov_type) add_time * prob) / REG_BR_PROB_BASE;
if (add_time > MAX_TIME * INLINE_TIME_SCALE)
add_time = MAX_TIME * INLINE_TIME_SCALE;
if (prob != REG_BR_PROB_BASE
&& dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\t\tScaling time by probability:%f\n",
- (double)prob / REG_BR_PROB_BASE);
+ (double) prob / REG_BR_PROB_BASE);
}
account_size_time (info, e->size, add_time, &p);
}
@@ -3333,16 +3329,13 @@ inline_merge_summary (struct cgraph_edge *edge)
offset_map, clause, &toplev_predicate);
remap_hint_predicate (info, callee_info,
&callee_info->loop_iterations,
- operand_map, offset_map,
- clause, &toplev_predicate);
+ operand_map, offset_map, clause, &toplev_predicate);
remap_hint_predicate (info, callee_info,
&callee_info->loop_stride,
- operand_map, offset_map,
- clause, &toplev_predicate);
+ operand_map, offset_map, clause, &toplev_predicate);
remap_hint_predicate (info, callee_info,
&callee_info->array_index,
- operand_map, offset_map,
- clause, &toplev_predicate);
+ operand_map, offset_map, clause, &toplev_predicate);
inline_update_callee_summaries (edge->callee,
inline_edge_summary (edge)->loop_depth);
@@ -3371,10 +3364,10 @@ inline_update_overall_summary (struct cgraph_node *node)
{
info->size += e->size, info->time += e->time;
if (info->time > MAX_TIME * INLINE_TIME_SCALE)
- info->time = MAX_TIME * INLINE_TIME_SCALE;
+ info->time = MAX_TIME * INLINE_TIME_SCALE;
}
estimate_calls_size_and_time (node, &info->size, &info->time, NULL,
- ~(clause_t)(1 << predicate_false_condition),
+ ~(clause_t) (1 << predicate_false_condition),
vNULL, vNULL, vNULL);
info->time = (info->time + INLINE_TIME_SCALE / 2) / INLINE_TIME_SCALE;
info->size = (info->size + INLINE_SIZE_SCALE / 2) / INLINE_SIZE_SCALE;
@@ -3386,8 +3379,7 @@ simple_edge_hints (struct cgraph_edge *edge)
{
int hints = 0;
struct cgraph_node *to = (edge->caller->global.inlined_to
- ? edge->caller->global.inlined_to
- : edge->caller);
+ ? edge->caller->global.inlined_to : edge->caller);
if (inline_summary (to)->scc_no
&& inline_summary (to)->scc_no == inline_summary (edge->callee)->scc_no
&& !cgraph_edge_recursive_p (edge))
@@ -3437,7 +3429,7 @@ do_estimate_edge_time (struct cgraph_edge *edge)
/* When caching, update the cache entry. */
if (edge_growth_cache.exists ())
{
- if ((int)edge_growth_cache.length () <= edge->uid)
+ if ((int) edge_growth_cache.length () <= edge->uid)
edge_growth_cache.safe_grow_cleared (cgraph_edge_max_uid);
edge_growth_cache[edge->uid].time = time + (time >= 0);
@@ -3537,7 +3529,8 @@ estimate_time_after_inlining (struct cgraph_node *node,
struct inline_edge_summary *es = inline_edge_summary (edge);
if (!es->predicate || !false_predicate_p (es->predicate))
{
- gcov_type time = inline_summary (node)->time + estimate_edge_time (edge);
+ gcov_type time =
+ inline_summary (node)->time + estimate_edge_time (edge);
if (time < 0)
time = 0;
if (time > MAX_TIME)
@@ -3588,7 +3581,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data)
if (e->caller == node
|| (e->caller->global.inlined_to
&& e->caller->global.inlined_to == node))
- d->self_recursive = true;
+ d->self_recursive = true;
d->growth += estimate_edge_growth (e);
}
return false;
@@ -3600,7 +3593,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data)
int
do_estimate_growth (struct cgraph_node *node)
{
- struct growth_data d = {0, false};
+ struct growth_data d = { 0, false };
struct inline_summary *info = inline_summary (node);
cgraph_for_node_and_aliases (node, do_estimate_growth_1, &d, true);
@@ -3618,10 +3611,10 @@ do_estimate_growth (struct cgraph_node *node)
if (cgraph_will_be_removed_from_program_if_no_direct_calls (node))
d.growth -= info->size;
/* COMDAT functions are very often not shared across multiple units
- since they come from various template instantiations.
- Take this into account. */
- else if (DECL_COMDAT (node->symbol.decl)
- && cgraph_can_remove_if_no_direct_calls_p (node))
+ since they come from various template instantiations.
+ Take this into account. */
+ else if (DECL_COMDAT (node->symbol.decl)
+ && cgraph_can_remove_if_no_direct_calls_p (node))
d.growth -= (info->size
* (100 - PARAM_VALUE (PARAM_COMDAT_SHARING_PROBABILITY))
+ 50) / 100;
@@ -3629,7 +3622,7 @@ do_estimate_growth (struct cgraph_node *node)
if (node_growth_cache.exists ())
{
- if ((int)node_growth_cache.length () <= node->uid)
+ if ((int) node_growth_cache.length () <= node->uid)
node_growth_cache.safe_grow_cleared (cgraph_max_uid);
node_growth_cache[node->uid] = d.growth + (d.growth >= 0);
}
@@ -3687,7 +3680,7 @@ inline_generate_summary (void)
struct cgraph_node *node;
function_insertion_hook_holder =
- cgraph_add_function_insertion_hook (&add_new_function, NULL);
+ cgraph_add_function_insertion_hook (&add_new_function, NULL);
ipa_register_cgraph_hooks ();
inline_free_summary ();
@@ -3707,7 +3700,7 @@ read_predicate (struct lto_input_block *ib)
clause_t clause;
int k = 0;
- do
+ do
{
gcc_assert (k <= MAX_CLAUSES);
clause = out.clause[k++] = streamer_read_uhwi (ib);
@@ -3741,8 +3734,7 @@ read_inline_edge_summary (struct lto_input_block *ib, struct cgraph_edge *e)
{
es->param.safe_grow_cleared (length);
for (i = 0; i < length; i++)
- es->param[i].change_prob
- = streamer_read_uhwi (ib);
+ es->param[i].change_prob = streamer_read_uhwi (ib);
}
}
@@ -3820,7 +3812,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
vec_safe_push (info->entry, e);
}
-
+
p = read_predicate (&ib);
set_hint_predicate (&info->loop_iterations, p);
p = read_predicate (&ib);
@@ -3859,7 +3851,7 @@ inline_read_summary (void)
LTO_section_inline_summary,
NULL, &len);
if (data)
- inline_read_section (file_data, data, len);
+ inline_read_section (file_data, data, len);
else
/* Fatal error here. We do not want to support compiling ltrans units
with different version of compiler or different flags than the WPA
@@ -3870,10 +3862,10 @@ inline_read_summary (void)
{
ipa_register_cgraph_hooks ();
if (!flag_ipa_cp)
- ipa_prop_read_jump_functions ();
+ ipa_prop_read_jump_functions ();
}
function_insertion_hook_holder =
- cgraph_add_function_insertion_hook (&add_new_function, NULL);
+ cgraph_add_function_insertion_hook (&add_new_function, NULL);
}
@@ -3886,8 +3878,8 @@ write_predicate (struct output_block *ob, struct predicate *p)
if (p)
for (j = 0; p->clause[j]; j++)
{
- gcc_assert (j < MAX_CLAUSES);
- streamer_write_uhwi (ob, p->clause[j]);
+ gcc_assert (j < MAX_CLAUSES);
+ streamer_write_uhwi (ob, p->clause[j]);
}
streamer_write_uhwi (ob, 0);
}
@@ -3906,7 +3898,7 @@ write_inline_edge_summary (struct output_block *ob, struct cgraph_edge *e)
streamer_write_uhwi (ob, es->loop_depth);
write_predicate (ob, es->predicate);
streamer_write_uhwi (ob, es->param.length ());
- for (i = 0; i < (int)es->param.length (); i++)
+ for (i = 0; i < (int) es->param.length (); i++)
streamer_write_uhwi (ob, es->param[i].change_prob);
}
@@ -3945,8 +3937,11 @@ inline_write_summary (void)
int i;
size_time_entry *e;
struct condition *c;
-
- streamer_write_uhwi (ob, lto_symtab_encoder_encode (encoder, (symtab_node)node));
+
+ streamer_write_uhwi (ob,
+ lto_symtab_encoder_encode (encoder,
+ (symtab_node)
+ node));
streamer_write_hwi (ob, info->estimated_self_stack_size);
streamer_write_hwi (ob, info->self_size);
streamer_write_hwi (ob, info->self_time);
@@ -3964,7 +3959,7 @@ inline_write_summary (void)
bp_pack_value (&bp, c->by_ref, 1);
streamer_write_bitpack (&bp);
if (c->agg_contents)
- streamer_write_uhwi (ob, c->offset);
+ streamer_write_uhwi (ob, c->offset);
}
streamer_write_uhwi (ob, vec_safe_length (info->entry));
for (i = 0; vec_safe_iterate (info->entry, i, &e); i++)
diff --git a/gcc/ira.c b/gcc/ira.c
index f0cbd6dc72e..0fa5b389591 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3563,7 +3563,7 @@ build_insn_chain (void)
c->insn = insn;
c->block = bb->index;
- if (INSN_P (insn))
+ if (NONDEBUG_INSN_P (insn))
for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
{
df_ref def = *def_rec;
@@ -3654,7 +3654,7 @@ build_insn_chain (void)
bitmap_and_compl_into (live_relevant_regs, elim_regset);
bitmap_copy (&c->live_throughout, live_relevant_regs);
- if (INSN_P (insn))
+ if (NONDEBUG_INSN_P (insn))
for (use_rec = DF_INSN_UID_USES (uid); *use_rec; use_rec++)
{
df_ref use = *use_rec;
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index de319c4f1d7..39a7b80bdb3 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -148,6 +148,61 @@ static void combine_var_copies_in_loop_exit (struct var_to_expand *,
basic_block);
static rtx get_expansion (struct var_to_expand *);
+/* Emit a message summarizing the unroll or peel that will be
+ performed for LOOP, along with the loop's location LOCUS, if
+ appropriate given the dump or -fopt-info settings. */
+
+static void
+report_unroll_peel (struct loop *loop, location_t locus)
+{
+ struct niter_desc *desc;
+ int niters = 0;
+ int report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS;
+
+ if (!dump_enabled_p ())
+ return;
+
+ /* In the special case where the loop never iterated, emit
+ a different message so that we don't report an unroll by 0.
+ This matches the equivalent message emitted during tree unrolling. */
+ if (loop->lpt_decision.decision == LPT_PEEL_COMPLETELY
+ && !loop->lpt_decision.times)
+ {
+ dump_printf_loc (report_flags, locus,
+ "Turned loop into non-loop; it never loops.\n");
+ return;
+ }
+
+ desc = get_simple_loop_desc (loop);
+
+ if (desc->const_iter)
+ niters = desc->niter;
+ else if (loop->header->count)
+ niters = expected_loop_iterations (loop);
+
+ dump_printf_loc (report_flags, locus,
+ "%s loop %d times",
+ (loop->lpt_decision.decision == LPT_PEEL_COMPLETELY
+ ? "Completely unroll"
+ : (loop->lpt_decision.decision == LPT_PEEL_SIMPLE
+ ? "Peel" : "Unroll")),
+ loop->lpt_decision.times);
+ if (profile_info)
+ dump_printf (report_flags,
+ " (header execution count %d",
+ (int)loop->header->count);
+ if (loop->lpt_decision.decision == LPT_PEEL_COMPLETELY)
+ dump_printf (report_flags,
+ "%s%s iterations %d)",
+ profile_info ? ", " : " (",
+ desc->const_iter ? "const" : "average",
+ niters);
+ else if (profile_info)
+ dump_printf (report_flags, ")");
+
+ dump_printf (report_flags, "\n");
+}
+
/* Unroll and/or peel (depending on FLAGS) LOOPS. */
void
unroll_and_peel_loops (int flags)
@@ -234,11 +289,13 @@ peel_loops_completely (int flags)
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
{
loop->lpt_decision.decision = LPT_NONE;
+ location_t locus = get_loop_location (loop);
- if (dump_file)
- fprintf (dump_file,
- "\n;; *** Considering loop %d for complete peeling ***\n",
- loop->num);
+ if (dump_enabled_p ())
+ dump_printf_loc (TDF_RTL, locus,
+ ";; *** Considering loop %d at BB %d for "
+ "complete peeling ***\n",
+ loop->num, loop->header->index);
loop->ninsns = num_loop_insns (loop);
@@ -248,6 +305,7 @@ peel_loops_completely (int flags)
if (loop->lpt_decision.decision == LPT_PEEL_COMPLETELY)
{
+ report_unroll_peel (loop, locus);
peel_loop_completely (loop);
#ifdef ENABLE_CHECKING
verify_loop_structure ();
@@ -267,9 +325,13 @@ decide_unrolling_and_peeling (int flags)
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
{
loop->lpt_decision.decision = LPT_NONE;
+ location_t locus = get_loop_location (loop);
- if (dump_file)
- fprintf (dump_file, "\n;; *** Considering loop %d ***\n", loop->num);
+ if (dump_enabled_p ())
+ dump_printf_loc (TDF_RTL, locus,
+ ";; *** Considering loop %d at BB %d for "
+ "unrolling and peeling ***\n",
+ loop->num, loop->header->index);
/* Do not peel cold areas. */
if (optimize_loop_for_size_p (loop))
@@ -309,6 +371,8 @@ decide_unrolling_and_peeling (int flags)
decide_unroll_stupid (loop, flags);
if (loop->lpt_decision.decision == LPT_NONE)
decide_peel_simple (loop, flags);
+
+ report_unroll_peel (loop, locus);
}
}
@@ -348,8 +412,6 @@ decide_peel_once_rolling (struct loop *loop, int flags ATTRIBUTE_UNUSED)
}
/* Success. */
- if (dump_file)
- fprintf (dump_file, ";; Decided to peel exactly once rolling loop\n");
loop->lpt_decision.decision = LPT_PEEL_COMPLETELY;
}
@@ -429,8 +491,6 @@ decide_peel_completely (struct loop *loop, int flags ATTRIBUTE_UNUSED)
}
/* Success. */
- if (dump_file)
- fprintf (dump_file, ";; Decided to peel loop completely\n");
loop->lpt_decision.decision = LPT_PEEL_COMPLETELY;
}
@@ -608,10 +668,6 @@ decide_unroll_constant_iterations (struct loop *loop, int flags)
loop->lpt_decision.decision = LPT_UNROLL_CONSTANT;
loop->lpt_decision.times = best_unroll;
-
- if (dump_file)
- fprintf (dump_file, ";; Decided to unroll the loop %d times (%d copies).\n",
- loop->lpt_decision.times, best_copies);
}
/* Unroll LOOP with constant number of iterations LOOP->LPT_DECISION.TIMES times.
@@ -893,10 +949,6 @@ decide_unroll_runtime_iterations (struct loop *loop, int flags)
loop->lpt_decision.decision = LPT_UNROLL_RUNTIME;
loop->lpt_decision.times = i - 1;
-
- if (dump_file)
- fprintf (dump_file, ";; Decided to unroll the loop %d times.\n",
- loop->lpt_decision.times);
}
/* Splits edge E and inserts the sequence of instructions INSNS on it, and
@@ -1305,10 +1357,6 @@ decide_peel_simple (struct loop *loop, int flags)
/* Success. */
loop->lpt_decision.decision = LPT_PEEL_SIMPLE;
loop->lpt_decision.times = npeel;
-
- if (dump_file)
- fprintf (dump_file, ";; Decided to simply peel the loop %d times.\n",
- loop->lpt_decision.times);
}
/* Peel a LOOP LOOP->LPT_DECISION.TIMES times. The transformation does this:
@@ -1460,10 +1508,6 @@ decide_unroll_stupid (struct loop *loop, int flags)
loop->lpt_decision.decision = LPT_UNROLL_STUPID;
loop->lpt_decision.times = i - 1;
-
- if (dump_file)
- fprintf (dump_file, ";; Decided to unroll the loop stupidly %d times.\n",
- loop->lpt_decision.times);
}
/* Unroll a LOOP LOOP->LPT_DECISION.TIMES times. The transformation does this:
diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
index b1d18102dc2..12d58cca609 100644
--- a/gcc/lra-assigns.c
+++ b/gcc/lra-assigns.c
@@ -1084,6 +1084,8 @@ improve_inheritance (bitmap changed_pseudos)
lra_copy_t cp, next_cp;
bitmap_iterator bi;
+ if (lra_inheritance_iter > LRA_MAX_INHERITANCE_PASSES)
+ return;
n = 0;
EXECUTE_IF_SET_IN_BITMAP (&lra_inheritance_pseudos, 0, k, bi)
if (reg_renumber[k] >= 0 && lra_reg_info[k].nrefs != 0)
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index e4c9ca2a5e8..f6c6c89b858 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3201,10 +3201,6 @@ loc_equivalence_callback (rtx loc, const_rtx, void *)
return NULL_RTX;
}
-/* Maximum allowed number of constraint pass iterations after the last
- spill pass. It is for preventing LRA cycling in a bug case. */
-#define MAX_CONSTRAINT_ITERATION_NUMBER 30
-
/* Maximum number of generated reload insns per an insn. It is for
preventing this pass cycling in a bug case. */
#define MAX_RELOAD_INSNS_NUMBER LRA_MAX_INSN_RELOADS
@@ -3328,10 +3324,10 @@ lra_constraints (bool first_p)
fprintf (lra_dump_file, "\n********** Local #%d: **********\n\n",
lra_constraint_iter);
lra_constraint_iter_after_spill++;
- if (lra_constraint_iter_after_spill > MAX_CONSTRAINT_ITERATION_NUMBER)
+ if (lra_constraint_iter_after_spill > LRA_MAX_CONSTRAINT_ITERATION_NUMBER)
internal_error
("Maximum number of LRA constraint passes is achieved (%d)\n",
- MAX_CONSTRAINT_ITERATION_NUMBER);
+ LRA_MAX_CONSTRAINT_ITERATION_NUMBER);
changed_p = false;
lra_risky_transformations_p = false;
new_insn_uid_start = get_max_uid ();
@@ -4698,21 +4694,6 @@ inherit_in_ebb (rtx head, rtx tail)
return change_p;
}
-/* The maximal number of inheritance/split passes in LRA. It should
- be more 1 in order to perform caller saves transformations and much
- less MAX_CONSTRAINT_ITERATION_NUMBER to prevent LRA to do as many
- as permitted constraint passes in some complicated cases. The
- first inheritance/split pass has a biggest impact on generated code
- quality. Each subsequent affects generated code in less degree.
- For example, the 3rd pass does not change generated SPEC2000 code
- at all on x86-64. */
-#define MAX_INHERITANCE_PASSES 2
-
-#if MAX_INHERITANCE_PASSES <= 0 \
- || MAX_INHERITANCE_PASSES >= MAX_CONSTRAINT_ITERATION_NUMBER - 8
-#error wrong MAX_INHERITANCE_PASSES value
-#endif
-
/* This value affects EBB forming. If probability of edge from EBB to
a BB is not greater than the following value, we don't add the BB
to EBB. */
@@ -4730,7 +4711,7 @@ lra_inheritance (void)
edge e;
lra_inheritance_iter++;
- if (lra_inheritance_iter > MAX_INHERITANCE_PASSES)
+ if (lra_inheritance_iter > LRA_MAX_INHERITANCE_PASSES)
return;
timevar_push (TV_LRA_INHERITANCE);
if (lra_dump_file != NULL)
@@ -5000,7 +4981,7 @@ lra_undo_inheritance (void)
bool change_p;
lra_undo_inheritance_iter++;
- if (lra_undo_inheritance_iter > MAX_INHERITANCE_PASSES)
+ if (lra_undo_inheritance_iter > LRA_MAX_INHERITANCE_PASSES)
return false;
if (lra_dump_file != NULL)
fprintf (lra_dump_file,
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 8e89518bae0..064722936ba 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -249,6 +249,25 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t;
#define LRA_LOSER_COST_FACTOR 6
#define LRA_MAX_REJECT 600
+/* Maximum allowed number of constraint pass iterations after the last
+ spill pass. It is for preventing LRA cycling in a bug case. */
+#define LRA_MAX_CONSTRAINT_ITERATION_NUMBER 30
+
+/* The maximal number of inheritance/split passes in LRA. It should
+ be more 1 in order to perform caller saves transformations and much
+ less MAX_CONSTRAINT_ITERATION_NUMBER to prevent LRA to do as many
+ as permitted constraint passes in some complicated cases. The
+ first inheritance/split pass has a biggest impact on generated code
+ quality. Each subsequent affects generated code in less degree.
+ For example, the 3rd pass does not change generated SPEC2000 code
+ at all on x86-64. */
+#define LRA_MAX_INHERITANCE_PASSES 2
+
+#if LRA_MAX_INHERITANCE_PASSES <= 0 \
+ || LRA_MAX_INHERITANCE_PASSES >= LRA_MAX_CONSTRAINT_ITERATION_NUMBER - 8
+#error wrong LRA_MAX_INHERITANCE_PASSES value
+#endif
+
/* lra.c: */
extern FILE *lra_dump_file;
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 853b155a3af..85c36c65ab4 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1257,6 +1257,26 @@ write_symbol (struct streamer_tree_cache_d *cache,
lto_output_data_stream (stream, &slot_num, 4);
}
+/* Return true if NODE should appear in the plugin symbol table. */
+
+bool
+output_symbol_p (symtab_node node)
+{
+ struct cgraph_node *cnode;
+ struct ipa_ref *ref;
+
+ if (!symtab_real_symbol_p (node))
+ return false;
+ /* We keep external functions in symtab for sake of inlining
+ and devirtualization. We do not want to see them in symbol table as
+ references. */
+ cnode = dyn_cast <cgraph_node> (node);
+ if (cnode && DECL_EXTERNAL (cnode->symbol.decl))
+ return (cnode->callers
+ || ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref));
+ return true;
+}
+
/* Write an IL symbol table to OB.
SET and VSET are cgraph/varpool node sets we are outputting. */
@@ -1285,7 +1305,7 @@ produce_symtab (struct output_block *ob)
{
symtab_node node = lsei_node (lsei);
- if (!symtab_real_symbol_p (node) || DECL_EXTERNAL (node->symbol.decl))
+ if (!output_symbol_p (node) || DECL_EXTERNAL (node->symbol.decl))
continue;
write_symbol (cache, &stream, node->symbol.decl, seen, false);
}
@@ -1294,7 +1314,7 @@ produce_symtab (struct output_block *ob)
{
symtab_node node = lsei_node (lsei);
- if (!symtab_real_symbol_p (node) || !DECL_EXTERNAL (node->symbol.decl))
+ if (!output_symbol_p (node) || !DECL_EXTERNAL (node->symbol.decl))
continue;
write_symbol (cache, &stream, node->symbol.decl, seen, false);
}
diff --git a/gcc/output.h b/gcc/output.h
index 3fb743a17e9..bd5c3ebd0aa 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -556,6 +556,8 @@ extern void output_file_directive (FILE *, const char *);
extern unsigned int default_section_type_flags (tree, const char *, int);
extern bool have_global_bss_p (void);
+extern bool bss_initializer_p (const_tree);
+
extern void default_no_named_section (const char *, unsigned int, tree);
extern void default_elf_asm_named_section (const char *, unsigned int, tree);
extern enum section_category categorize_decl_for_section (const_tree, int);
diff --git a/gcc/realmpfr.h b/gcc/realmpfr.h
index ab234e9195d..4cfa4fb5803 100644
--- a/gcc/realmpfr.h
+++ b/gcc/realmpfr.h
@@ -22,7 +22,6 @@
#ifndef GCC_REALGMP_H
#define GCC_REALGMP_H
-#include <gmp.h>
#include <mpfr.h>
#include <mpc.h>
#include "real.h"
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 382648188ed..b14a2a87853 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2107,7 +2107,6 @@ volatile_insn_p (const_rtx x)
return 0;
case UNSPEC_VOLATILE:
- /* case TRAP_IF: This isn't clear yet. */
return 1;
case ASM_INPUT:
@@ -2240,7 +2239,6 @@ side_effects_p (const_rtx x)
case POST_MODIFY:
case CALL:
case UNSPEC_VOLATILE:
- /* case TRAP_IF: This isn't clear yet. */
return 1;
case MEM:
@@ -2312,9 +2310,9 @@ may_trap_p_1 (const_rtx x, unsigned flags)
return 0;
case UNSPEC:
- case UNSPEC_VOLATILE:
return targetm.unspec_may_trap_p (x, flags);
+ case UNSPEC_VOLATILE:
case ASM_INPUT:
case TRAP_IF:
return 1;
@@ -2406,8 +2404,7 @@ may_trap_p_1 (const_rtx x, unsigned flags)
default:
/* Any floating arithmetic may trap. */
- if (SCALAR_FLOAT_MODE_P (GET_MODE (x))
- && flag_trapping_math)
+ if (SCALAR_FLOAT_MODE_P (GET_MODE (x)) && flag_trapping_math)
return 1;
}
diff --git a/gcc/system.h b/gcc/system.h
index 54d86acc360..ab1b887b847 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -638,6 +638,8 @@ extern int vsnprintf(char *, size_t, const char *, va_list);
#include <dlfcn.h>
#endif
+#include <gmp.h>
+
/* Get libiberty declarations. */
#include "libiberty.h"
diff --git a/gcc/target.def b/gcc/target.def
index bbda6c25d26..d0547be63c4 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1816,7 +1816,7 @@ DEFHOOK
"",
rtx, (rtx hard_reg), NULL)
-/* Return nonzero if evaluating UNSPEC[_VOLATILE] X might cause a trap.
+/* Return nonzero if evaluating UNSPEC X might cause a trap.
FLAGS has the same meaning as in rtlanal.c: may_trap_p_1. */
DEFHOOK
(unspec_may_trap_p,
@@ -2833,6 +2833,14 @@ DEFHOOK
bool, (tree decl1, tree decl2),
hook_bool_tree_tree_false)
+/* This function returns true if the target supports function
+ multiversioning. */
+DEFHOOK
+(supports_function_versions,
+ "",
+ bool, (void),
+ hook_bool_void_false)
+
/* Function to determine if one function can inline another function. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 241c1cce577..954cdb9d1be 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -102,10 +102,8 @@ default_unspec_may_trap_p (const_rtx x, unsigned flags)
{
int i;
- if (GET_CODE (x) == UNSPEC_VOLATILE
- /* Any floating arithmetic may trap. */
- || (SCALAR_FLOAT_MODE_P (GET_MODE (x))
- && flag_trapping_math))
+ /* Any floating arithmetic may trap. */
+ if ((SCALAR_FLOAT_MODE_P (GET_MODE (x)) && flag_trapping_math))
return 1;
for (i = 0; i < XVECLEN (x, 0); ++i)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a51f09e2aad..b3418f11882 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,129 @@
+2013-01-02 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * gcc.dg/pr55430.c: Define MAP_FAILED if not defined.
+
+2013-01-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/55818
+ * gfortran.dg/eof_4.f90: New test.
+
+2013-01-02 Jakub Jelinek <jakub@redhat.com>
+
+ * lib/c-compat.exp (compat-use-alt-compiler): Remove
+ -fno-diagnostics-show-caret from TEST_ALWAYS_FLAGS if needed.
+ (compat-use-tst-compiler): Restore TEST_ALWAYS_FLAGS.
+ (compat_setup_dfp): Initialize compat_alt_caret and
+ compat_save_TEST_ALWAYS_FLAGS.
+
+2013-01-02 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * gcc.dg/torture/tls/tls-reload-1.c: New test.
+
+2013-01-02 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * gcc.dg/torture/fp-int-convert-2.c: New test.
+
+2013-01-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ * gfortran.dg/newunit_3.f90: Add dg-do run.
+ * gfortran.dg/inquire_15.f90: Add dg-do run.
+
+2013-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/55831
+ * gcc.dg/pr55831.c: New test.
+
+2012-12-31 Uros Bizjak <ubizjak@gmail.com>
+
+ * g++.dg/ipa/devirt-9.C: Cleanup inline ipa dump.
+
+2012-12-31 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/builtin_target.c (vendor_signatures): Remove.
+ (check_detailed): Use signature_INTEL_ebx and signature_AMD_ebx
+ to check vendor signature.
+
+2012-12-28 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/55692
+ * gfortran.dg/associated_7.f90: New.
+
+2012-12-28 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/55763
+ * gfortran.dg/unlimited_polymorphic_5.f90
+
+2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/48960
+ * gfortran.dg/newunit_3.f90: New.
+
+2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/48976
+ * gfortran.dg/inquire_15.f90: New.
+
+2012-12-27 Sriraman Tallam <tmsriram@google.com>
+
+ * testsuite/g++.dg/mv1.C: Remove target options.
+ * testsuite/g++.dg/mv2.C: Ditto.
+ * testsuite/g++.dg/mv3.C: Ditto.
+ * testsuite/g++.dg/mv4.C: Ditto.
+ * testsuite/g++.dg/mv5.C: Ditto.
+
+2012-12-26 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR fortran/55539
+ * gfortran.dg/nosigned_zero_3.f90: New testcase.
+
+2012-12-23 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54884
+ * gfortran.dg/public_private_module_8.f90: New.
+
+2012-12-23 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * gcc.target/mips/r10k-cache-barrier-10.c: Make a branch-likely
+ instruction more likely.
+
+2012-12-23 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * gcc.target/mips/pr55315.c: Cast to long rather than int.
+
+2012-12-22 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/55763
+ * gfortran.dg/unlimited_polymorphic_6.f90: New.
+
+2012-12-21 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/55355
+ * g++.dg/torture/pr55355.C: New test.
+
+2012-12-21 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR middle-end/55775
+ * gcc.target/i386/pr55775.c: New test.
+
+2012-12-21 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.dg/pthread-init-2.c (dg-options): Define _XOPEN_SOURCE=500
+ on AIX.
+
+ * lib/target-supports.exp (add_options_for_tls): Add -pthread for
+ AIX as well.
+ (check_effective_target_powerpc_vsx_ok): Only test VSX on AIX 7.1
+ and above.
+
+ * gcc.c-torture/compile/pr44707.c: Do not try to assemble on AIX.
+
+ * c-c++-common/pr43942.c: Remove XFAIL for AIX.
+
+2012-12-21 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/55763
+ * gfortran.dg/unlimited_polymorphic_4.f03: New test.
+
2012-12-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/52996
@@ -842,7 +968,7 @@
PR middle-end/55030
* gcc.dg/guality/pr36728-1.c, gcc.dg/guality/pr36728-2.c (foo): Don't
- use volatile asms, use plain asms. Where the output value for the
+ use volatile asms, use plain asms. Where the output value for the
asm is unused, write a global variable.
2012-11-25 Uros Bizjak <ubizjak@gmail.com>
@@ -1305,12 +1431,12 @@
* gcc.target/powerpc/ppc-pow.c: Allow dot symbols in branch.
* gcc.target/powerpc/tfmode_off.c: Skip on AIX.
-2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53063
* gcc.dg/warn-nsstring.c: Use -Wformat explicitly.
-2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/51294
* c-c++-common/pr51294.c: New.
@@ -1691,7 +1817,7 @@
PR middle-end/55116
* gcc.target/i386/pr55116.c: New file.
-2012-10-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-10-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53066
* gcc.dg/Wshadow-4.c: New.
@@ -2120,7 +2246,7 @@
* gcc.dg/webizer.c (main): Add missing exit call.
-2012-10-21 Thomas König <tkoenig@gcc.gnu.org>
+2012-10-21 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/54465
* gfortran.dg/wextra_1.f: New test.
@@ -2203,7 +2329,7 @@
* gcc.dg/tree-ssa/ldist-17.c: Block cunroll to make testcase still
valid.
-2012-10-16 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-10-16 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53063
PR c/40989
@@ -3009,7 +3135,7 @@
* go.test/go-test.exp: Update for latest version of Go testsuite.
-2012-09-29 Thomas König <tkoenig@gcc.gnu.org>
+2012-09-29 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/52724
* gfortran.dg/internal_readwrite_3.f90: New test.
@@ -3514,7 +3640,7 @@
* g++.dg/torture/builtin-location.C: New testcase.
2012-09-13 Paolo Carlini <paolo.carlini@oracle.com>
- Manuel López-Ibáñez <manu@gcc.gnu.org>
+ Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/53210
* g++.dg/warn/Wuninitialized-self.C: New.
@@ -4375,7 +4501,7 @@
PR fortran/54301
* gfortran.dg/warn_target_lifetime_1.f90: New.
-2012-08-19 Thomas König <tkoenig@gcc.gnu.org>
+2012-08-19 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/54298
* gfortran.dg/real_compare_1.f90: New test case.
@@ -4830,7 +4956,7 @@
* gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise.
* gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise.
-2012-08-01 Thomas König <tkoenig@gcc.gnu.org>
+2012-08-01 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/54033
* gfortran.dg/include_6.f90: New test case.
@@ -5303,7 +5429,7 @@
* g++.dg/parse/access8.C: Adjust.
* g++.dg/template/sfinae6_neg.C: Adjust.
-2012-07-16 Thomas König <tkoenig@gcc.gnu.org>
+2012-07-16 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/53824
* gfortran.dg/coarray_allocate_1.f90: New test.
@@ -6334,12 +6460,12 @@
PR middle-end/53535
* gcc.dg/pr46647.c: xfail for cris-* and crisv32-*.
-2012-06-07 Thomas König <tkoenig@gcc.gnu.org>
+2012-06-07 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/52861
* gfortran.dg/string_assign_2.f90: New test case.
-2012-06-07 Thomas König <tkoenig@gcc.gnu.org>
+2012-06-07 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/52861
* gfortran.dg/string_assign_1.f90: New test case.
@@ -6355,7 +6481,7 @@
* gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise.
* c-c++-common/gomp/pr53580.c: New test.
-2012-06-07 Fabien Chêne <fabien@gcc.gnu.org>
+2012-06-07 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/51214
* g++.dg/cpp0x/forw_enum11.C: New.
@@ -6383,7 +6509,7 @@
* gfortran.dg/vect/pr32380.f: Adjust number of expected vectorized
loops.
-2012-06-06 Fabien Chêne <fabien@gcc.gnu.org>
+2012-06-06 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/52841
* g++.dg/cpp0x/pr52841.C: New testcase.
@@ -7171,7 +7297,7 @@
* gnat.dg/discr36.ad[sb]: New test.
* gnat.dg/discr36_pkg.ad[sb]: New helper.
-2012-05-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-05-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/43772
* c-c++-common/pr43772.c: New.
@@ -7233,7 +7359,7 @@
* gcc.target/ia64/pr48496.c: New test.
* gcc.target/ia64/pr52657.c: Likewise.
-2012-05-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-05-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/51712
* c-c++-common/pr51712.c: New.
@@ -7476,7 +7602,7 @@
* gnat.dg/warn6.ad[sb]: New test.
-2012-04-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-04-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 53149
* gcc.dg/20011021-1.c: Adjust testcase.
@@ -7584,7 +7710,7 @@
PR c/52880
* gcc.dg/pr52880.c: New test.
-2012-04-25 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-04-25 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc.dg/m-un-2.c: Update.
* gcc.dg/20011021-1.c: Update.
@@ -7667,7 +7793,7 @@
PR fortran/53051
* gfortran.dg/read_float_4.f90: New.
-2012-04-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-04-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 35441
* c-c++-common/pr35441.C: New.
@@ -7702,7 +7828,7 @@
* gcc.dg/pr52283.c: New test.
-2012-04-19 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-04-19 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc.dg/pr37985.c: New test.
@@ -7950,12 +8076,12 @@
* gcc/target/sh/pr50751-6.c: New.
* gcc/target/sh/pr50751-7.c: New.
-2012-04-11 Fabien Chêne <fabien@gcc.gnu.org>
+2012-04-11 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/52465
* g++.dg/lookup/using52.C: New.
-2012-04-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-04-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
* lib/prune.exp (TEST_ALWAYS_FLAGS): If undefined, set to empty.
@@ -8051,7 +8177,7 @@
* gcc.dg/builtin-bswap-5.c: Likewise.
* gcc.target/i386/builtin-bswap-4.c: New test.
-2012-04-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-04-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 24985
* lib/prune.exp: Add -fno-diagnostics-show-caret.
@@ -8160,7 +8286,7 @@
PR fortran/52751
* gfortran.dg/public_private_module_2.f90: New.
-2012-04-08 Manuel López-Ibáñez <manu@gcc.gnu.org>
+2012-04-08 Manuel López-Ibáñez <manu@gcc.gnu.org>
* g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: Add labels to
directives.
@@ -9395,7 +9521,7 @@
PR c++/52248
* g++.dg/ext/timevar1.C: New.
-2012-02-16 Fabien Chêne <fabien@gcc.gnu.org>
+2012-02-16 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/52126
* g++.dg/template/using21.C: New.
@@ -9730,7 +9856,7 @@
PR fortran/51514
* gfortran.dg/class_to_type_2.f90: New.
-2012-02-06 Thomas König <tkoenig@gcc.gnu.org>
+2012-02-06 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/32373
* gfortran.dg/vect/vect-8.f90: Use vect_double effective target.
@@ -9756,12 +9882,12 @@
* gcc.dg/pr48374.c: Actually add the test I forgot
in the 2012-01-25 commit.
-2012-02-05 Thomas König <tkoenig@gcc.gnu.org>
+2012-02-05 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/32373
* gfortran.dg/vect/vect-8.f90: New test case.
-2012-02-05 Thomas König <tkoenig@gcc.gnu.org>
+2012-02-05 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/48847
* gfortran.dg/warn_unused_dummy_argument_3.f90: New test.
@@ -9853,7 +9979,7 @@
PR tree-optimization/52073
* gcc.c-torture/compile/pr52073.c: New test.
-2012-02-01 Thomas König <tkoenig@gcc.gnu.org>
+2012-02-01 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/51958
* gfortran.dg/function_optimize_10.f90: New test.
@@ -11036,7 +11162,7 @@
* g++.dg/cpp0x/constexpr-delegating2.C: Add missing piece.
-2012-01-01 Fabien Chêne <fabien@gcc.gnu.org>
+2012-01-01 Fabien Chêne <fabien@gcc.gnu.org>
* g++.old-deja/g++.brendan/crash25.C: Adjust.
* g++.old-deja/g++.brendan/crash56.C: Likewise.
diff --git a/gcc/testsuite/c-c++-common/pr43942.c b/gcc/testsuite/c-c++-common/pr43942.c
index 9e7787f508c..3d97db6624e 100644
--- a/gcc/testsuite/c-c++-common/pr43942.c
+++ b/gcc/testsuite/c-c++-common/pr43942.c
@@ -1,7 +1,6 @@
/* PR debug/43942 */
/* { dg-do compile } */
/* { dg-options "-O2 -fcompare-debug" } */
-/* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */
extern int f1 (int);
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-protected.C b/gcc/testsuite/g++.dg/cpp0x/initlist-protected.C
new file mode 100644
index 00000000000..fb5cc6aa892
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-protected.C
@@ -0,0 +1,23 @@
+// PR c++/54325
+// { dg-options -std=c++11 }
+
+class base
+{
+ protected:
+ base()
+ {}
+};
+
+class derived : public base
+{
+ public:
+ derived()
+ : base{} // <-- Note the c++11 curly brace syntax
+ {}
+};
+
+int main()
+{
+ derived d1;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/init/array33.C b/gcc/testsuite/g++.dg/init/array33.C
new file mode 100644
index 00000000000..4440d3d5432
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/array33.C
@@ -0,0 +1,22 @@
+// PR c++/55804
+// { dg-do run }
+
+int t = 0;
+template <typename> struct vector {
+ vector() { t++; }
+};
+
+typedef vector<int> Arrays[1];
+class C
+{
+ vector<int> v_;
+ void Foo(const Arrays &);
+};
+Arrays a;
+
+int main(void)
+{
+ if (t!=1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-9.C b/gcc/testsuite/g++.dg/ipa/devirt-9.C
index 62ea96e5eed..5be458cbb41 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-9.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-9.C
@@ -28,3 +28,4 @@ bar ()
c.c1 (60, (int) foo ());
}
/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/g++.dg/mv1.C b/gcc/testsuite/g++.dg/mv1.C
index 150b4511267..bad0c4496d3 100644
--- a/gcc/testsuite/g++.dg/mv1.C
+++ b/gcc/testsuite/g++.dg/mv1.C
@@ -1,7 +1,7 @@
/* Test case to check if Multiversioning works. */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-require-ifunc "" } */
-/* { dg-options "-O2 -fPIC -march=x86-64 -mno-avx -mno-popcnt" } */
+/* { dg-options "-O2 -fPIC" } */
#include <assert.h>
diff --git a/gcc/testsuite/g++.dg/mv2.C b/gcc/testsuite/g++.dg/mv2.C
index f94877a674f..baaa5da350a 100644
--- a/gcc/testsuite/g++.dg/mv2.C
+++ b/gcc/testsuite/g++.dg/mv2.C
@@ -2,7 +2,7 @@
dispatching order when versions are for various ISAs. */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-require-ifunc "" } */
-/* { dg-options "-O2 -mno-sse -mno-mmx -mno-popcnt -mno-avx" } */
+/* { dg-options "-O2" } */
#include <assert.h>
diff --git a/gcc/testsuite/g++.dg/mv3.C b/gcc/testsuite/g++.dg/mv3.C
index c7088f2b013..ec2aa1ffec2 100644
--- a/gcc/testsuite/g++.dg/mv3.C
+++ b/gcc/testsuite/g++.dg/mv3.C
@@ -10,7 +10,7 @@
test should pass. */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O2 -mno-sse -mno-popcnt" } */
+/* { dg-options "-O2" } */
int __attribute__ ((target ("sse")))
diff --git a/gcc/testsuite/g++.dg/mv4.C b/gcc/testsuite/g++.dg/mv4.C
index ac5c5481c66..ff1cc2f63f4 100644
--- a/gcc/testsuite/g++.dg/mv4.C
+++ b/gcc/testsuite/g++.dg/mv4.C
@@ -4,7 +4,7 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-require-ifunc "" } */
-/* { dg-options "-O2 -mno-sse -mno-popcnt" } */
+/* { dg-options "-O2" } */
int __attribute__ ((target ("sse")))
foo ()
diff --git a/gcc/testsuite/g++.dg/mv5.C b/gcc/testsuite/g++.dg/mv5.C
index cac6d04e2e3..93daab650e0 100644
--- a/gcc/testsuite/g++.dg/mv5.C
+++ b/gcc/testsuite/g++.dg/mv5.C
@@ -3,7 +3,7 @@
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-require-ifunc "" } */
-/* { dg-options "-O2 -mno-popcnt" } */
+/* { dg-options "-O2" } */
/* Default version. */
diff --git a/gcc/testsuite/g++.dg/overload/defarg7.C b/gcc/testsuite/g++.dg/overload/defarg7.C
new file mode 100644
index 00000000000..8cc08f53869
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/defarg7.C
@@ -0,0 +1,12 @@
+struct A
+{
+ A(const char *);
+ explicit A(const int *);
+};
+
+void f (A a = 0);
+
+int main()
+{
+ f();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr55355.C b/gcc/testsuite/g++.dg/torture/pr55355.C
new file mode 100644
index 00000000000..6d8f8b6be1e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr55355.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+struct A
+{
+ void funcA(void);
+};
+
+struct B {};
+
+struct C
+{
+ void funcC(void) { a_mp->funcA(); }
+
+ char buf_ma[268435456];
+ A *a_mp;
+ B b_m;
+};
+
+void
+func(C *c_p)
+{
+ c_p->funcC();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44707.c b/gcc/testsuite/gcc.c-torture/compile/pr44707.c
index d5d39fc83c8..bad8177557e 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr44707.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr44707.c
@@ -1,3 +1,5 @@
+/* { dg-do compile { target powerpc-ibm-aix* } } */
+
extern struct { int a, b, c, d; } v;
extern int w;
diff --git a/gcc/testsuite/gcc.dg/pr55430.c b/gcc/testsuite/gcc.dg/pr55430.c
index dda02f3fac1..ac56cacea5a 100644
--- a/gcc/testsuite/gcc.dg/pr55430.c
+++ b/gcc/testsuite/gcc.dg/pr55430.c
@@ -11,6 +11,9 @@
#ifndef MAP_ANON
#define MAP_ANON 0
#endif
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
#include <stdlib.h>
struct S
diff --git a/gcc/testsuite/gcc.dg/pr55831.c b/gcc/testsuite/gcc.dg/pr55831.c
new file mode 100644
index 00000000000..ce7be63e1da
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr55831.c
@@ -0,0 +1,39 @@
+/* PR tree-optimization/55831 */
+/* { dg-do compile } */
+/* { dg-options "-O -fstrict-overflow -ftree-vectorize -Wno-unused-label" } */
+
+int g;
+short p, q;
+
+void
+foo (void)
+{
+ short a = p, b = q, i;
+
+ if (a)
+ {
+ label:
+ for (i = 0; i < 8; i++)
+ b ^= a++;
+
+ if (!b)
+ g = 0;
+ }
+}
+
+void
+bar (void)
+{
+ short a = p, b = q, i;
+
+ if (a)
+ {
+ label:
+ for (i = 0; i < 8; i++)
+ b ^= (a = a + 1);
+
+ if (!b)
+ g = 0;
+ }
+}
+
diff --git a/gcc/testsuite/gcc.dg/pthread-init-2.c b/gcc/testsuite/gcc.dg/pthread-init-2.c
index 3e8a17e23d7..8ec0515ba26 100644
--- a/gcc/testsuite/gcc.dg/pthread-init-2.c
+++ b/gcc/testsuite/gcc.dg/pthread-init-2.c
@@ -8,6 +8,7 @@
/* { dg-require-effective-target pthread_h } */
/* { dg-options "-Wextra -Wall -ansi" } */
/* { dg-options "-Wextra -Wall -ansi -D_POSIX_C_SOURCE=199506L" { target { *-*-hpux* } } } */
+/* { dg-options "-Wextra -Wall -ansi -D_XOPEN_SOURCE=500" { target { powerpc-ibm-aix* } } } */
#include "pthread-init-common.h"
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-2.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-2.c
new file mode 100644
index 00000000000..4c00e8fa71f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-2.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-require-effective-target int128 } */
+
+extern void abort (void);
+
+float __attribute__((noinline))
+f (__uint128_t x)
+{
+ return x + 1;
+}
+
+int
+main (void)
+{
+ if (f (0xffffffffu) == 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/tls/tls-reload-1.c b/gcc/testsuite/gcc.dg/torture/tls/tls-reload-1.c
new file mode 100644
index 00000000000..464a65122b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/tls/tls-reload-1.c
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+
+#define ARRAY(X) X##_array
+#define DECLARE(X) \
+ __thread int X; \
+ __thread int ARRAY(X)[4]; \
+ int *volatile *__attribute__((noinline)) \
+ check##X (int *volatile *y) \
+ { \
+ if (!y || *y++ != &X || *y++ != &ARRAY(X)[3]) \
+ return 0; \
+ return y; \
+ }
+#define COPY(X) *y++ = &X; *y++ = &ARRAY(X)[3];
+#define CHECK(X) y = check##X (y);
+#define A(M, X) M(X##0) M(X##1) M(X##2) M(X##3) M(X##4) M(X##5) M(X##6) M(X##7)
+#define B(M, X) A(M, X##0) A(M, X##1) A(M, X##2)
+#define C(M, X) B(M, X) B(M, X) B(M, X)
+
+#define NM 2
+#define NA (NM * 8)
+#define NB (NA * 3)
+#define NC (NB * 3)
+
+extern void abort (void);
+
+B(DECLARE, tls)
+
+void __attribute__ ((noinline))
+setup (int *volatile *y)
+{
+ C(COPY, tls)
+}
+
+int
+main (void)
+{
+ int *volatile array[NC];
+ int *volatile *y = array;
+ int i;
+
+ setup (array);
+ B(CHECK, tls);
+ if (!y)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c
index 523250dfd05..6220640459d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c
@@ -8,6 +8,6 @@ test(int c)
a[i]=5;
}
/* Array bounds says the loop will not roll much. */
-/* { dg-final { scan-tree-dump "Unrolled loop 1 completely .duplicated 2 times.." "cunrolli"} } */
+/* { dg-final { scan-tree-dump "Completely unroll loop 2 times" "cunrolli"} } */
/* { dg-final { scan-tree-dump "Last iteration exit edge was proved true." "cunrolli"} } */
/* { dg-final { cleanup-tree-dump "cunrolli" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c
index 8a54a801c6e..10f6645cf25 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c
@@ -12,5 +12,5 @@ test(int c)
}
}
/* We are not able to get rid of the final conditional because the loop has two exits. */
-/* { dg-final { scan-tree-dump "Unrolled loop 1 completely .duplicated 1 times.." "cunroll"} } */
+/* { dg-final { scan-tree-dump "Completely unroll loop 1 times" "cunroll"} } */
/* { dg-final { cleanup-tree-dump "cunroll" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c
index b621432c045..44de9606e9c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c
@@ -11,5 +11,5 @@ test(int c)
}
/* If we start duplicating headers prior curoll, this loop will have 0 iterations. */
-/* { dg-final { scan-tree-dump "Unrolled loop 1 completely .duplicated 1 times.." "cunrolli"} } */
+/* { dg-final { scan-tree-dump "Completely unroll loop 1 times" "cunrolli"} } */
/* { dg-final { cleanup-tree-dump "cunrolli" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c
index e42919c342f..9b70e95949f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c
@@ -16,6 +16,6 @@ test(int c)
/* We should do this as part of cunrolli, but our cost model do not take into account early exit
from the last iteration. */
-/* { dg-final { scan-tree-dump "Turned loop 1 to non-loop; it never loops." "ivcanon"} } */
+/* { dg-final { scan-tree-dump "Turned loop into non-loop; it never loops." "ivcanon"} } */
/* { dg-final { scan-tree-dump "Last iteration exit edge was proved true." "ivcanon"} } */
/* { dg-final { cleanup-tree-dump "ivcanon" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c
index 8d1a14a7837..f74e6b5093b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c
@@ -8,7 +8,7 @@ test(int c)
a[i]=5;
}
/* Basic testcase for complette unrolling. */
-/* { dg-final { scan-tree-dump "Unrolled loop 1 completely .duplicated 5 times.." "cunroll"} } */
+/* { dg-final { scan-tree-dump "Completely unroll loop 5 times" "cunroll"} } */
/* { dg-final { scan-tree-dump "Exit condition of peeled iterations was eliminated." "cunroll"} } */
/* { dg-final { scan-tree-dump "Last iteration exit edge was proved true." "cunroll"} } */
/* { dg-final { cleanup-tree-dump "cunroll" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c
index 35ff0be60fa..81178ae4c6e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c
@@ -33,7 +33,7 @@ int xxx(void)
/* { dg-final { scan-tree-dump-times "Added canonical iv to loop 1, 4 iterations" 1 "ivcanon"} } */
/* { dg-final { cleanup-tree-dump "ivcanon" } } */
-/* { dg-final { scan-tree-dump-times "Unrolled loop 1 completely" 1 "cunroll"} } */
+/* { dg-final { scan-tree-dump-times "Completely unroll loop 4 times" 1 "cunroll"} } */
/* { dg-final { cleanup-tree-dump "cunroll" } } */
/* { dg-final { scan-tree-dump-times "foo" 5 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-23.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-23.c
index 466d1758d1f..4f42491dad2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loop-23.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-23.c
@@ -24,6 +24,6 @@ int foo(void)
return sum;
}
-/* { dg-final { scan-tree-dump-times "Unrolled loop 1 completely" 1 "cunroll" } } */
+/* { dg-final { scan-tree-dump-times "Completely unroll loop 3 times" 1 "cunroll" } } */
/* { dg-final { cleanup-tree-dump "cunroll" } } */
diff --git a/gcc/testsuite/gcc.dg/unroll_1.c b/gcc/testsuite/gcc.dg/unroll_1.c
index 23e241bfce2..5818635cea9 100644
--- a/gcc/testsuite/gcc.dg/unroll_1.c
+++ b/gcc/testsuite/gcc.dg/unroll_1.c
@@ -28,5 +28,5 @@ int foo2(void)
return 1;
}
-/* { dg-final { scan-rtl-dump-times "Decided to peel loop completely" 2 "loop2_unroll" } } */
+/* { dg-final { scan-rtl-dump-times "Turned loop into non-loop; it never loops" 2 "loop2_unroll" } } */
/* { dg-final { cleanup-rtl-dump "loop2_unroll" } } */
diff --git a/gcc/testsuite/gcc.dg/unroll_2.c b/gcc/testsuite/gcc.dg/unroll_2.c
index 12912cf77db..9333bf97b1b 100644
--- a/gcc/testsuite/gcc.dg/unroll_2.c
+++ b/gcc/testsuite/gcc.dg/unroll_2.c
@@ -28,6 +28,6 @@ int foo2(void)
return 1;
}
-/* { dg-final { scan-rtl-dump-times "Decided to peel loop completely" 1 "loop2_unroll" } } */
+/* { dg-final { scan-rtl-dump-times "Turned loop into non-loop; it never loops" 1 "loop2_unroll" } } */
/* { dg-final { cleanup-rtl-dump "loop2_unroll" } } */
/* { dg-excess-errors "extra notes" } */
diff --git a/gcc/testsuite/gcc.dg/unroll_3.c b/gcc/testsuite/gcc.dg/unroll_3.c
index d86ed552aec..673069f3f33 100644
--- a/gcc/testsuite/gcc.dg/unroll_3.c
+++ b/gcc/testsuite/gcc.dg/unroll_3.c
@@ -28,6 +28,6 @@ int foo2(void)
return 1;
}
-/* { dg-final { scan-rtl-dump-times "Decided to peel loop completely" 1 "loop2_unroll" } } */
+/* { dg-final { scan-rtl-dump-times "Turned loop into non-loop; it never loops" 1 "loop2_unroll" } } */
/* { dg-final { cleanup-rtl-dump "loop2_unroll" } } */
/* { dg-excess-errors "extra notes" } */
diff --git a/gcc/testsuite/gcc.dg/unroll_4.c b/gcc/testsuite/gcc.dg/unroll_4.c
index 7c70157f583..d3fedd0de5c 100644
--- a/gcc/testsuite/gcc.dg/unroll_4.c
+++ b/gcc/testsuite/gcc.dg/unroll_4.c
@@ -28,6 +28,6 @@ int foo2(void)
return 1;
}
-/* { dg-final { scan-rtl-dump-times "Decided to peel loop completely" 1 "loop2_unroll" } } */
+/* { dg-final { scan-rtl-dump-times "Turned loop into non-loop; it never loops" 1 "loop2_unroll" } } */
/* { dg-final { cleanup-rtl-dump "loop2_unroll" } } */
/* { dg-excess-errors "extra notes" } */
diff --git a/gcc/testsuite/gcc.target/i386/builtin_target.c b/gcc/testsuite/gcc.target/i386/builtin_target.c
index ab6b82e6853..c40983e6b3c 100644
--- a/gcc/testsuite/gcc.target/i386/builtin_target.c
+++ b/gcc/testsuite/gcc.target/i386/builtin_target.c
@@ -9,12 +9,6 @@
#include <assert.h>
#include "cpuid.h"
-enum vendor_signatures
-{
- SIG_INTEL = 0x756e6547 /* Genu */,
- SIG_AMD = 0x68747541 /* Auth */
-};
-
/* Check if the Intel CPU model and sub-model are identified. */
static void
check_intel_cpu_model (unsigned int family, unsigned int model,
@@ -191,7 +185,7 @@ check_detailed ()
extended_model = (eax >> 12) & 0xf0;
extended_family = (eax >> 20) & 0xff;
- if (vendor == SIG_INTEL)
+ if (vendor == signature_INTEL_ebx)
{
assert (__builtin_cpu_is ("intel"));
/* Adjust family and model for Intel CPUs. */
@@ -205,7 +199,7 @@ check_detailed ()
check_intel_cpu_model (family, model, brand_id);
check_features (ecx, edx, max_level);
}
- else if (vendor == SIG_AMD)
+ else if (vendor == signature_AMD_ebx)
{
assert (__builtin_cpu_is ("amd"));
/* Adjust model and family for AMD CPUS. */
diff --git a/gcc/testsuite/gcc.target/i386/pr55775.c b/gcc/testsuite/gcc.target/i386/pr55775.c
new file mode 100644
index 00000000000..1902f688324
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr55775.c
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+int *ptr;
+int *fn1 (int *);
+int fn2 (int, int);
+int fn3 (void);
+int fn4 (int);
+
+static int
+foo (int x, int y, int z)
+{
+ int b;
+ asm ("" : "=a" (b), "=&d" (x) : "0" (y), "1" (x), "mr" (z));
+ return x;
+}
+
+static int
+bar (int x, int y)
+{
+ int a;
+ if (!y)
+ {
+ for (a = 0; a <= (x >> 1); )
+ ;
+ a = foo (y, fn2 (2, x), x);
+ if (x)
+ a = x;
+ return a;
+ }
+}
+
+static int
+baz (int x, int y)
+{
+ int *a = ptr;
+ int t, xk1 = fn3 (), xk = x * xk1;
+ for (t = 0; t < xk; t += xk1)
+ {
+ if (fn4 (a[2]))
+ return -y;
+ a = fn1 (a);
+ }
+ return 0;
+}
+
+void
+test (int x, long y, int z)
+{
+ int a = fn3 ();
+ int b;
+ int c = bar (x, z);
+ for (b = 0; b <= y; b++)
+ c = baz (x, c);
+ fn2 (c, a);
+}
diff --git a/gcc/testsuite/gcc.target/mips/pr55315.c b/gcc/testsuite/gcc.target/mips/pr55315.c
index c3f83329306..9dcf2893a77 100644
--- a/gcc/testsuite/gcc.target/mips/pr55315.c
+++ b/gcc/testsuite/gcc.target/mips/pr55315.c
@@ -5,7 +5,7 @@ int data[4096];
int
f (void)
{
- return (((unsigned int) &data[0]) == 0xdeadbea0U);
+ return (((unsigned long) &data[0]) == 0xdeadbea0U);
}
/* { dg-final { scan-assembler-not "\tmove\t\\\$2,\\\$0" } } */
diff --git a/gcc/testsuite/gcc.target/mips/r10k-cache-barrier-10.c b/gcc/testsuite/gcc.target/mips/r10k-cache-barrier-10.c
index 1b8c6f4ab49..ad0d2b0491b 100644
--- a/gcc/testsuite/gcc.target/mips/r10k-cache-barrier-10.c
+++ b/gcc/testsuite/gcc.target/mips/r10k-cache-barrier-10.c
@@ -9,6 +9,12 @@ unsigned char *bar (int);
NOMIPS16 void
foo (unsigned char *n)
{
+ /* n starts in $4, but will be in $2 after the call to bar.
+ Encourage it to be in $2 on entry to the loop as well,
+ by doing some computation on it beforehand (D?ADDIU $2,$4,4).
+ dbr_schedule should then pull the *n load (L[WD] ...,0($2))
+ into the delay slot. */
+ n += 4;
do
n = bar (*n + 1);
while (n);
diff --git a/gcc/testsuite/gfortran.dg/associated_7.f90 b/gcc/testsuite/gfortran.dg/associated_7.f90
new file mode 100644
index 00000000000..bc56f84c858
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associated_7.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+!
+! PR 55692: ICE on incorrect use of ASSOCIATED function
+!
+! Contributed by Gilbert Scott <gilbert.scott@easynet.co.uk>
+
+INTEGER, POINTER :: P1, P2
+PRINT *, ASSOCIATED([P1,P2]) ! { dg-error "must be a POINTER" }
+END
diff --git a/gcc/testsuite/gfortran.dg/eof_4.f90 b/gcc/testsuite/gfortran.dg/eof_4.f90
new file mode 100644
index 00000000000..293c0fa39f6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/eof_4.f90
@@ -0,0 +1,130 @@
+! { dg-do run }
+! PR55818 Reading a REAL from a file which doesn't end in a new line fails
+! Test case from PR reporter.
+implicit none
+integer :: stat
+!integer :: var ! << works
+real :: var ! << fails
+character(len=10) :: cvar ! << fails
+complex :: cval
+logical :: lvar
+
+open(99, file="test.dat", access="stream", form="unformatted", status="new")
+write(99) "1", new_line("")
+write(99) "2", new_line("")
+write(99) "3"
+close(99)
+
+! Test character kind
+open(99, file="test.dat")
+read (99,*, iostat=stat) cvar
+if (stat /= 0 .or. cvar /= "1") call abort()
+read (99,*, iostat=stat) cvar
+if (stat /= 0 .or. cvar /= "2") call abort()
+read (99,*, iostat=stat) cvar ! << FAILS: stat /= 0
+if (stat /= 0 .or. cvar /= "3") call abort() ! << aborts here
+
+! Test real kind
+rewind(99)
+read (99,*, iostat=stat) var
+if (stat /= 0 .or. var /= 1.0) call abort()
+read (99,*, iostat=stat) var
+if (stat /= 0 .or. var /= 2.0) call abort()
+read (99,*, iostat=stat) var ! << FAILS: stat /= 0
+if (stat /= 0 .or. var /= 3.0) call abort()
+close(99, status="delete")
+
+! Test real kind with exponents
+open(99, file="test.dat", access="stream", form="unformatted", status="new")
+write(99) "1.0e3", new_line("")
+write(99) "2.0e-03", new_line("")
+write(99) "3.0e2"
+close(99)
+
+open(99, file="test.dat")
+read (99,*, iostat=stat) var
+if (stat /= 0) call abort()
+read (99,*, iostat=stat) var
+if (stat /= 0) call abort()
+read (99,*) var ! << FAILS: stat /= 0
+if (stat /= 0) call abort()
+close(99, status="delete")
+
+! Test logical kind
+open(99, file="test.dat", access="stream", form="unformatted", status="new")
+write(99) "Tru", new_line("")
+write(99) "fal", new_line("")
+write(99) "t"
+close(99)
+
+open(99, file="test.dat")
+read (99,*, iostat=stat) lvar
+if (stat /= 0 .or. (.not.lvar)) call abort()
+read (99,*, iostat=stat) lvar
+if (stat /= 0 .or. lvar) call abort()
+read (99,*) lvar ! << FAILS: stat /= 0
+if (stat /= 0 .or. (.not.lvar)) call abort()
+close(99, status="delete")
+
+! Test combinations of Inf and Nan
+open(99, file="test.dat", access="stream", form="unformatted", status="new")
+write(99) "infinity", new_line("")
+write(99) "nan", new_line("")
+write(99) "infinity"
+close(99)
+
+open(99, file="test.dat")
+read (99,*, iostat=stat) var
+if (stat /= 0) call abort()
+read (99,*, iostat=stat) var
+if (stat /= 0) call abort()
+read (99,*) var ! << FAILS: stat /= 0
+if (stat /= 0) call abort ! << aborts here
+close(99, status="delete")
+
+open(99, file="test.dat", access="stream", form="unformatted", status="new")
+write(99) "infinity", new_line("")
+write(99) "inf", new_line("")
+write(99) "nan"
+close(99)
+
+open(99, file="test.dat")
+read (99,*, iostat=stat) var
+if (stat /= 0) call abort()
+read (99,*, iostat=stat) var
+if (stat /= 0) call abort()
+read (99,*) var ! << FAILS: stat /= 0
+if (stat /= 0) call abort ! << aborts here
+close(99, status="delete")
+
+open(99, file="test.dat", access="stream", form="unformatted", status="new")
+write(99) "infinity", new_line("")
+write(99) "nan", new_line("")
+write(99) "inf"
+close(99)
+
+open(99, file="test.dat")
+read (99,*, iostat=stat) var
+if (stat /= 0) call abort()
+read (99,*, iostat=stat) var
+if (stat /= 0) call abort()
+read (99,*) var ! << FAILS: stat /= 0
+if (stat /= 0) call abort ! << aborts here
+close(99, status="delete")
+
+! Test complex kind
+open(99, file="test.dat", access="stream", form="unformatted", status="new")
+write(99) "(1,2)", new_line("")
+write(99) "(2,3)", new_line("")
+write(99) "(4,5)"
+close(99)
+
+open(99, file="test.dat")
+read (99,*, iostat=stat) cval
+if (stat /= 0 .or. cval /= cmplx(1,2)) call abort()
+read (99,*, iostat=stat) cval
+if (stat /= 0 .or. cval /= cmplx(2,3)) call abort()
+read (99,*, iostat=stat) cval ! << FAILS: stat /= 0, value is okay
+if (stat /= 0 .or. cval /= cmplx(4,5)) call abort()
+close(99, status="delete")
+end
diff --git a/gcc/testsuite/gfortran.dg/inquire_15.f90 b/gcc/testsuite/gfortran.dg/inquire_15.f90
new file mode 100644
index 00000000000..e2aaf9ee17d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inquire_15.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+! PR48976 test case by jvdelisle@gcc.gnu.org
+character(len=20) :: str
+str = "abcdefg"
+inquire(file="abcddummy", stream=str)
+!print *, "str=",str
+if (str /= "UNKNOWN") call abort
+inquire(99, stream=str)
+!print *, "str=",str
+if (str /= "UNKNOWN") call abort
+open(99,access="stream")
+inquire(99, stream=str)
+!print *, "str=",str
+if (str /= "YES") goto 10
+close(99)
+open(99,access="direct", recl=16)
+inquire(99, stream=str)
+!print *, "str=",str
+if (str /= "NO") goto 10
+close(99)
+open(99,access="sequential")
+inquire(99, stream=str)
+!print *, "str=",str
+if (str /= "NO") goto 10
+stop
+10 close(99, status="delete")
+call abort
+end
diff --git a/gcc/testsuite/gfortran.dg/newunit_3.f90 b/gcc/testsuite/gfortran.dg/newunit_3.f90
new file mode 100644
index 00000000000..a0e5a8a75a7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/newunit_3.f90
@@ -0,0 +1,7 @@
+! { dg-do run }
+! PR48960 On ERROR newunit should not modify user variable.
+program test_newunit
+ integer :: st, un = 0
+ open (newunit=un, file='nonexisting.dat', status='old', iostat=st)
+ if (un /= 0) call abort
+end program test_newunit
diff --git a/gcc/testsuite/gfortran.dg/nosigned_zero_3.f90 b/gcc/testsuite/gfortran.dg/nosigned_zero_3.f90
new file mode 100644
index 00000000000..3f0f7101f26
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/nosigned_zero_3.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! { dg-options "-fno-sign-zero" }
+!
+! PR fortran/55539
+!
+program nosigned_zero_3
+ implicit none
+ character(len=20) :: s
+ real(4) :: x = -1.2e-3
+ real(8) :: y = -1.2e-3
+ write(s,'(7f10.3)') x
+ if (trim(adjustl(s)) /= "-0.001") call abort
+ write(s, '(7f10.3)') y
+ if (trim(adjustl(s)) /= "-0.001") call abort
+end program nosigned_zero_3
diff --git a/gcc/testsuite/gfortran.dg/public_private_module_8.f90 b/gcc/testsuite/gfortran.dg/public_private_module_8.f90
new file mode 100644
index 00000000000..bfc1b368f46
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/public_private_module_8.f90
@@ -0,0 +1,49 @@
+! { dg-do compile }
+! { dg-options "-O2" }
+!
+! PR fortran/54884
+!
+! Check that get_key_len is not optimized away as it
+! is used in a publicly visible specification expression.
+!
+
+module m
+ private
+ public :: foo
+ interface foo
+ module procedure bar
+ end interface foo
+contains
+ pure function mylen()
+ integer :: mylen
+ mylen = 42
+ end function mylen
+ pure function myotherlen()
+ integer :: myotherlen
+ myotherlen = 99
+ end function myotherlen
+ subroutine bar(x)
+ character(len=mylen()) :: x
+ character :: z2(myotherlen())
+ call internal(x)
+ block
+ character(len=myotherlen()) :: z
+ z = "abc"
+ x(1:5) = z
+ end block
+ x(6:10) = intern_func()
+ contains
+ function intern_func()
+ character(len=myotherlen()) :: intern_func
+ intern_func = "zuzu"
+ end function intern_func
+ subroutine internal(y)
+ character(len=myotherlen()) :: y
+ y = "abc"
+ end subroutine internal
+ end subroutine bar
+end module m
+
+! { dg-final { scan-assembler-not "__m_MOD_myotherlen" } }
+! { dg-final { scan-assembler "__m_MOD_bar" } }
+! { dg-final { scan-assembler "__m_MOD_mylen" } }
diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_4.f03 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_4.f03
new file mode 100644
index 00000000000..d289b69199f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_4.f03
@@ -0,0 +1,41 @@
+! { dg-do compile }
+!
+! Fix PR55763
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+!
+module mpi_f08_f
+ implicit none
+ abstract interface
+ subroutine user_function( inoutvec )
+ class(*), dimension(:), intent(inout) :: inoutvec
+ end subroutine user_function
+ end interface
+end module
+
+module mod_test1
+ use mpi_f08_f
+ implicit none
+contains
+ subroutine my_function( invec ) ! { dg-error "no IMPLICIT type" }
+ class(*), dimension(:), intent(inout) :: inoutvec ! { dg-error "not a DUMMY" }
+
+ select type (inoutvec)
+ type is (integer)
+ inoutvec = 2*inoutvec
+ end select
+ end subroutine my_function
+end module
+
+module mod_test2
+ use mpi_f08_f
+ implicit none
+contains
+ subroutine my_function( inoutvec ) ! Used to produce a BOGUS ERROR
+ class(*), dimension(:), intent(inout) :: inoutvec
+
+ select type (inoutvec)
+ type is (integer)
+ inoutvec = 2*inoutvec
+ end select
+ end subroutine my_function
+end module
diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_5.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_5.f90
new file mode 100644
index 00000000000..12a3c4a5624
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_5.f90
@@ -0,0 +1,41 @@
+! { dg-do run }
+!
+! PR fortran/55763
+!
+! Based on Reinhold Bader's test case
+!
+
+program mvall_03
+ implicit none
+ integer, parameter :: n1 = 100, n2 = 200
+ class(*), allocatable :: i1(:), i3(:)
+ integer, allocatable :: i2(:)
+
+ allocate(real :: i1(n1))
+ allocate(i2(n2))
+ i2 = 2
+ call move_alloc(i2, i1)
+ if (size(i1) /= n2 .or. allocated(i2)) then
+ call abort
+! write(*,*) 'FAIL'
+ else
+! write(*,*) 'OK'
+ end if
+
+ select type (i1)
+ type is (integer)
+ if (any (i1 /= 2)) call abort
+ class default
+ call abort()
+ end select
+ call move_alloc (i1, i3)
+ if (size(i3) /= n2 .or. allocated(i1)) then
+ call abort()
+ end if
+ select type (i3)
+ type is (integer)
+ if (any (i3 /= 2)) call abort
+ class default
+ call abort()
+ end select
+end program
diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_6.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_6.f90
new file mode 100644
index 00000000000..a64f4e393e2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_6.f90
@@ -0,0 +1,37 @@
+! { dg-do run }
+!
+! PR fortran/55763
+!
+! Contributed by Reinhold Bader
+!
+module mod_alloc_scalar_01
+contains
+ subroutine construct(this)
+ class(*), allocatable, intent(out) :: this
+ integer :: this_i
+ this_i = 4
+ allocate(this, source=this_i)
+ end subroutine
+end module
+
+program alloc_scalar_01
+ use mod_alloc_scalar_01
+ implicit none
+ class(*), allocatable :: mystuff
+
+ call construct(mystuff)
+ call construct(mystuff)
+
+ select type(mystuff)
+ type is (integer)
+ if (mystuff == 4) then
+! write(*,*) 'OK'
+ else
+ call abort()
+! write(*,*) 'FAIL 1'
+ end if
+ class default
+ call abort()
+! write(*,*) 'FAIL 2'
+ end select
+end program
diff --git a/gcc/testsuite/lib/c-compat.exp b/gcc/testsuite/lib/c-compat.exp
index ddbdd2d455e..bb928c2969d 100644
--- a/gcc/testsuite/lib/c-compat.exp
+++ b/gcc/testsuite/lib/c-compat.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2013
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -35,12 +35,16 @@ load_lib target-supports.exp
#
proc compat-use-alt-compiler { } {
global GCC_UNDER_TEST ALT_CC_UNDER_TEST
- global compat_same_alt
+ global compat_same_alt compat_alt_caret
+ global TEST_ALWAYS_FLAGS
# We don't need to do this if the alternate compiler is actually
# the same as the compiler under test.
if { $compat_same_alt == 0 } then {
set GCC_UNDER_TEST $ALT_CC_UNDER_TEST
+ if { $compat_alt_caret == 0 } then {
+ regsub -- "-fno-diagnostics-show-caret" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS
+ }
}
}
@@ -50,12 +54,14 @@ proc compat-use-alt-compiler { } {
proc compat-use-tst-compiler { } {
global GCC_UNDER_TEST compat_save_gcc_under_test
global compat_same_alt
+ global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS
# We don't need to do this if the alternate compiler is actually
# the same as the compiler under test.
if { $compat_same_alt == 0 } then {
set GCC_UNDER_TEST $compat_save_gcc_under_test
+ set TEST_ALWAYS_FLAGS $compat_save_TEST_ALWAYS_FLAGS
}
}
@@ -64,6 +70,11 @@ proc compat_setup_dfp { } {
global compat_use_alt
global compat_same_alt
global compat_have_dfp
+ global compat_alt_caret
+ global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS
+
+ set compat_alt_caret 0
+ set compat_save_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2
@@ -72,6 +83,15 @@ proc compat_setup_dfp { } {
set compat_have_dfp [check_effective_target_dfprt_nocache]
verbose "compat_have_dfp for tst compiler: $compat_have_dfp" 2
+ if { $compat_use_alt == 1 && $compat_same_alt == 0 } {
+ compat-use-alt-compiler
+ if { [check_no_compiler_messages_nocache compat_alt_has_caret object {
+ int dummy; } "-fno-diagnostics-show-caret"] != 0 } {
+ set compat_alt_caret 1
+ }
+ compat-use-tst-compiler
+ }
+
# If there is an alternate compiler, does it support decimal float types?
if { $compat_have_dfp == 1 && $compat_use_alt == 1 && $compat_same_alt == 0 } {
compat-use-alt-compiler
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 7124eba235d..a3828cbbec6 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -578,10 +578,10 @@ proc check_effective_target_pcc_bitfield_type_matters { } {
proc add_options_for_tls { flags } {
# On Solaris 9, __tls_get_addr/___tls_get_addr only lives in
- # libthread, so always pass -pthread for native TLS.
+ # libthread, so always pass -pthread for native TLS. Same for AIX.
# Need to duplicate native TLS check from
# check_effective_target_tls_native to avoid recursion.
- if { [istarget *-*-solaris2.9*] &&
+ if { ([istarget *-*-solaris2.9*] || [istarget powerpc-ibm-aix*]) &&
[check_no_messages_and_pattern tls_native "!emutls" assembly {
__thread int i;
int f (void) { return i; }
@@ -2646,10 +2646,10 @@ proc check_effective_target_powerpc_vsx_ok { } {
if { ([istarget powerpc*-*-*]
&& ![istarget powerpc-*-linux*paired*])
|| [istarget rs6000-*-*] } {
- # AltiVec is not supported on AIX before 5.3.
+ # VSX is not supported on AIX before 7.1.
if { [istarget powerpc*-*-aix4*]
- || [istarget powerpc*-*-aix5.1*]
- || [istarget powerpc*-*-aix5.2*] } {
+ || [istarget powerpc*-*-aix5*]
+ || [istarget powerpc*-*-aix6*] } {
return 0
}
return [check_no_compiler_messages powerpc_vsx_ok object {
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 21d8a514117..286ef266920 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -714,7 +714,12 @@ type_internals_preclude_sra_p (tree type, const char **msg)
{
*msg = "structure field size not fixed";
return true;
- }
+ }
+ if (!host_integerp (bit_position (fld), 0))
+ {
+ *msg = "structure field size too big";
+ return true;
+ }
if (AGGREGATE_TYPE_P (ft)
&& int_bit_position (fld) % BITS_PER_UNIT != 0)
{
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index eef613c4a77..1a872a32cc4 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -639,22 +639,24 @@ unloop_loops (bitmap loop_closed_ssa_invalidated,
/* Tries to unroll LOOP completely, i.e. NITER times.
UL determines which loops we are allowed to unroll.
- EXIT is the exit of the loop that should be eliminated.
+ EXIT is the exit of the loop that should be eliminated.
MAXITER specfy bound on number of iterations, -1 if it is
- not known or too large for HOST_WIDE_INT. */
+ not known or too large for HOST_WIDE_INT. The location
+ LOCUS corresponding to the loop is used when emitting
+ a summary of the unroll to the dump file. */
static bool
try_unroll_loop_completely (struct loop *loop,
edge exit, tree niter,
enum unroll_level ul,
- HOST_WIDE_INT maxiter)
+ HOST_WIDE_INT maxiter,
+ location_t locus)
{
unsigned HOST_WIDE_INT n_unroll, ninsns, max_unroll, unr_insns;
gimple cond;
struct loop_size size;
bool n_unroll_found = false;
edge edge_to_cancel = NULL;
- int num = loop->num;
/* See if we proved number of iterations to be low constant.
@@ -862,14 +864,25 @@ try_unroll_loop_completely (struct loop *loop,
loops_to_unloop.safe_push (loop);
loops_to_unloop_nunroll.safe_push (n_unroll);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (dump_enabled_p ())
{
if (!n_unroll)
- fprintf (dump_file, "Turned loop %d to non-loop; it never loops.\n",
- num);
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, locus,
+ "Turned loop into non-loop; it never loops.\n");
else
- fprintf (dump_file, "Unrolled loop %d completely "
- "(duplicated %i times).\n", num, (int)n_unroll);
+ {
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, locus,
+ "Completely unroll loop %d times", (int)n_unroll);
+ if (profile_info)
+ dump_printf (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS,
+ " (header execution count %d)",
+ (int)loop->header->count);
+ dump_printf (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, "\n");
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
if (exit)
fprintf (dump_file, "Exit condition of peeled iterations was "
"eliminated.\n");
@@ -898,15 +911,17 @@ canonicalize_loop_induction_variables (struct loop *loop,
tree niter;
HOST_WIDE_INT maxiter;
bool modified = false;
+ location_t locus = UNKNOWN_LOCATION;
niter = number_of_latch_executions (loop);
+ exit = single_exit (loop);
if (TREE_CODE (niter) == INTEGER_CST)
- exit = single_exit (loop);
+ locus = gimple_location (last_stmt (exit->src));
else
{
/* If the loop has more than one exit, try checking all of them
for # of iterations determinable through scev. */
- if (!single_exit (loop))
+ if (!exit)
niter = find_loop_niter (loop, &exit);
/* Finally if everything else fails, try brute force evaluation. */
@@ -915,6 +930,9 @@ canonicalize_loop_induction_variables (struct loop *loop,
|| TREE_CODE (niter) != INTEGER_CST))
niter = find_loop_niter_by_eval (loop, &exit);
+ if (exit)
+ locus = gimple_location (last_stmt (exit->src));
+
if (TREE_CODE (niter) != INTEGER_CST)
exit = NULL;
}
@@ -949,7 +967,7 @@ canonicalize_loop_induction_variables (struct loop *loop,
populates the loop bounds. */
modified |= remove_redundant_iv_tests (loop);
- if (try_unroll_loop_completely (loop, exit, niter, ul, maxiter))
+ if (try_unroll_loop_completely (loop, exit, niter, ul, maxiter, locus))
return true;
if (create_iv
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 4a09999f434..7a15ff82d5b 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -38,7 +38,6 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "diagnostic-core.h"
#include "tree-inline.h"
-#include "gmp.h"
#define SWAP(X, Y) do { affine_iv *tmp = (X); (X) = (Y); (Y) = tmp; } while (0)
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 633d3d1d972..f091604e492 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1,6 +1,6 @@
/* Loop Vectorization
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
+ 2013 Free Software Foundation, Inc.
Contributed by Dorit Naishlos <dorit@il.ibm.com> and
Ira Rosen <irar@il.ibm.com>
@@ -3406,7 +3406,7 @@ get_initial_def_for_induction (gimple iv_phi)
build1 (VIEW_CONVERT_EXPR, resvectype, induc_def), NULL_TREE);
induc_def = make_ssa_name (gimple_assign_lhs (new_stmt), new_stmt);
gimple_assign_set_lhs (new_stmt, induc_def);
- si = gsi_start_bb (bb);
+ si = gsi_after_labels (bb);
gsi_insert_before (&si, new_stmt, GSI_SAME_STMT);
set_vinfo_for_stmt (new_stmt,
new_stmt_vec_info (new_stmt, loop_vinfo, NULL));
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 1e8d7ee4401..da9f12b5c8c 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -4988,6 +4988,19 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
/* Record the mapping between SSA_NAMEs and statements. */
vect_record_grouped_load_vectors (stmt, dr_chain);
}
+ /* Handle invariant-load. */
+ else if (inv_p && !bb_vinfo)
+ {
+ gimple_stmt_iterator gsi2 = *gsi;
+ gcc_assert (!grouped_load && !slp_perm);
+ gsi_next (&gsi2);
+ new_temp = vect_init_vector (stmt, scalar_dest,
+ vectype, &gsi2);
+ new_stmt = SSA_NAME_DEF_STMT (new_temp);
+ /* Store vector loads in the corresponding SLP_NODE. */
+ if (slp)
+ SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt);
+ }
else
{
for (i = 0; i < vec_num; i++)
@@ -5135,17 +5148,6 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
}
}
- /* 4. Handle invariant-load. */
- if (inv_p && !bb_vinfo)
- {
- gimple_stmt_iterator gsi2 = *gsi;
- gcc_assert (!grouped_load);
- gsi_next (&gsi2);
- new_temp = vect_init_vector (stmt, scalar_dest,
- vectype, &gsi2);
- new_stmt = SSA_NAME_DEF_STMT (new_temp);
- }
-
if (negative)
{
tree perm_mask = perm_mask_for_reverse (vectype);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 4319c60802e..6b8cbf38d84 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -8766,9 +8766,11 @@ range_fits_type_p (value_range_t *vr, unsigned precision, bool unsigned_p)
|| TREE_CODE (vr->max) != INTEGER_CST)
return false;
- /* For precision-preserving sign-changes the MSB of the double-int
- has to be clear. */
- if (src_precision == precision
+ /* For sign changes, the MSB of the double_int has to be clear.
+ An unsigned value with its MSB set cannot be represented by
+ a signed double_int, while a negative value cannot be represented
+ by an unsigned double_int. */
+ if (TYPE_UNSIGNED (src_type) != unsigned_p
&& (TREE_INT_CST_HIGH (vr->min) | TREE_INT_CST_HIGH (vr->max)) < 0)
return false;
diff --git a/gcc/tree.c b/gcc/tree.c
index 429db49e1a8..7cacb2a0d64 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -7505,12 +7505,7 @@ build_array_type_1 (tree elt_type, tree index_type, bool shared)
hashval_t hashcode = iterative_hash_object (TYPE_HASH (elt_type), 0);
if (index_type)
hashcode = iterative_hash_object (TYPE_HASH (index_type), hashcode);
- tree old_t = t;
t = type_hash_canon (hashcode, t);
- if (t != old_t)
- /* Lay it out again in case the element type has been completed since
- the array was added to the hash table. */
- layout_type (t);
}
if (TYPE_CANONICAL (t) == t)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 53ebfbf2629..7d083fdacce 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -927,7 +927,7 @@ decode_reg_name (const char *name)
/* Return true if DECL's initializer is suitable for a BSS section. */
-static bool
+bool
bss_initializer_p (const_tree decl)
{
return (DECL_INITIAL (decl) == NULL
diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c
index 457d34f4b5b..d0733764bfc 100644
--- a/gcc/xcoffout.c
+++ b/gcc/xcoffout.c
@@ -67,6 +67,7 @@ static const char *xcoff_current_function_file;
char *xcoff_bss_section_name;
char *xcoff_private_data_section_name;
char *xcoff_tls_data_section_name;
+char *xcoff_tbss_section_name;
char *xcoff_read_only_section_name;
/* Last source file name mentioned in a NOTE insn. */
diff --git a/gcc/xcoffout.h b/gcc/xcoffout.h
index 9a35e2d7156..1692279d12b 100644
--- a/gcc/xcoffout.h
+++ b/gcc/xcoffout.h
@@ -127,6 +127,7 @@ extern const char *xcoff_current_include_file;
extern char *xcoff_bss_section_name;
extern char *xcoff_private_data_section_name;
extern char *xcoff_tls_data_section_name;
+extern char *xcoff_tbss_section_name;
extern char *xcoff_read_only_section_name;
/* Last source file name mentioned in a NOTE insn. */
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index 9cc767b936b..0e1415e6db9 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,17 @@
+2013-01-01 Ian Lance Taylor <iant@google.com>
+
+ PR bootstrap/54834
+ * Makefile.am (AM_CPPFLAGS): Remove -I ../gcc/include and -I
+ $(MULTIBUILDTOP)/../../gcc/include.
+ * Makefile.in: Rebuild.
+
+2013-01-01 Ian Lance Taylor <iant@google.com>
+
+ PR other/55536
+ * mmap.c (backtrace_alloc): Don't call sync functions if not
+ threaded.
+ (backtrace_free): Likewise.
+
2012-12-12 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* mmapio.c: Define MAP_FAILED if not defined.
@@ -26,6 +40,7 @@
PR other/55312
* configure.ac: Only add -Werror if building a target library.
+ * configure: Rebuild.
2012-11-12 Ian Lance Taylor <iant@google.com>
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am
index da1250234c6..b4542469490 100644
--- a/libbacktrace/Makefile.am
+++ b/libbacktrace/Makefile.am
@@ -32,7 +32,7 @@
ACLOCAL_AMFLAGS = -I .. -I ../config
AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
- -I ../libgcc -I ../gcc/include -I $(MULTIBUILDTOP)../../gcc/include
+ -I ../libgcc
AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in
index 3f4ebe59a98..f3728bf4dc5 100644
--- a/libbacktrace/Makefile.in
+++ b/libbacktrace/Makefile.in
@@ -274,7 +274,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I .. -I ../config
AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
- -I ../libgcc -I ../gcc/include -I $(MULTIBUILDTOP)../../gcc/include
+ -I ../libgcc
AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
noinst_LTLIBRARIES = libbacktrace.la
diff --git a/libbacktrace/mmap.c b/libbacktrace/mmap.c
index d3313c7cf1e..a6c730ecd23 100644
--- a/libbacktrace/mmap.c
+++ b/libbacktrace/mmap.c
@@ -84,6 +84,7 @@ backtrace_alloc (struct backtrace_state *state,
void *data)
{
void *ret;
+ int locked;
struct backtrace_freelist_struct **pp;
size_t pagesize;
size_t asksize;
@@ -96,7 +97,12 @@ backtrace_alloc (struct backtrace_state *state,
using mmap. __sync_lock_test_and_set returns the old state of
the lock, so we have acquired it if it returns 0. */
- if (!__sync_lock_test_and_set (&state->lock_alloc, 1))
+ if (!state->threaded)
+ locked = 1;
+ else
+ locked = __sync_lock_test_and_set (&state->lock_alloc, 1) == 0;
+
+ if (locked)
{
for (pp = &state->freelist; *pp != NULL; pp = &(*pp)->next)
{
@@ -120,7 +126,8 @@ backtrace_alloc (struct backtrace_state *state,
}
}
- __sync_lock_release (&state->lock_alloc);
+ if (state->threaded)
+ __sync_lock_release (&state->lock_alloc);
}
if (ret == NULL)
@@ -154,15 +161,24 @@ backtrace_free (struct backtrace_state *state, void *addr, size_t size,
backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED)
{
+ int locked;
+
/* If we can acquire the lock, add the new space to the free list.
If we can't acquire the lock, just leak the memory.
__sync_lock_test_and_set returns the old state of the lock, so we
have acquired it if it returns 0. */
- if (!__sync_lock_test_and_set (&state->lock_alloc, 1))
+
+ if (!state->threaded)
+ locked = 1;
+ else
+ locked = __sync_lock_test_and_set (&state->lock_alloc, 1) == 0;
+
+ if (locked)
{
backtrace_free_locked (state, addr, size);
- __sync_lock_release (&state->lock_alloc);
+ if (state->threaded)
+ __sync_lock_release (&state->lock_alloc);
}
}
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 56d77254299..01088f231ba 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,8 +1,89 @@
+2012-12-29 Andreas Schwab <schwab@linux-m68k.org>
+
+ * Makefile.am (ACLOCAL_AMFLAGS, TEXINFO_TEX, MAKEINFOFLAGS)
+ (STAMP_GENINSRC, STAMP_BUILD_INFO, CLEANFILES)
+ (MAINTAINERCLEANFILES): Define.
+ (all-local, stamp-geninsrc, stamp-build-info): New targets.
+ (doc/libffi.info): Depend on $(STAMP_BUILD_INFO)
+ * configure.ac: Check for modern makeinfo. Add support for
+ --enable-generated-files-in-srcdir.
+ * libffi/mdate-sh: New file.
+ * testsuite/lib/libffi.exp (load_gcc_lib): Load from gcc testsuite
+ lib dir.
+ (libffi-init): Properly set library paths for multilibs and add
+ path to libstdc++.
+ * configure: Regenerate.
+ * aclocal.m4: Regenerate.
+ * Makefile.in: Regenerate.
+ * doc/stamp-vti: Regenerate.
+ * doc/version.texi: Regenerate.
+ * fficonfig.h.in: Regenerate.
+ * include/Makefile.in: Regenerate.
+ * man/Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+
2012-10-31 Alan Modra <amodra@gmail.com>
* src/powerpc/linux64_closure.S: Add new ABI support.
* src/powerpc/linux64.S: Likewise.
+2012-10-30 Magnus Granberg <zorry@gentoo.org>
+ Pavel Labushev <pavel.labushev@runbox.ru>
+
+ * configure.ac: New options pax_emutramp
+ * configure, fficonfig.h.in: Regenerated
+ * src/closures.c: New function emutramp_enabled_check() and
+ checks.
+
+2012-10-30 Frederick Cheung <frederick.cheung@gmail.com>
+
+ * configure.ac: Enable FFI_MAP_EXEC_WRIT for Darwin 12 (mountain
+ lion) and future version.
+ * configure: Rebuild.
+
+2012-10-30 James Greenhalgh <james.greenhalgh at arm.com>
+ Marcus Shawcroft <marcus.shawcroft at arm.com>
+
+ * README: Add details of aarch64 port.
+ * src/aarch64/ffi.c: New.
+ * src/aarch64/ffitarget.h: Likewise.
+ * src/aarch64/sysv.S: Likewise.
+ * Makefile.am: Support aarch64.
+ * configure.ac: Support aarch64.
+ * Makefile.in, configure: Rebuilt.
+
+2012-10-30 James Greenhalgh <james.greenhalgh at arm.com>
+ Marcus Shawcroft <marcus.shawcroft at arm.com>
+
+ * testsuite/lib/libffi.exp: Add support for aarch64.
+ * testsuite/libffi.call/cls_struct_va1.c: New.
+ * testsuite/libffi.call/cls_uchar_va.c: Likewise.
+ * testsuite/libffi.call/cls_uint_va.c: Likewise.
+ * testsuite/libffi.call/cls_ulong_va.c: Likewise.
+ * testsuite/libffi.call/cls_ushort_va.c: Likewise.
+ * testsuite/libffi.call/nested_struct11.c: Likewise.
+ * testsuite/libffi.call/uninitialized.c: Likewise.
+ * testsuite/libffi.call/va_1.c: Likewise.
+ * testsuite/libffi.call/va_struct1.c: Likewise.
+ * testsuite/libffi.call/va_struct2.c: Likewise.
+ * testsuite/libffi.call/va_struct3.c: Likewise.
+
+2012-10-12 Walter Lee <walt@tilera.com>
+
+ * Makefile.am: Add TILE-Gx/TILEPro support.
+ * configure.ac: Likewise.
+ * Makefile.in: Regenerate.
+ * configure: Likewise.
+ * src/prep_cif.c (ffi_prep_cif_core): Handle TILE-Gx/TILEPro.
+ * src/tile: New directory.
+ * src/tile/ffi.c: New file.
+ * src/tile/ffitarget.h: Ditto.
+ * src/tile/tile.S: Ditto.
+
+2012-10-12 Matthias Klose <doko@ubuntu.com>
+
+ * generate-osx-source-and-headers.py: Normalize whitespace.
+
2012-09-14 David Edelsohn <dje.gcc@gmail.com>
* configure: Regenerated.
@@ -29,6 +110,248 @@
* configure: Regenerated.
+2012-05-05 Nicolas Lelong
+
+ * libffi.xcodeproj/project.pbxproj: Fixes.
+ * README: Update for iOS builds.
+
+2012-04-23 Alexandre Keunecke I. de Mendonca <alexandre.keunecke@gmail.com>
+
+ * configure.ac: Add Blackfin/sysv support
+ * Makefile.am: Add Blackfin/sysv support
+ * src/bfin/ffi.c: Add Blackfin/sysv support
+ * src/bfin/ffitarget.h: Add Blackfin/sysv support
+
+2012-04-11 Anthony Green <green@moxielogic.com>
+
+ * Makefile.am (EXTRA_DIST): Add new script.
+ * Makefile.in: Rebuilt.
+
+2012-04-11 Zachary Waldowski <zwaldowski@gmail.com>
+
+ * generate-ios-source-and-headers.py,
+ libffi.xcodeproj/project.pbxproj: Support a Mac static library via
+ Xcode. Set iOS compatibility to 4.0. Move iOS trampoline
+ generation into an Xcode "run script" phase. Include both as
+ Xcode build scripts. Don't always regenerate config files.
+
+2012-04-10 Anthony Green <green@moxielogic.com>
+
+ * src/powerpc/ffi_darwin.c (ffi_prep_args): Add missing semicolon.
+
+2012-04-06 Anthony Green <green@moxielogic.com>
+
+ * Makefile.am (EXTRA_DIST): Add new iOS/xcode files.
+ * Makefile.in: Rebuilt.
+
+2012-04-06 Mike Lewis <mikelikespie@gmail.com>
+
+ * generate-ios-source-and-headers.py: New file.
+ * libffi.xcodeproj/project.pbxproj: New file.
+ * README: Update instructions on building iOS binary.
+ * build-ios.sh: Delete.
+
+2012-04-06 Anthony Green <green@moxielogic.com>
+
+ * src/x86/ffi64.c (UINT128): Define differently for Intel and GNU
+ compilers, then use it.
+
+2012-04-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * m4/libtool.m4 (_LT_ENABLE_LOCK): Support x32.
+
+2012-04-06 Anthony Green <green@moxielogic.com>
+
+ * testsuite/Makefile.am (EXTRA_DIST): Add missing test cases.
+ * testsuite/Makefile.in: Rebuilt.
+
+2012-04-05 Zachary Waldowski <zwaldowski@gmail.com>
+
+ * include/ffi.h.in: Add missing trampoline table fields.
+ * src/arm/sysv.S: Fix ENTRY definition, and wrap symbol references
+ in CNAME.
+ * src/x86/ffi.c: Wrap Windows specific code in ifdefs.
+
+2012-03-29 Peter Rosin <peda@lysator.liu.se>
+
+ * src/x86/win32.S (ffi_closure_raw_THISCALL): Unify the frame
+ generation, fix the ENDP label and remove the surplus third arg
+ from the 'lea' insn.
+
+2012-03-29 Peter Rosin <peda@lysator.liu.se>
+
+ * src/x86/win32.S (ffi_closure_raw_SYSV): Make the 'stubraw' label
+ visible outside the PROC, so that ffi_closure_raw_THISCALL can see
+ it. Also instruct the assembler to add a frame to the function.
+
+2012-03-23 Peter Rosin <peda@lysator.liu.se>
+
+ * Makefile.am (AM_CPPFLAGS): Add -DFFI_BUILDING.
+ * Makefile.in: Rebuilt.
+ * include/ffi.h.in [MSVC]: Add __declspec(dllimport) decorations
+ to all data exports, when compiling libffi clients using MSVC.
+
+2012-03-29 Peter Rosin <peda@lysator.liu.se>
+
+ * src/x86/ffitarget.h (ffi_abi): Add new ABI FFI_MS_CDECL and
+ make it the default for MSVC.
+ (FFI_TYPE_MS_STRUCT): New structure return convention.
+ * src/x86/ffi.c (ffi_prep_cif_machdep): Tweak the structure
+ return convention for FFI_MS_CDECL to be FFI_TYPE_MS_STRUCT
+ instead of an ordinary FFI_TYPE_STRUCT.
+ (ffi_prep_args): Treat FFI_TYPE_MS_STRUCT as FFI_TYPE_STRUCT.
+ (ffi_call): Likewise.
+ (ffi_prep_incoming_args_SYSV): Likewise.
+ (ffi_raw_call): Likewise.
+ (ffi_prep_closure_loc): Treat FFI_MS_CDECL as FFI_SYSV.
+ * src/x86/win32.S (ffi_closure_SYSV): For FFI_TYPE_MS_STRUCT,
+ return a pointer to the result structure in eax and don't pop
+ that pointer from the stack, the caller takes care of it.
+ (ffi_call_win32): Treat FFI_TYPE_MS_STRUCT as FFI_TYPE_STRUCT.
+ (ffi_closure_raw_SYSV): Likewise.
+
+2012-03-22 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/libffi.call/closure_stdcall.c [MSVC]: Add inline
+ assembly version with Intel syntax.
+ * testsuite/libffi.call/closure_thiscall.c [MSVC]: Likewise.
+
+2012-03-23 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/libffi.call/ffitest.h: Provide abstration of
+ __attribute__((fastcall)) in the form of a __FASTCALL__
+ define. Define it to __fastcall for MSVC.
+ * testsuite/libffi.call/fastthis1_win32.c: Use the above.
+ * testsuite/libffi.call/fastthis2_win32.c: Likewise.
+ * testsuite/libffi.call/fastthis3_win32.c: Likewise.
+ * testsuite/libffi.call/strlen2_win32.c: Likewise.
+ * testsuite/libffi.call/struct1_win32.c: Likewise.
+ * testsuite/libffi.call/struct2_win32.c: Likewise.
+
+2012-03-22 Peter Rosin <peda@lysator.liu.se>
+
+ * src/x86/win32.S [MSVC] (ffi_closure_THISCALL): Remove the manual
+ frame on function entry, MASM adds one automatically.
+
+2012-03-22 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/libffi.call/ffitest.h [MSVC]: Add kludge for missing
+ bits in the MSVC headers.
+
+2012-03-22 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/libffi.call/cls_12byte.c: Adjust to the C89 style
+ with no declarations after statements.
+ * testsuite/libffi.call/cls_16byte.c: Likewise.
+ * testsuite/libffi.call/cls_18byte.c: Likewise.
+ * testsuite/libffi.call/cls_19byte.c: Likewise.
+ * testsuite/libffi.call/cls_1_1byte.c: Likewise.
+ * testsuite/libffi.call/cls_20byte.c: Likewise.
+ * testsuite/libffi.call/cls_20byte1.c: Likewise.
+ * testsuite/libffi.call/cls_24byte.c: Likewise.
+ * testsuite/libffi.call/cls_2byte.c: Likewise.
+ * testsuite/libffi.call/cls_3_1byte.c: Likewise.
+ * testsuite/libffi.call/cls_3byte1.c: Likewise.
+ * testsuite/libffi.call/cls_3byte2.c: Likewise.
+ * testsuite/libffi.call/cls_4_1byte.c: Likewise.
+ * testsuite/libffi.call/cls_4byte.c: Likewise.
+ * testsuite/libffi.call/cls_5_1_byte.c: Likewise.
+ * testsuite/libffi.call/cls_5byte.c: Likewise.
+ * testsuite/libffi.call/cls_64byte.c: Likewise.
+ * testsuite/libffi.call/cls_6_1_byte.c: Likewise.
+ * testsuite/libffi.call/cls_6byte.c: Likewise.
+ * testsuite/libffi.call/cls_7_1_byte.c: Likewise.
+ * testsuite/libffi.call/cls_7byte.c: Likewise.
+ * testsuite/libffi.call/cls_8byte.c: Likewise.
+ * testsuite/libffi.call/cls_9byte1.c: Likewise.
+ * testsuite/libffi.call/cls_9byte2.c: Likewise.
+ * testsuite/libffi.call/cls_align_double.c: Likewise.
+ * testsuite/libffi.call/cls_align_float.c: Likewise.
+ * testsuite/libffi.call/cls_align_longdouble.c: Likewise.
+ * testsuite/libffi.call/cls_align_longdouble_split.c: Likewise.
+ * testsuite/libffi.call/cls_align_longdouble_split2.c: Likewise.
+ * testsuite/libffi.call/cls_align_pointer.c: Likewise.
+ * testsuite/libffi.call/cls_align_sint16.c: Likewise.
+ * testsuite/libffi.call/cls_align_sint32.c: Likewise.
+ * testsuite/libffi.call/cls_align_sint64.c: Likewise.
+ * testsuite/libffi.call/cls_align_uint16.c: Likewise.
+ * testsuite/libffi.call/cls_align_uint32.c: Likewise.
+ * testsuite/libffi.call/cls_align_uint64.c: Likewise.
+ * testsuite/libffi.call/cls_dbls_struct.c: Likewise.
+ * testsuite/libffi.call/cls_pointer_stack.c: Likewise.
+ * testsuite/libffi.call/err_bad_typedef.c: Likewise.
+ * testsuite/libffi.call/huge_struct.c: Likewise.
+ * testsuite/libffi.call/nested_struct.c: Likewise.
+ * testsuite/libffi.call/nested_struct1.c: Likewise.
+ * testsuite/libffi.call/nested_struct10.c: Likewise.
+ * testsuite/libffi.call/nested_struct2.c: Likewise.
+ * testsuite/libffi.call/nested_struct3.c: Likewise.
+ * testsuite/libffi.call/nested_struct4.c: Likewise.
+ * testsuite/libffi.call/nested_struct5.c: Likewise.
+ * testsuite/libffi.call/nested_struct6.c: Likewise.
+ * testsuite/libffi.call/nested_struct7.c: Likewise.
+ * testsuite/libffi.call/nested_struct8.c: Likewise.
+ * testsuite/libffi.call/nested_struct9.c: Likewise.
+ * testsuite/libffi.call/stret_large.c: Likewise.
+ * testsuite/libffi.call/stret_large2.c: Likewise.
+ * testsuite/libffi.call/stret_medium.c: Likewise.
+ * testsuite/libffi.call/stret_medium2.c: Likewise.
+ * testsuite/libffi.call/struct1.c: Likewise.
+ * testsuite/libffi.call/struct1_win32.c: Likewise.
+ * testsuite/libffi.call/struct2.c: Likewise.
+ * testsuite/libffi.call/struct2_win32.c: Likewise.
+ * testsuite/libffi.call/struct3.c: Likewise.
+ * testsuite/libffi.call/struct4.c: Likewise.
+ * testsuite/libffi.call/struct5.c: Likewise.
+ * testsuite/libffi.call/struct6.c: Likewise.
+ * testsuite/libffi.call/struct7.c: Likewise.
+ * testsuite/libffi.call/struct8.c: Likewise.
+ * testsuite/libffi.call/struct9.c: Likewise.
+ * testsuite/libffi.call/testclosure.c: Likewise.
+
+2012-03-21 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/libffi.call/float_va.c (float_va_fn): Use %f when
+ printing doubles (%lf is for long doubles).
+ (main): Likewise.
+
+2012-03-21 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*]
+ (set_ld_library_path_env_vars): Add the library search dir to PATH
+ (and save PATH for later).
+ (restore_ld_library_path_env_vars): Restore PATH.
+
+2012-03-20 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/libffi.call/strlen2_win32.c (main): Remove bug.
+ * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label
+ visible outside the PROC, so that ffi_closure_THISCALL can see it.
+
+2012-03-20 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/libffi.call/strlen2_win32.c (main): Remove bug.
+ * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label
+ visible outside the PROC, so that ffi_closure_THISCALL can see it.
+
+2012-03-19 Alan Hourihane <alanh@fairlite.co.uk>
+
+ * src/m68k/ffi.c: Add MINT support.
+ * src/m68k/sysv.S: Ditto.
+
+2012-03-19 chennam <csit@axway.com>
+
+ * src/powerpc/ffi_darwin.c (ffi_prep_closure_loc): Fix AIX closure
+ support.
+
+2012-03-06 Chung-Lin Tang <cltang@codesourcery.com>
+
+ * src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call to
+ ffi_call_VFP().
+ (ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of
+ ffi_closure_VFP.
+ * src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code.
+
2012-04-02 Peter Bergner <bergner@vnet.ibm.com>
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp.
@@ -37,6 +360,14 @@
(ffi_call): Silence possibly undefined warning.
(ffi_closure_helper_SYSV): Declare variable type.
+2012-04-02 Peter Rosin <peda@lysator.liu.se>
+
+ * src/x86/win32.S (ffi_call_win32): Sign/zero extend the return
+ value in the Intel version as is already done for the AT&T version.
+ (ffi_closure_SYSV): Likewise.
+ (ffi_closure_raw_SYSV): Likewise.
+ (ffi_closure_STDCALL): Likewise.
+
2012-03-13 Kaz Kojima <kkojima@gcc.gnu.org>
* src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
diff --git a/libffi/ChangeLog.libffi b/libffi/ChangeLog.libffi
new file mode 100644
index 00000000000..f3ee8b0040c
--- /dev/null
+++ b/libffi/ChangeLog.libffi
@@ -0,0 +1,584 @@
+2011-02-08 Andreas Tobler <andreast@fgznet.ch>
+
+ * testsuite/lib/libffi.exp: Tweak for stand-alone mode.
+
+2009-12-25 Samuli Suominen <ssuominen@gentoo.org>
+
+ * configure.ac: Undefine _AC_ARG_VAR_PRECIOUS for autoconf 2.64.
+ * configure: Rebuilt.
+ * fficonfig.h.in: Rebuilt.
+
+2009-06-16 Andrew Haley <aph@redhat.com>
+
+ * testsuite/libffi.call/cls_align_sint64.c,
+ testsuite/libffi.call/cls_align_uint64.c,
+ testsuite/libffi.call/cls_longdouble_va.c,
+ testsuite/libffi.call/cls_ulonglong.c,
+ testsuite/libffi.call/return_ll1.c,
+ testsuite/libffi.call/stret_medium2.c: Fix printf format
+ specifiers.
+ * testsuite/libffi.call/huge_struct.c: Ad x86 XFAILs.
+ * testsuite/libffi.call/float2.c: Fix dg-excess-errors.
+ * testsuite/libffi.call/ffitest.h,
+ testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define.
+
+2009-06-12 Andrew Haley <aph@redhat.com>
+
+ * testsuite/libffi.call/cls_align_sint64.c,
+ testsuite/libffi.call/cls_align_uint64.c,
+ testsuite/libffi.call/cls_ulonglong.c,
+ testsuite/libffi.call/return_ll1.c,
+ testsuite/libffi.call/stret_medium2.c: Fix printf format
+ specifiers.
+ testsuite/libffi.special/unwindtest.cc: include stdint.h.
+
+2009-06-11 Timothy Wall <twall@users.sf.net>
+
+ * Makefile.am,
+ configure.ac,
+ include/ffi.h.in,
+ include/ffi_common.h,
+ src/closures.c,
+ src/dlmalloc.c,
+ src/x86/ffi.c,
+ src/x86/ffitarget.h,
+ src/x86/win64.S (new),
+ README: Added win64 support (mingw or MSVC)
+ * Makefile.in,
+ include/Makefile.in,
+ man/Makefile.in,
+ testsuite/Makefile.in,
+ configure,
+ aclocal.m4: Regenerated
+ * ltcf-c.sh: properly escape cygwin/w32 path
+ * man/ffi_call.3: Clarify size requirements for return value.
+ * src/x86/ffi64.c: Fix filename in comment.
+ * src/x86/win32.S: Remove unused extern.
+
+ * testsuite/libffi.call/closure_fn0.c,
+ testsuite/libffi.call/closure_fn1.c,
+ testsuite/libffi.call/closure_fn2.c,
+ testsuite/libffi.call/closure_fn3.c,
+ testsuite/libffi.call/closure_fn4.c,
+ testsuite/libffi.call/closure_fn5.c,
+ testsuite/libffi.call/closure_fn6.c,
+ testsuite/libffi.call/closure_stdcall.c,
+ testsuite/libffi.call/cls_12byte.c,
+ testsuite/libffi.call/cls_16byte.c,
+ testsuite/libffi.call/cls_18byte.c,
+ testsuite/libffi.call/cls_19byte.c,
+ testsuite/libffi.call/cls_1_1byte.c,
+ testsuite/libffi.call/cls_20byte.c,
+ testsuite/libffi.call/cls_20byte1.c,
+ testsuite/libffi.call/cls_24byte.c,
+ testsuite/libffi.call/cls_2byte.c,
+ testsuite/libffi.call/cls_3_1byte.c,
+ testsuite/libffi.call/cls_3byte1.c,
+ testsuite/libffi.call/cls_3byte2.c,
+ testsuite/libffi.call/cls_4_1byte.c,
+ testsuite/libffi.call/cls_4byte.c,
+ testsuite/libffi.call/cls_5_1_byte.c,
+ testsuite/libffi.call/cls_5byte.c,
+ testsuite/libffi.call/cls_64byte.c,
+ testsuite/libffi.call/cls_6_1_byte.c,
+ testsuite/libffi.call/cls_6byte.c,
+ testsuite/libffi.call/cls_7_1_byte.c,
+ testsuite/libffi.call/cls_7byte.c,
+ testsuite/libffi.call/cls_8byte.c,
+ testsuite/libffi.call/cls_9byte1.c,
+ testsuite/libffi.call/cls_9byte2.c,
+ testsuite/libffi.call/cls_align_double.c,
+ testsuite/libffi.call/cls_align_float.c,
+ testsuite/libffi.call/cls_align_longdouble.c,
+ testsuite/libffi.call/cls_align_longdouble_split.c,
+ testsuite/libffi.call/cls_align_longdouble_split2.c,
+ testsuite/libffi.call/cls_align_pointer.c,
+ testsuite/libffi.call/cls_align_sint16.c,
+ testsuite/libffi.call/cls_align_sint32.c,
+ testsuite/libffi.call/cls_align_sint64.c,
+ testsuite/libffi.call/cls_align_uint16.c,
+ testsuite/libffi.call/cls_align_uint32.c,
+ testsuite/libffi.call/cls_align_uint64.c,
+ testsuite/libffi.call/cls_dbls_struct.c,
+ testsuite/libffi.call/cls_double.c,
+ testsuite/libffi.call/cls_double_va.c,
+ testsuite/libffi.call/cls_float.c,
+ testsuite/libffi.call/cls_longdouble.c,
+ testsuite/libffi.call/cls_longdouble_va.c,
+ testsuite/libffi.call/cls_multi_schar.c,
+ testsuite/libffi.call/cls_multi_sshort.c,
+ testsuite/libffi.call/cls_multi_sshortchar.c,
+ testsuite/libffi.call/cls_multi_uchar.c,
+ testsuite/libffi.call/cls_multi_ushort.c,
+ testsuite/libffi.call/cls_multi_ushortchar.c,
+ testsuite/libffi.call/cls_pointer.c,
+ testsuite/libffi.call/cls_pointer_stack.c,
+ testsuite/libffi.call/cls_schar.c,
+ testsuite/libffi.call/cls_sint.c,
+ testsuite/libffi.call/cls_sshort.c,
+ testsuite/libffi.call/cls_uchar.c,
+ testsuite/libffi.call/cls_uint.c,
+ testsuite/libffi.call/cls_ulonglong.c,
+ testsuite/libffi.call/cls_ushort.c,
+ testsuite/libffi.call/err_bad_abi.c,
+ testsuite/libffi.call/err_bad_typedef.c,
+ testsuite/libffi.call/float2.c,
+ testsuite/libffi.call/huge_struct.c,
+ testsuite/libffi.call/nested_struct.c,
+ testsuite/libffi.call/nested_struct1.c,
+ testsuite/libffi.call/nested_struct10.c,
+ testsuite/libffi.call/nested_struct2.c,
+ testsuite/libffi.call/nested_struct3.c,
+ testsuite/libffi.call/nested_struct4.c,
+ testsuite/libffi.call/nested_struct5.c,
+ testsuite/libffi.call/nested_struct6.c,
+ testsuite/libffi.call/nested_struct7.c,
+ testsuite/libffi.call/nested_struct8.c,
+ testsuite/libffi.call/nested_struct9.c,
+ testsuite/libffi.call/problem1.c,
+ testsuite/libffi.call/return_ldl.c,
+ testsuite/libffi.call/return_ll1.c,
+ testsuite/libffi.call/stret_large.c,
+ testsuite/libffi.call/stret_large2.c,
+ testsuite/libffi.call/stret_medium.c,
+ testsuite/libffi.call/stret_medium2.c,
+ testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead
+ of checking for MMAP. Use intptr_t instead of long casts.
+
+2009-06-04 Andrew Haley <aph@redhat.com>
+
+ * src/powerpc/ffitarget.h: Fix misapplied merge from gcc.
+
+2009-06-04 Andrew Haley <aph@redhat.com>
+
+ * src/mips/o32.S,
+ src/mips/n32.S: Fix licence formatting.
+
+2009-06-04 Andrew Haley <aph@redhat.com>
+
+ * src/x86/darwin.S: Fix licence formatting.
+ src/x86/win32.S: Likewise.
+ src/sh64/sysv.S: Likewise.
+ src/sh/sysv.S: Likewise.
+
+2009-06-04 Andrew Haley <aph@redhat.com>
+
+ * src/sh64/ffi.c: Remove lint directives. Was missing from merge
+ of Andreas Tobler's patch from 2006-04-22.
+
+2009-06-04 Andrew Haley <aph@redhat.com>
+
+ * src/sh/ffi.c: Apply missing hunk from Alexandre Oliva's patch of
+ 2007-03-07.
+
+2008-12-26 Timothy Wall <twall@users.sf.net>
+
+ * testsuite/libffi.call/cls_longdouble.c,
+ testsuite/libffi.call/cls_longdouble_va.c,
+ testsuite/libffi.call/cls_align_longdouble.c,
+ testsuite/libffi.call/cls_align_longdouble_split.c,
+ testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected
+ failures on x86_64 cygwin/mingw.
+
+2008-12-22 Timothy Wall <twall@users.sf.net>
+
+ * testsuite/libffi.call/closure_fn0.c,
+ testsuite/libffi.call/closure_fn1.c,
+ testsuite/libffi.call/closure_fn2.c,
+ testsuite/libffi.call/closure_fn3.c,
+ testsuite/libffi.call/closure_fn4.c,
+ testsuite/libffi.call/closure_fn5.c,
+ testsuite/libffi.call/closure_fn6.c,
+ testsuite/libffi.call/closure_loc_fn0.c,
+ testsuite/libffi.call/closure_stdcall.c,
+ testsuite/libffi.call/cls_align_pointer.c,
+ testsuite/libffi.call/cls_pointer.c,
+ testsuite/libffi.call/cls_pointer_stack.c: use portable cast from
+ pointer to integer (intptr_t).
+ * testsuite/libffi.call/cls_longdouble.c: disable for win64.
+
+2008-12-19 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 3.0.8.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * libtool-version: Increment revision.
+ * README: Update for new release.
+
+2008-11-11 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 3.0.7.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * libtool-version: Increment revision.
+ * README: Update for new release.
+
+2008-08-25 Andreas Tobler <a.tobler@schweiz.org>
+
+ * src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and
+ FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum.
+ Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT.
+ Adjust copyright notice.
+ * src/powerpc/ffi.c: Add two new flags to indicate if we have one
+ register or two register to use for FFI_SYSV structs.
+ (ffi_prep_cif_machdep): Pass the right register flag introduced above.
+ (ffi_closure_helper_SYSV): Fix the return type for
+ FFI_SYSV_TYPE_SMALL_STRUCT. Comment.
+ Adjust copyright notice.
+
+2008-07-24 Anthony Green <green@redhat.com>
+
+ * testsuite/libffi.call/cls_dbls_struct.c,
+ testsuite/libffi.call/cls_double_va.c,
+ testsuite/libffi.call/cls_longdouble.c,
+ testsuite/libffi.call/cls_longdouble_va.c,
+ testsuite/libffi.call/cls_pointer.c,
+ testsuite/libffi.call/cls_pointer_stack.c,
+ testsuite/libffi.call/err_bad_abi.c: Clean up failures from
+ compiler warnings.
+
+2008-07-17 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 3.0.6.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * libtool-version: Increment revision. Add documentation.
+ * README: Update for new release.
+
+2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned
+ int.
+
+2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * src/sh/sysv.S: Add .note.GNU-stack on Linux.
+ * src/sh64/sysv.S: Likewise.
+
+2008-04-03 Anthony Green <green@redhat.com>
+
+ * libffi.pc.in (Libs): Add -L${libdir}.
+ * configure.ac: Bump version to 3.0.5.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * libtool-version: Increment revision.
+ * README: Update for new release.
+
+2008-04-03 Anthony Green <green@redhat.com>
+ Xerces Ranby <xerxes@zafena.se>
+
+ * include/ffi.h.in: Wrap definition of target architecture to
+ protect from double definitions.
+
+2008-03-22 Moriyoshi Koizumi <moriyoshi@gmail.com>
+
+ * src/x86/ffi.c (ffi_prep_closure_loc): Fix for bug revealed in
+ closure_loc_fn0.c.
+ * testsuite/libffi.call/closure_loc_fn0.c (closure_loc_test_fn0):
+ New test.
+
+2008-03-04 Anthony Green <green@redhat.com>
+ Blake Chaffin
+ hos@tamanegi.org
+
+ * testsuite/libffi.call/cls_align_longdouble_split2.c
+ testsuite/libffi.call/cls_align_longdouble_split.c
+ testsuite/libffi.call/cls_dbls_struct.c
+ testsuite/libffi.call/cls_double_va.c
+ testsuite/libffi.call/cls_longdouble.c
+ testsuite/libffi.call/cls_longdouble_va.c
+ testsuite/libffi.call/cls_pointer.c
+ testsuite/libffi.call/cls_pointer_stack.c
+ testsuite/libffi.call/err_bad_abi.c
+ testsuite/libffi.call/err_bad_typedef.c
+ testsuite/libffi.call/huge_struct.c
+ testsuite/libffi.call/stret_large2.c
+ testsuite/libffi.call/stret_large.c
+ testsuite/libffi.call/stret_medium2.c
+ testsuite/libffi.call/stret_medium.c: New tests from Apple.
+
+2008-02-26 Jakub Jelinek <jakub@redhat.com>
+ Anthony Green <green@redhat.com>
+
+ * src/alpha/osf.S: Add .note.GNU-stack on Linux.
+ * src/s390/sysv.S: Likewise.
+ * src/powerpc/linux64.S: Likewise.
+ * src/powerpc/linux64_closure.S: Likewise.
+ * src/powerpc/ppc_closure.S: Likewise.
+ * src/powerpc/sysv.S: Likewise.
+ * src/x86/unix64.S: Likewise.
+ * src/x86/sysv.S: Likewise.
+ * src/sparc/v8.S: Likewise.
+ * src/sparc/v9.S: Likewise.
+ * src/m68k/sysv.S: Likewise.
+ * src/ia64/unix.S: Likewise.
+ * src/arm/sysv.S: Likewise.
+
+2008-02-26 Anthony Green <green@redhat.com>
+ Thomas Heller <theller@ctypes.org>
+
+ * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C
+ comment.
+
+2008-02-26 Anthony Green <green@redhat.org>
+ Thomas Heller <theller@ctypes.org>
+
+ * include/ffi.h.in: Change void (*)() to void (*)(void).
+
+2008-02-26 Anthony Green <green@redhat.org>
+ Thomas Heller <theller@ctypes.org>
+
+ * src/alpha/ffi.c: Change void (*)() to void (*)(void).
+ src/alpha/osf.S, src/arm/ffi.c, src/frv/ffi.c, src/ia64/ffi.c,
+ src/ia64/unix.S, src/java_raw_api.c, src/m32r/ffi.c,
+ src/mips/ffi.c, src/pa/ffi.c, src/pa/hpux32.S, src/pa/linux.S,
+ src/powerpc/ffi.c, src/powerpc/ffi_darwin.c, src/raw_api.c,
+ src/s390/ffi.c, src/sh/ffi.c, src/sh64/ffi.c, src/sparc/ffi.c,
+ src/x86/ffi.c, src/x86/unix64.S, src/x86/darwin64.S,
+ src/x86/ffi64.c: Ditto.
+
+2008-02-24 Anthony Green <green@redhat.org>
+
+ * configure.ac: Accept openbsd*, not just openbsd.
+ Bump version to 3.0.4.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * libtool-version: Increment revision.
+ * README: Update for new release.
+
+2008-02-22 Anthony Green <green@redhat.com>
+
+ * README: Clean up list of tested platforms.
+
+2008-02-22 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 3.0.3.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * libtool-version: Increment revision.
+ * README: Update for new release. Clean up test docs.
+
+2008-02-22 Bjoern Koenig <bkoenig@alpha-tierchen.de>
+ Andreas Tobler <a.tobler@schweiz.org>
+
+ * configure.ac: Add amd64-*-freebsd* target.
+ * configure: Regenerate.
+
+2008-02-22 Thomas Heller <theller@ctypes.org>
+
+ * configure.ac: Add x86 OpenBSD support.
+ * configure: Rebuilt.
+
+2008-02-21 Thomas Heller <theller@ctypes.org>
+
+ * README: Change "make test" to "make check".
+
+2008-02-21 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 3.0.2.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * libtool-version: Increment revision.
+ * README: Update for new release.
+
+2008-02-21 Björn König <bkoenig@alpha-tierchen.de>
+
+ * src/x86/freebsd.S: New file.
+ * configure.ac: Add x86 FreeBSD support.
+ * Makefile.am: Ditto.
+
+2008-02-15 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 3.0.1.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * libtool-version: Increment revision.
+ * README: Update for new release.
+
+2008-02-15 David Daney <ddaney@avtrex.com>
+
+ * src/mips/ffi.c: Remove extra '>' from include directive.
+ (ffi_prep_closure_loc): Use clear_location instead of tramp.
+
+2008-02-15 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 3.0.0.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+
+2008-02-15 David Daney <ddaney@avtrex.com>
+
+ * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE):
+ Define (conditionally), and use it to include cachectl.h.
+ (ffi_prep_closure_loc): Fix cache flushing.
+ * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define.
+
+2008-02-15 Anthony Green <green@redhat.com>
+
+ * man/ffi_call.3, man/ffi_prep_cif.3, man/ffi.3:
+ Update dates and remove all references to ffi_prep_closure.
+ * configure.ac: Bump version to 2.99.9.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+
+2008-02-15 Anthony Green <green@redhat.com>
+
+ * man/ffi_prep_closure.3: Delete.
+ * man/Makefile.am (EXTRA_DIST): Remove ffi_prep_closure.3.
+ (man_MANS): Ditto.
+ * man/Makefile.in: Rebuilt.
+ * configure.ac: Bump version to 2.99.8.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 2.99.7.
+ * configure, doc/stamp-vti, doc/version.texi: Rebuilt.
+ * include/ffi.h.in LICENSE src/debug.c src/closures.c
+ src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h
+ src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c
+ src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S
+ src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c
+ src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c
+ src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S
+ src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h
+ src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c
+ src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S
+ src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h
+ src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h
+ src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S
+ src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h
+ src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S
+ src/arm/ffitarget.h src/prep_cif.c: Update license text.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * README: Update tested platforms.
+ * configure.ac: Bump version to 2.99.6.
+ * configure: Rebuilt.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * configure.ac: Bump version to 2.99.5.
+ * configure: Rebuilt.
+ * Makefile.am (EXTRA_DIST): Add darwin64.S
+ * Makefile.in: Rebuilt.
+ * testsuite/lib/libffi-dg.exp: Remove libstdc++ bits from GCC tree.
+ * LICENSE: Update WARRANTY.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * libffi.pc.in (libdir): Fix libdir definition.
+ * configure.ac: Bump version to 2.99.4.
+ * configure: Rebuilt.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * README: Update.
+ * libffi.info: New file.
+ * doc/stamp-vti: New file.
+ * configure.ac: Bump version to 2.99.3.
+ * configure: Rebuilt.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * Makefile.am (SUBDIRS): Add man dir.
+ * Makefile.in: Rebuilt.
+ * configure.ac: Create Makefile.
+ * configure: Rebuilt.
+ * man/ffi_call.3 man/ffi_prep_cif.3 man/ffi_prep_closure.3
+ man/Makefile.am man/Makefile.in: New files.
+
+2008-02-14 Tom Tromey <tromey@redhat.com>
+
+ * aclocal.m4, Makefile.in, configure, fficonfig.h.in: Rebuilt.
+ * mdate-sh, texinfo.tex: New files.
+ * Makefile.am (info_TEXINFOS): New variable.
+ * doc/libffi.texi: New file.
+ * doc/version.texi: Likewise.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * Makefile.am (AM_CFLAGS): Don't compile with -D$(TARGET).
+ (lib_LTLIBRARIES): Define.
+ (toolexeclib_LIBRARIES): Undefine.
+ * Makefile.in: Rebuilt.
+ * configure.ac: Reset version to 2.99.1.
+ * configure.in: Rebuilt.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * libffi.pc.in: Use @PACKAGE_NAME@ and @PACKAGE_VERSION@.
+ * configure.ac: Reset version to 2.99.1.
+ * configure.in: Rebuilt.
+ * Makefile.am (EXTRA_DIST): Add ChangeLog.libffi.
+ * Makefile.in: Rebuilt.
+ * LICENSE: Update copyright notice.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * include/Makefile.am (nodist_includes_HEADERS): Define. Don't
+ distribute ffitarget.h or ffi.h from the build include dir.
+ * Makefile.in: Rebuilt.
+
+2008-02-14 Anthony Green <green@redhat.com>
+
+ * include/Makefile.am (includesdir): Install headers under libdir.
+ (pkgconfigdir): Define. Install libffi.pc.
+ * include/Makefile.in: Rebuilt.
+ * libffi.pc.in: Create.
+ * libtool-version: Increment CURRENT
+ * configure.ac: Add libffi.pc.in
+ * configure: Rebuilt.
+
+2008-02-03 Anthony Green <green@redhat.com>
+
+ * include/Makefile.am (includesdir): Fix header install with
+ DESTDIR.
+ * include/Makefile.in: Rebuilt.
+
+2008-02-03 Timothy Wall <twall@users.sf.net>
+
+ * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return
+ offset based on code pointer, not data pointer.
+
+2008-02-01 Anthony Green <green@redhat.com>
+
+ * include/Makefile.am: Fix header installs.
+ * Makefile.am: Ditto.
+ * include/Makefile.in: Rebuilt.
+ * Makefile.in: Ditto.
+
+2008-02-01 Anthony Green <green@redhat.com>
+
+ * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL,
+ FFI_INIT_TRAMPOLINE): Revert my broken changes to twall's last
+ patch.
+
+2008-01-31 Anthony Green <green@redhat.com>
+
+ * Makefile.am (EXTRA_DIST): Add missing files.
+ * testsuite/Makefile.am: Ditto.
+ * Makefile.in, testsuite/Makefile.in: Rebuilt.
+
+2008-01-31 Timothy Wall <twall@users.sf.net>
+
+ * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall
+ closures.
+ * src/x86/ffitarget.h: Increase size of trampoline for stdcall
+ closures.
+ * src/x86/win32.S: Add assembly for stdcall closure.
+ * src/x86/ffi.c: Initialize stdcall closure trampoline.
+
+2008-01-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR libffi/34612
+ * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when
+ returning struct.
+
+ * testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer"
+ tests.
+
+2008-01-30 Anthony Green <green@redhat.com>
+
+ * Makefile.am, include/Makefile.am: Move headers to
+ libffi_la_SOURCES for new automake.
+ * Makefile.in, include/Makefile.in: Rebuilt.
+
+ * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for
+ execution outside of gcc tree.
+ * testsuite/lib/target-libpath.exp: Ditto.
+
+ * testsuite/lib/libffi-dg.exp: Many changes to allow for execution
+ outside of gcc tree.
+
diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index 23e002e9645..287f28e8839 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -5,32 +5,81 @@ ACLOCAL_AMFLAGS = -I .. -I ../config
SUBDIRS = include testsuite man
-EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
- src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
- src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \
- src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \
- src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \
- src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \
- src/ia64/unix.S \
- src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
- src/mips/ffitarget.h \
- src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \
- src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \
- src/powerpc/ffi.c src/powerpc/sysv.S \
- src/powerpc/linux64.S src/powerpc/linux64_closure.S \
- src/powerpc/ppc_closure.S src/powerpc/asm.h \
- src/powerpc/aix.S src/powerpc/darwin.S \
- src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
- src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
- src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
- src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \
- src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \
- src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \
- src/sparc/ffi.c src/x86/darwin64.S \
- src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/darwin.S \
- src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \
- src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \
- src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c
+EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
+ src/aarch64/ffi.c src/aarch64/ffitarget.h \
+ src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
+ src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \
+ src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \
+ src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \
+ src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \
+ src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
+ src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \
+ src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \
+ src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \
+ src/powerpc/linux64.S src/powerpc/linux64_closure.S \
+ src/powerpc/ppc_closure.S src/powerpc/asm.h \
+ src/powerpc/aix.S src/powerpc/darwin.S \
+ src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
+ src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
+ src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
+ src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \
+ src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \
+ src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \
+ src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \
+ src/x86/win32.S src/x86/darwin.S src/x86/win64.S \
+ src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \
+ src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \
+ src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \
+ src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \
+ src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \
+ src/tile/ffitarget.h src/tile/tile.S libtool-version \
+ ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \
+ m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \
+ m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \
+ generate-ios-source-and-headers.py \
+ generate-osx-source-and-headers.py \
+ libffi.xcodeproj/project.pbxproj src/arm/trampoline.S
+
+# Automake Documentation:
+# If your package has Texinfo files in many directories, you can use the
+# variable TEXINFO_TEX to tell Automake where to find the canonical
+# `texinfo.tex' for your package. The value of this variable should be
+# the relative path from the current `Makefile.am' to `texinfo.tex'.
+TEXINFO_TEX = ../gcc/doc/include/texinfo.tex
+
+# Defines info, dvi, pdf and html targets
+MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include
+info_TEXINFOS = doc/libffi.texi
+
+# AM_CONDITIONAL on configure option --generated-files-in-srcdir
+if GENINSRC
+STAMP_GENINSRC = stamp-geninsrc
+else
+STAMP_GENINSRC =
+endif
+
+# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
+if BUILD_INFO
+STAMP_BUILD_INFO = stamp-build-info
+else
+STAMP_BUILD_INFO =
+endif
+
+all-local: $(STAMP_GENINSRC)
+
+stamp-geninsrc: doc/libffi.info
+ cp -p $(top_builddir)/doc/libffi.info $(srcdir)/doc/libffi.info
+ @touch $@
+
+doc/libffi.info: $(STAMP_BUILD_INFO)
+
+stamp-build-info: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
+ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)/doc -o doc/libffi.info $(srcdir)/doc/libffi.texi
+ @touch $@
+
+
+CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/libffi.info
+MAINTAINERCLEANFILES = $(srcdir)/doc/libffi.info
## ################################################################
@@ -84,14 +133,21 @@ MAKEOVERRIDES=
toolexeclib_LTLIBRARIES = libffi.la
noinst_LTLIBRARIES = libffi_convenience.la
-libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \
+libffi_la_SOURCES = src/prep_cif.c src/types.c \
src/raw_api.c src/java_raw_api.c src/closures.c
nodist_libffi_la_SOURCES =
+if FFI_DEBUG
+nodist_libffi_la_SOURCES += src/debug.c
+endif
+
if MIPS
nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S
endif
+if BFIN
+nodist_libffi_la_SOURCES += src/bfin/ffi.c src/bfin/sysv.S
+endif
if X86
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S
endif
@@ -134,8 +190,14 @@ endif
if POWERPC_FREEBSD
nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
endif
+if AARCH64
+nodist_libffi_la_SOURCES += src/aarch64/sysv.S src/aarch64/ffi.c
+endif
if ARM
nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c
+if FFI_EXEC_TRAMPOLINE_TABLE
+nodist_libffi_la_SOURCES += src/arm/trampoline.S
+endif
endif
if AVR32
nodist_libffi_la_SOURCES += src/avr32/sysv.S src/avr32/ffi.c
@@ -164,6 +226,9 @@ endif
if PA_HPUX
nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c
endif
+if TILE
+nodist_libffi_la_SOURCES += src/tile/tile.S src/tile/ffi.c
+endif
libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 74ee5370131..cd0fd031a4b 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -35,41 +35,49 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@MIPS_TRUE@am__append_1 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
-@X86_TRUE@am__append_2 = src/x86/ffi.c src/x86/sysv.S
-@X86_FREEBSD_TRUE@am__append_3 = src/x86/ffi.c src/x86/freebsd.S
-@X86_WIN32_TRUE@am__append_4 = src/x86/ffi.c src/x86/win32.S
-@X86_WIN64_TRUE@am__append_5 = src/x86/ffi.c src/x86/win64.S
-@X86_DARWIN_TRUE@am__append_6 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
-@SPARC_TRUE@am__append_7 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
-@ALPHA_TRUE@am__append_8 = src/alpha/ffi.c src/alpha/osf.S
-@IA64_TRUE@am__append_9 = src/ia64/ffi.c src/ia64/unix.S
-@M32R_TRUE@am__append_10 = src/m32r/sysv.S src/m32r/ffi.c
-@M68K_TRUE@am__append_11 = src/m68k/ffi.c src/m68k/sysv.S
-@POWERPC_TRUE@am__append_12 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
-@POWERPC_AIX_TRUE@am__append_13 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
-@POWERPC_DARWIN_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
-@POWERPC_FREEBSD_TRUE@am__append_15 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
-@ARM_TRUE@am__append_16 = src/arm/sysv.S src/arm/ffi.c
-@AVR32_TRUE@am__append_17 = src/avr32/sysv.S src/avr32/ffi.c
-@LIBFFI_CRIS_TRUE@am__append_18 = src/cris/sysv.S src/cris/ffi.c
-@FRV_TRUE@am__append_19 = src/frv/eabi.S src/frv/ffi.c
-@S390_TRUE@am__append_20 = src/s390/sysv.S src/s390/ffi.c
-@X86_64_TRUE@am__append_21 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
-@SH_TRUE@am__append_22 = src/sh/sysv.S src/sh/ffi.c
-@SH64_TRUE@am__append_23 = src/sh64/sysv.S src/sh64/ffi.c
-@PA_LINUX_TRUE@am__append_24 = src/pa/linux.S src/pa/ffi.c
-@PA_HPUX_TRUE@am__append_25 = src/pa/hpux32.S src/pa/ffi.c
+@FFI_DEBUG_TRUE@am__append_1 = src/debug.c
+@MIPS_TRUE@am__append_2 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
+@BFIN_TRUE@am__append_3 = src/bfin/ffi.c src/bfin/sysv.S
+@X86_TRUE@am__append_4 = src/x86/ffi.c src/x86/sysv.S
+@X86_FREEBSD_TRUE@am__append_5 = src/x86/ffi.c src/x86/freebsd.S
+@X86_WIN32_TRUE@am__append_6 = src/x86/ffi.c src/x86/win32.S
+@X86_WIN64_TRUE@am__append_7 = src/x86/ffi.c src/x86/win64.S
+@X86_DARWIN_TRUE@am__append_8 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
+@SPARC_TRUE@am__append_9 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
+@ALPHA_TRUE@am__append_10 = src/alpha/ffi.c src/alpha/osf.S
+@IA64_TRUE@am__append_11 = src/ia64/ffi.c src/ia64/unix.S
+@M32R_TRUE@am__append_12 = src/m32r/sysv.S src/m32r/ffi.c
+@M68K_TRUE@am__append_13 = src/m68k/ffi.c src/m68k/sysv.S
+@POWERPC_TRUE@am__append_14 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
+@POWERPC_AIX_TRUE@am__append_15 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
+@POWERPC_DARWIN_TRUE@am__append_16 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
+@POWERPC_FREEBSD_TRUE@am__append_17 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
+@AARCH64_TRUE@am__append_18 = src/aarch64/sysv.S src/aarch64/ffi.c
+@ARM_TRUE@am__append_19 = src/arm/sysv.S src/arm/ffi.c
+@ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE@am__append_20 = src/arm/trampoline.S
+@AVR32_TRUE@am__append_21 = src/avr32/sysv.S src/avr32/ffi.c
+@LIBFFI_CRIS_TRUE@am__append_22 = src/cris/sysv.S src/cris/ffi.c
+@FRV_TRUE@am__append_23 = src/frv/eabi.S src/frv/ffi.c
+@S390_TRUE@am__append_24 = src/s390/sysv.S src/s390/ffi.c
+@X86_64_TRUE@am__append_25 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
+@SH_TRUE@am__append_26 = src/sh/sysv.S src/sh/ffi.c
+@SH64_TRUE@am__append_27 = src/sh64/sysv.S src/sh64/ffi.c
+@PA_LINUX_TRUE@am__append_28 = src/pa/linux.S src/pa/ffi.c
+@PA_HPUX_TRUE@am__append_29 = src/pa/hpux32.S src/pa/ffi.c
+@TILE_TRUE@am__append_30 = src/tile/tile.S src/tile/ffi.c
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/../compile \
$(srcdir)/../config.guess $(srcdir)/../config.sub \
$(srcdir)/../depcomp $(srcdir)/../install-sh \
$(srcdir)/../ltmain.sh $(srcdir)/../missing \
$(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/fficonfig.h.in \
- $(top_srcdir)/configure ChangeLog
+ $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \
+ $(srcdir)/doc/version.texi $(srcdir)/fficonfig.h.in \
+ $(top_srcdir)/configure ChangeLog mdate-sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/asmcfi.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -106,50 +114,55 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)"
LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
libffi_la_LIBADD =
am__dirstamp = $(am__leading_dot)dirstamp
-am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
- src/raw_api.lo src/java_raw_api.lo src/closures.lo
-@MIPS_TRUE@am__objects_1 = src/mips/ffi.lo src/mips/o32.lo \
+am_libffi_la_OBJECTS = src/prep_cif.lo src/types.lo src/raw_api.lo \
+ src/java_raw_api.lo src/closures.lo
+@FFI_DEBUG_TRUE@am__objects_1 = src/debug.lo
+@MIPS_TRUE@am__objects_2 = src/mips/ffi.lo src/mips/o32.lo \
@MIPS_TRUE@ src/mips/n32.lo
-@X86_TRUE@am__objects_2 = src/x86/ffi.lo src/x86/sysv.lo
-@X86_FREEBSD_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/freebsd.lo
-@X86_WIN32_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/win32.lo
-@X86_WIN64_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/win64.lo
-@X86_DARWIN_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/darwin.lo \
+@BFIN_TRUE@am__objects_3 = src/bfin/ffi.lo src/bfin/sysv.lo
+@X86_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/sysv.lo
+@X86_FREEBSD_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/freebsd.lo
+@X86_WIN32_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/win32.lo
+@X86_WIN64_TRUE@am__objects_7 = src/x86/ffi.lo src/x86/win64.lo
+@X86_DARWIN_TRUE@am__objects_8 = src/x86/ffi.lo src/x86/darwin.lo \
@X86_DARWIN_TRUE@ src/x86/ffi64.lo src/x86/darwin64.lo
-@SPARC_TRUE@am__objects_7 = src/sparc/ffi.lo src/sparc/v8.lo \
+@SPARC_TRUE@am__objects_9 = src/sparc/ffi.lo src/sparc/v8.lo \
@SPARC_TRUE@ src/sparc/v9.lo
-@ALPHA_TRUE@am__objects_8 = src/alpha/ffi.lo src/alpha/osf.lo
-@IA64_TRUE@am__objects_9 = src/ia64/ffi.lo src/ia64/unix.lo
-@M32R_TRUE@am__objects_10 = src/m32r/sysv.lo src/m32r/ffi.lo
-@M68K_TRUE@am__objects_11 = src/m68k/ffi.lo src/m68k/sysv.lo
-@POWERPC_TRUE@am__objects_12 = src/powerpc/ffi.lo src/powerpc/sysv.lo \
+@ALPHA_TRUE@am__objects_10 = src/alpha/ffi.lo src/alpha/osf.lo
+@IA64_TRUE@am__objects_11 = src/ia64/ffi.lo src/ia64/unix.lo
+@M32R_TRUE@am__objects_12 = src/m32r/sysv.lo src/m32r/ffi.lo
+@M68K_TRUE@am__objects_13 = src/m68k/ffi.lo src/m68k/sysv.lo
+@POWERPC_TRUE@am__objects_14 = src/powerpc/ffi.lo src/powerpc/sysv.lo \
@POWERPC_TRUE@ src/powerpc/ppc_closure.lo \
@POWERPC_TRUE@ src/powerpc/linux64.lo \
@POWERPC_TRUE@ src/powerpc/linux64_closure.lo
-@POWERPC_AIX_TRUE@am__objects_13 = src/powerpc/ffi_darwin.lo \
+@POWERPC_AIX_TRUE@am__objects_15 = src/powerpc/ffi_darwin.lo \
@POWERPC_AIX_TRUE@ src/powerpc/aix.lo \
@POWERPC_AIX_TRUE@ src/powerpc/aix_closure.lo
-@POWERPC_DARWIN_TRUE@am__objects_14 = src/powerpc/ffi_darwin.lo \
+@POWERPC_DARWIN_TRUE@am__objects_16 = src/powerpc/ffi_darwin.lo \
@POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \
@POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo
-@POWERPC_FREEBSD_TRUE@am__objects_15 = src/powerpc/ffi.lo \
+@POWERPC_FREEBSD_TRUE@am__objects_17 = src/powerpc/ffi.lo \
@POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \
@POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo
-@ARM_TRUE@am__objects_16 = src/arm/sysv.lo src/arm/ffi.lo
-@AVR32_TRUE@am__objects_17 = src/avr32/sysv.lo src/avr32/ffi.lo
-@LIBFFI_CRIS_TRUE@am__objects_18 = src/cris/sysv.lo src/cris/ffi.lo
-@FRV_TRUE@am__objects_19 = src/frv/eabi.lo src/frv/ffi.lo
-@S390_TRUE@am__objects_20 = src/s390/sysv.lo src/s390/ffi.lo
-@X86_64_TRUE@am__objects_21 = src/x86/ffi64.lo src/x86/unix64.lo \
+@AARCH64_TRUE@am__objects_18 = src/aarch64/sysv.lo src/aarch64/ffi.lo
+@ARM_TRUE@am__objects_19 = src/arm/sysv.lo src/arm/ffi.lo
+@ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE@am__objects_20 = src/arm/trampoline.lo
+@AVR32_TRUE@am__objects_21 = src/avr32/sysv.lo src/avr32/ffi.lo
+@LIBFFI_CRIS_TRUE@am__objects_22 = src/cris/sysv.lo src/cris/ffi.lo
+@FRV_TRUE@am__objects_23 = src/frv/eabi.lo src/frv/ffi.lo
+@S390_TRUE@am__objects_24 = src/s390/sysv.lo src/s390/ffi.lo
+@X86_64_TRUE@am__objects_25 = src/x86/ffi64.lo src/x86/unix64.lo \
@X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo
-@SH_TRUE@am__objects_22 = src/sh/sysv.lo src/sh/ffi.lo
-@SH64_TRUE@am__objects_23 = src/sh64/sysv.lo src/sh64/ffi.lo
-@PA_LINUX_TRUE@am__objects_24 = src/pa/linux.lo src/pa/ffi.lo
-@PA_HPUX_TRUE@am__objects_25 = src/pa/hpux32.lo src/pa/ffi.lo
+@SH_TRUE@am__objects_26 = src/sh/sysv.lo src/sh/ffi.lo
+@SH64_TRUE@am__objects_27 = src/sh64/sysv.lo src/sh64/ffi.lo
+@PA_LINUX_TRUE@am__objects_28 = src/pa/linux.lo src/pa/ffi.lo
+@PA_HPUX_TRUE@am__objects_29 = src/pa/hpux32.lo src/pa/ffi.lo
+@TILE_TRUE@am__objects_30 = src/tile/tile.lo src/tile/ffi.lo
nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_3) $(am__objects_4) $(am__objects_5) \
$(am__objects_6) $(am__objects_7) $(am__objects_8) \
@@ -158,17 +171,19 @@ nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_15) $(am__objects_16) $(am__objects_17) \
$(am__objects_18) $(am__objects_19) $(am__objects_20) \
$(am__objects_21) $(am__objects_22) $(am__objects_23) \
- $(am__objects_24) $(am__objects_25)
+ $(am__objects_24) $(am__objects_25) $(am__objects_26) \
+ $(am__objects_27) $(am__objects_28) $(am__objects_29) \
+ $(am__objects_30)
libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \
$(nodist_libffi_la_OBJECTS)
libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libffi_la_LDFLAGS) $(LDFLAGS) -o $@
libffi_convenience_la_LIBADD =
-am__objects_26 = src/debug.lo src/prep_cif.lo src/types.lo \
- src/raw_api.lo src/java_raw_api.lo src/closures.lo
-am_libffi_convenience_la_OBJECTS = $(am__objects_26)
-am__objects_27 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+am__objects_31 = src/prep_cif.lo src/types.lo src/raw_api.lo \
+ src/java_raw_api.lo src/closures.lo
+am_libffi_convenience_la_OBJECTS = $(am__objects_31)
+am__objects_32 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
$(am__objects_7) $(am__objects_8) $(am__objects_9) \
$(am__objects_10) $(am__objects_11) $(am__objects_12) \
@@ -176,8 +191,9 @@ am__objects_27 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
$(am__objects_16) $(am__objects_17) $(am__objects_18) \
$(am__objects_19) $(am__objects_20) $(am__objects_21) \
$(am__objects_22) $(am__objects_23) $(am__objects_24) \
- $(am__objects_25)
-nodist_libffi_convenience_la_OBJECTS = $(am__objects_27)
+ $(am__objects_25) $(am__objects_26) $(am__objects_27) \
+ $(am__objects_28) $(am__objects_29) $(am__objects_30)
+nodist_libffi_convenience_la_OBJECTS = $(am__objects_32)
libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \
$(nodist_libffi_convenience_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
@@ -208,6 +224,18 @@ MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
+INFO_DEPS = doc/libffi.info
+am__TEXINFO_TEX_DIR = $(srcdir)/../gcc/doc/include
+DVIS = doc/libffi.dvi
+PDFS = doc/libffi.pdf
+PSS = doc/libffi.ps
+HTMLS = doc/libffi.html
+TEXINFOS = doc/libffi.texi
+TEXI2DVI = texi2dvi
+TEXI2PDF = $(TEXI2DVI) --pdf --batch
+MAKEINFOHTML = $(MAKEINFO) --html
+AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
+DVIPS = dvips
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
@@ -287,6 +315,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@
FGREP = @FGREP@
GREP = @GREP@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
@@ -389,33 +418,62 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign subdir-objects
ACLOCAL_AMFLAGS = -I .. -I ../config
SUBDIRS = include testsuite man
-EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
- src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
- src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \
- src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \
- src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \
- src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \
- src/ia64/unix.S \
- src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
- src/mips/ffitarget.h \
- src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \
- src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \
- src/powerpc/ffi.c src/powerpc/sysv.S \
- src/powerpc/linux64.S src/powerpc/linux64_closure.S \
- src/powerpc/ppc_closure.S src/powerpc/asm.h \
- src/powerpc/aix.S src/powerpc/darwin.S \
- src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
- src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
- src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
- src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \
- src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \
- src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \
- src/sparc/ffi.c src/x86/darwin64.S \
- src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/darwin.S \
- src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \
- src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \
- src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c
-
+EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
+ src/aarch64/ffi.c src/aarch64/ffitarget.h \
+ src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
+ src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \
+ src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \
+ src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \
+ src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \
+ src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
+ src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \
+ src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \
+ src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \
+ src/powerpc/linux64.S src/powerpc/linux64_closure.S \
+ src/powerpc/ppc_closure.S src/powerpc/asm.h \
+ src/powerpc/aix.S src/powerpc/darwin.S \
+ src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
+ src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
+ src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
+ src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \
+ src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \
+ src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \
+ src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \
+ src/x86/win32.S src/x86/darwin.S src/x86/win64.S \
+ src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \
+ src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \
+ src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \
+ src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \
+ src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \
+ src/tile/ffitarget.h src/tile/tile.S libtool-version \
+ ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \
+ m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \
+ m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \
+ generate-ios-source-and-headers.py \
+ generate-osx-source-and-headers.py \
+ libffi.xcodeproj/project.pbxproj src/arm/trampoline.S
+
+
+# Automake Documentation:
+# If your package has Texinfo files in many directories, you can use the
+# variable TEXINFO_TEX to tell Automake where to find the canonical
+# `texinfo.tex' for your package. The value of this variable should be
+# the relative path from the current `Makefile.am' to `texinfo.tex'.
+TEXINFO_TEX = ../gcc/doc/include/texinfo.tex
+
+# Defines info, dvi, pdf and html targets
+MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include
+info_TEXINFOS = doc/libffi.texi
+@GENINSRC_FALSE@STAMP_GENINSRC =
+
+# AM_CONDITIONAL on configure option --generated-files-in-srcdir
+@GENINSRC_TRUE@STAMP_GENINSRC = stamp-geninsrc
+@BUILD_INFO_FALSE@STAMP_BUILD_INFO =
+
+# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
+@BUILD_INFO_TRUE@STAMP_BUILD_INFO = stamp-build-info
+CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/libffi.info
+MAINTAINERCLEANFILES = $(srcdir)/doc/libffi.info
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -461,7 +519,7 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
MAKEOVERRIDES =
toolexeclib_LTLIBRARIES = libffi.la
noinst_LTLIBRARIES = libffi_convenience.la
-libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \
+libffi_la_SOURCES = src/prep_cif.c src/types.c \
src/raw_api.c src/java_raw_api.c src/closures.c
nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) \
@@ -472,7 +530,9 @@ nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) \
$(am__append_15) $(am__append_16) $(am__append_17) \
$(am__append_18) $(am__append_19) $(am__append_20) \
$(am__append_21) $(am__append_22) $(am__append_23) \
- $(am__append_24) $(am__append_25)
+ $(am__append_24) $(am__append_25) $(am__append_26) \
+ $(am__append_27) $(am__append_28) $(am__append_29) \
+ $(am__append_30)
libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
AM_CFLAGS = -Wall -g -fexceptions
@@ -484,7 +544,7 @@ all: fficonfig.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
-.SUFFIXES: .S .c .lo .o .obj
+.SUFFIXES: .S .c .dvi .lo .o .obj .ps
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@@ -582,12 +642,12 @@ src/$(am__dirstamp):
src/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/$(DEPDIR)
@: > src/$(DEPDIR)/$(am__dirstamp)
-src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/prep_cif.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/types.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/java_raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/closures.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/mips/$(am__dirstamp):
@$(MKDIR_P) src/mips
@: > src/mips/$(am__dirstamp)
@@ -600,6 +660,16 @@ src/mips/o32.lo: src/mips/$(am__dirstamp) \
src/mips/$(DEPDIR)/$(am__dirstamp)
src/mips/n32.lo: src/mips/$(am__dirstamp) \
src/mips/$(DEPDIR)/$(am__dirstamp)
+src/bfin/$(am__dirstamp):
+ @$(MKDIR_P) src/bfin
+ @: > src/bfin/$(am__dirstamp)
+src/bfin/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) src/bfin/$(DEPDIR)
+ @: > src/bfin/$(DEPDIR)/$(am__dirstamp)
+src/bfin/ffi.lo: src/bfin/$(am__dirstamp) \
+ src/bfin/$(DEPDIR)/$(am__dirstamp)
+src/bfin/sysv.lo: src/bfin/$(am__dirstamp) \
+ src/bfin/$(DEPDIR)/$(am__dirstamp)
src/x86/$(am__dirstamp):
@$(MKDIR_P) src/x86
@: > src/x86/$(am__dirstamp)
@@ -700,6 +770,16 @@ src/powerpc/darwin.lo: src/powerpc/$(am__dirstamp) \
src/powerpc/$(DEPDIR)/$(am__dirstamp)
src/powerpc/darwin_closure.lo: src/powerpc/$(am__dirstamp) \
src/powerpc/$(DEPDIR)/$(am__dirstamp)
+src/aarch64/$(am__dirstamp):
+ @$(MKDIR_P) src/aarch64
+ @: > src/aarch64/$(am__dirstamp)
+src/aarch64/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) src/aarch64/$(DEPDIR)
+ @: > src/aarch64/$(DEPDIR)/$(am__dirstamp)
+src/aarch64/sysv.lo: src/aarch64/$(am__dirstamp) \
+ src/aarch64/$(DEPDIR)/$(am__dirstamp)
+src/aarch64/ffi.lo: src/aarch64/$(am__dirstamp) \
+ src/aarch64/$(DEPDIR)/$(am__dirstamp)
src/arm/$(am__dirstamp):
@$(MKDIR_P) src/arm
@: > src/arm/$(am__dirstamp)
@@ -710,6 +790,8 @@ src/arm/sysv.lo: src/arm/$(am__dirstamp) \
src/arm/$(DEPDIR)/$(am__dirstamp)
src/arm/ffi.lo: src/arm/$(am__dirstamp) \
src/arm/$(DEPDIR)/$(am__dirstamp)
+src/arm/trampoline.lo: src/arm/$(am__dirstamp) \
+ src/arm/$(DEPDIR)/$(am__dirstamp)
src/avr32/$(am__dirstamp):
@$(MKDIR_P) src/avr32
@: > src/avr32/$(am__dirstamp)
@@ -782,6 +864,16 @@ src/pa/linux.lo: src/pa/$(am__dirstamp) \
src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp)
src/pa/hpux32.lo: src/pa/$(am__dirstamp) \
src/pa/$(DEPDIR)/$(am__dirstamp)
+src/tile/$(am__dirstamp):
+ @$(MKDIR_P) src/tile
+ @: > src/tile/$(am__dirstamp)
+src/tile/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) src/tile/$(DEPDIR)
+ @: > src/tile/$(DEPDIR)/$(am__dirstamp)
+src/tile/tile.lo: src/tile/$(am__dirstamp) \
+ src/tile/$(DEPDIR)/$(am__dirstamp)
+src/tile/ffi.lo: src/tile/$(am__dirstamp) \
+ src/tile/$(DEPDIR)/$(am__dirstamp)
libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES)
$(libffi_la_LINK) -rpath $(toolexeclibdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS)
libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES)
@@ -789,6 +881,10 @@ libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_
mostlyclean-compile:
-rm -f *.$(OBJEXT)
+ -rm -f src/aarch64/ffi.$(OBJEXT)
+ -rm -f src/aarch64/ffi.lo
+ -rm -f src/aarch64/sysv.$(OBJEXT)
+ -rm -f src/aarch64/sysv.lo
-rm -f src/alpha/ffi.$(OBJEXT)
-rm -f src/alpha/ffi.lo
-rm -f src/alpha/osf.$(OBJEXT)
@@ -797,10 +893,16 @@ mostlyclean-compile:
-rm -f src/arm/ffi.lo
-rm -f src/arm/sysv.$(OBJEXT)
-rm -f src/arm/sysv.lo
+ -rm -f src/arm/trampoline.$(OBJEXT)
+ -rm -f src/arm/trampoline.lo
-rm -f src/avr32/ffi.$(OBJEXT)
-rm -f src/avr32/ffi.lo
-rm -f src/avr32/sysv.$(OBJEXT)
-rm -f src/avr32/sysv.lo
+ -rm -f src/bfin/ffi.$(OBJEXT)
+ -rm -f src/bfin/ffi.lo
+ -rm -f src/bfin/sysv.$(OBJEXT)
+ -rm -f src/bfin/sysv.lo
-rm -f src/closures.$(OBJEXT)
-rm -f src/closures.lo
-rm -f src/cris/ffi.$(OBJEXT)
@@ -881,6 +983,10 @@ mostlyclean-compile:
-rm -f src/sparc/v8.lo
-rm -f src/sparc/v9.$(OBJEXT)
-rm -f src/sparc/v9.lo
+ -rm -f src/tile/ffi.$(OBJEXT)
+ -rm -f src/tile/ffi.lo
+ -rm -f src/tile/tile.$(OBJEXT)
+ -rm -f src/tile/tile.lo
-rm -f src/types.$(OBJEXT)
-rm -f src/types.lo
-rm -f src/x86/darwin.$(OBJEXT)
@@ -911,12 +1017,17 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/prep_cif.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/raw_api.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/types.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/aarch64/$(DEPDIR)/ffi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/aarch64/$(DEPDIR)/sysv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/ffi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/osf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/ffi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/sysv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/trampoline.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/ffi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/sysv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/bfin/$(DEPDIR)/ffi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/bfin/$(DEPDIR)/sysv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/ffi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/sysv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/frv/$(DEPDIR)/eabi.Plo@am__quote@
@@ -952,6 +1063,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/ffi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/v8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/v9.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/tile/$(DEPDIR)/ffi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/tile/$(DEPDIR)/tile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi.Plo@am__quote@
@@ -1016,9 +1129,11 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-rm -rf src/.libs src/_libs
+ -rm -rf src/aarch64/.libs src/aarch64/_libs
-rm -rf src/alpha/.libs src/alpha/_libs
-rm -rf src/arm/.libs src/arm/_libs
-rm -rf src/avr32/.libs src/avr32/_libs
+ -rm -rf src/bfin/.libs src/bfin/_libs
-rm -rf src/cris/.libs src/cris/_libs
-rm -rf src/frv/.libs src/frv/_libs
-rm -rf src/ia64/.libs src/ia64/_libs
@@ -1031,6 +1146,7 @@ clean-libtool:
-rm -rf src/sh/.libs src/sh/_libs
-rm -rf src/sh64/.libs src/sh64/_libs
-rm -rf src/sparc/.libs src/sparc/_libs
+ -rm -rf src/tile/.libs src/tile/_libs
-rm -rf src/x86/.libs src/x86/_libs
distclean-libtool:
@@ -1052,6 +1168,149 @@ distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+doc/$(am__dirstamp):
+ @$(MKDIR_P) doc
+ @: > doc/$(am__dirstamp)
+
+doc/libffi.dvi: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
+ $(TEXI2DVI) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi
+
+doc/libffi.pdf: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
+ $(TEXI2PDF) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi
+
+doc/libffi.html: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
+ rm -rf $(@:.html=.htp)
+ if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \
+ -o $(@:.html=.htp) `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi; \
+ then \
+ rm -rf $@; \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
+ else \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
+ exit 1; \
+ fi
+$(srcdir)/doc/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/doc/stamp-vti
+$(srcdir)/doc/stamp-vti: doc/libffi.texi $(top_srcdir)/configure
+ test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp)
+ @(dir=.; test -f ./doc/libffi.texi || dir=$(srcdir); \
+ set `$(SHELL) $(srcdir)/mdate-sh $$dir/doc/libffi.texi`; \
+ echo "@set UPDATED $$1 $$2 $$3"; \
+ echo "@set UPDATED-MONTH $$2 $$3"; \
+ echo "@set EDITION $(VERSION)"; \
+ echo "@set VERSION $(VERSION)") > vti.tmp
+ @cmp -s vti.tmp $(srcdir)/doc/version.texi \
+ || (echo "Updating $(srcdir)/doc/version.texi"; \
+ cp vti.tmp $(srcdir)/doc/version.texi)
+ -@rm -f vti.tmp
+ @cp $(srcdir)/doc/version.texi $@
+
+mostlyclean-vti:
+ -rm -f vti.tmp
+
+maintainer-clean-vti:
+@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi
+.dvi.ps:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ $(DVIPS) -o $@ $<
+
+uninstall-dvi-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
+ rm -f "$(DESTDIR)$(dvidir)/$$f"; \
+ done
+
+uninstall-html-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
+ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
+ done
+
+uninstall-info-am:
+ @$(PRE_UNINSTALL)
+ @if test -d '$(DESTDIR)$(infodir)' && \
+ (install-info --version && \
+ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
+ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
+ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
+ done; \
+ else :; fi
+ @$(NORMAL_UNINSTALL)
+ @list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
+ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
+ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
+ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
+ else :; fi); \
+ done
+
+uninstall-pdf-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
+ done
+
+uninstall-ps-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(PSS)'; test -n "$(psdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(psdir)/$$f"; \
+ done
+
+dist-info: $(INFO_DEPS)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; \
+ for base in $$list; do \
+ case $$base in \
+ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$base; then d=.; else d=$(srcdir); fi; \
+ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
+ if test -f $$file; then \
+ relfile=`expr "$$file" : "$$d/\(.*\)"`; \
+ test -f "$(distdir)/$$relfile" || \
+ cp -p $$file "$(distdir)/$$relfile"; \
+ else :; fi; \
+ done; \
+ done
+
+mostlyclean-aminfo:
+ -rm -rf libffi.aux libffi.cp libffi.cps libffi.fn libffi.ky libffi.log \
+ libffi.pg libffi.tmp libffi.toc libffi.tp libffi.vr
+
+clean-aminfo:
+ -test -z "doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html" \
+ || rm -rf doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html
+
+maintainer-clean-aminfo:
+ @list='$(INFO_DEPS)'; for i in $$list; do \
+ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
+ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
+ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
+ done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -1248,6 +1507,9 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-info
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
@@ -1365,10 +1627,11 @@ distcleancheck: distclean
exit 1; } >&2
check-am: all-am
check: check-recursive
-all-am: Makefile $(LTLIBRARIES) all-multi fficonfig.h
+all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) all-multi fficonfig.h \
+ all-local
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
+ for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
@@ -1388,18 +1651,24 @@ install-strip:
mostlyclean-generic:
clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f doc/$(am__dirstamp)
-rm -f src/$(DEPDIR)/$(am__dirstamp)
-rm -f src/$(am__dirstamp)
+ -rm -f src/aarch64/$(DEPDIR)/$(am__dirstamp)
+ -rm -f src/aarch64/$(am__dirstamp)
-rm -f src/alpha/$(DEPDIR)/$(am__dirstamp)
-rm -f src/alpha/$(am__dirstamp)
-rm -f src/arm/$(DEPDIR)/$(am__dirstamp)
-rm -f src/arm/$(am__dirstamp)
-rm -f src/avr32/$(DEPDIR)/$(am__dirstamp)
-rm -f src/avr32/$(am__dirstamp)
+ -rm -f src/bfin/$(DEPDIR)/$(am__dirstamp)
+ -rm -f src/bfin/$(am__dirstamp)
-rm -f src/cris/$(DEPDIR)/$(am__dirstamp)
-rm -f src/cris/$(am__dirstamp)
-rm -f src/frv/$(DEPDIR)/$(am__dirstamp)
@@ -1424,85 +1693,168 @@ distclean-generic:
-rm -f src/sh64/$(am__dirstamp)
-rm -f src/sparc/$(DEPDIR)/$(am__dirstamp)
-rm -f src/sparc/$(am__dirstamp)
+ -rm -f src/tile/$(DEPDIR)/$(am__dirstamp)
+ -rm -f src/tile/$(am__dirstamp)
-rm -f src/x86/$(DEPDIR)/$(am__dirstamp)
-rm -f src/x86/$(am__dirstamp)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-multi clean-recursive
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
- clean-toolexeclibLTLIBRARIES mostlyclean-am
+clean-am: clean-aminfo clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES \
+ mostlyclean-am
distclean: distclean-multi distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
+ -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-tags
dvi: dvi-recursive
-dvi-am:
+dvi-am: $(DVIS)
html: html-recursive
-html-am:
+html-am: $(HTMLS)
info: info-recursive
-info-am:
+info-am: $(INFO_DEPS)
-install-data-am:
+install-data-am: install-info-am
install-dvi: install-dvi-recursive
-install-dvi-am:
-
+install-dvi-am: $(DVIS)
+ @$(NORMAL_INSTALL)
+ test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)"
+ @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
+ done
install-exec-am: install-multi install-toolexeclibLTLIBRARIES
install-html: install-html-recursive
-install-html-am:
-
+install-html-am: $(HTMLS)
+ @$(NORMAL_INSTALL)
+ test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"
+ @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ $(am__strip_dir) \
+ if test -d "$$d$$p"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
+ echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
+ else \
+ list2="$$list2 $$d$$p"; \
+ fi; \
+ done; \
+ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
+ done; }
install-info: install-info-recursive
-install-info-am:
-
+install-info-am: $(INFO_DEPS)
+ @$(NORMAL_INSTALL)
+ test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
+ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
+ if test -f $$ifile; then \
+ echo "$$ifile"; \
+ else : ; fi; \
+ done; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
+ @$(POST_INSTALL)
+ @if (install-info --version && \
+ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
+ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
+ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
+ done; \
+ else : ; fi
install-man:
install-pdf: install-pdf-recursive
-install-pdf-am:
-
+install-pdf-am: $(PDFS)
+ @$(NORMAL_INSTALL)
+ test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)"
+ @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
install-ps: install-ps-recursive
-install-ps-am:
-
+install-ps-am: $(PSS)
+ @$(NORMAL_INSTALL)
+ test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)"
+ @list='$(PSS)'; test -n "$(psdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
installcheck-am:
maintainer-clean: maintainer-clean-multi maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
- -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
+ -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/x86/$(DEPDIR)
-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
+maintainer-clean-am: distclean-am maintainer-clean-aminfo \
+ maintainer-clean-generic maintainer-clean-vti
mostlyclean: mostlyclean-multi mostlyclean-recursive
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
+mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-vti
pdf: pdf-recursive
-pdf-am:
+pdf-am: $(PDFS)
ps: ps-recursive
-ps-am:
+ps-am: $(PSS)
-uninstall-am: uninstall-toolexeclibLTLIBRARIES
+uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
+ uninstall-pdf-am uninstall-ps-am \
+ uninstall-toolexeclibLTLIBRARIES
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all all-multi \
clean-multi ctags-recursive distclean-multi install-am \
@@ -1510,12 +1862,12 @@ uninstall-am: uninstall-toolexeclibLTLIBRARIES
mostlyclean-multi tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am all-multi am--refresh check check-am clean \
- clean-generic clean-libtool clean-multi \
+ all all-am all-local all-multi am--refresh check check-am \
+ clean clean-aminfo clean-generic clean-libtool clean-multi \
clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES ctags \
- ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-lzma \
- dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \
- distclean-compile distclean-generic distclean-hdr \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-info \
+ dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
+ distclean distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-multi distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
@@ -1525,11 +1877,27 @@ uninstall-am: uninstall-toolexeclibLTLIBRARIES
install-pdf-am install-ps install-ps-am install-strip \
install-toolexeclibLTLIBRARIES installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic maintainer-clean-multi mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- mostlyclean-multi pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am uninstall-toolexeclibLTLIBRARIES
+ maintainer-clean-aminfo maintainer-clean-generic \
+ maintainer-clean-multi maintainer-clean-vti mostlyclean \
+ mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-multi mostlyclean-vti pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dvi-am uninstall-html-am uninstall-info-am \
+ uninstall-pdf-am uninstall-ps-am \
+ uninstall-toolexeclibLTLIBRARIES
+
+
+all-local: $(STAMP_GENINSRC)
+
+stamp-geninsrc: doc/libffi.info
+ cp -p $(top_builddir)/doc/libffi.info $(srcdir)/doc/libffi.info
+ @touch $@
+
+doc/libffi.info: $(STAMP_BUILD_INFO)
+stamp-build-info: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp)
+ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)/doc -o doc/libffi.info $(srcdir)/doc/libffi.texi
+ @touch $@
# Multilib support. Automake should provide these on its own.
all-recursive: all-multi
diff --git a/libffi/README b/libffi/README
index 1da4e89c736..a0fb7174bba 100644
--- a/libffi/README
+++ b/libffi/README
@@ -1,8 +1,8 @@
Status
======
-libffi-3.0.11 was released on *****************. Check the libffi web
-page for updates: <URL:http://sourceware.org/libffi/>.
+libffi-3.0.12 was released on XXXXXXX. Check the libffi web page for
+updates: <URL:http://sourceware.org/libffi/>.
What is libffi?
@@ -48,48 +48,52 @@ refer to the wiki page here:
At the time of release, the following basic configurations have been
tested:
-|--------------+------------------|
-| Architecture | Operating System |
-|--------------+------------------|
-| Alpha | Linux |
-| Alpha | Tru64 |
-| ARM | Linux |
-| ARM | iOS |
-| AVR32 | Linux |
-| HPPA | HPUX |
-| IA-64 | Linux |
-| M68K | RTEMS |
-| MIPS | IRIX |
-| MIPS | Linux |
-| MIPS | RTEMS |
-| MIPS64 | Linux |
-| PowerPC | AMIGA |
-| PowerPC | Linux |
-| PowerPC | Mac OSX |
-| PowerPC | FreeBSD |
-| PowerPC64 | Linux |
-| S390 | Linux |
-| S390X | Linux |
-| SPARC | Linux |
-| SPARC | Solaris |
-| SPARC64 | Linux |
-| SPARC64 | FreeBSD |
-| X86 | FreeBSD |
-| X86 | Interix |
-| X86 | kFreeBSD |
-| X86 | Linux |
-| X86 | Linux/x32 |
-| X86 | Mac OSX |
-| X86 | OpenBSD |
-| X86 | OS/2 |
-| X86 | Solaris |
-| X86 | Windows/Cygwin |
-| X86 | Windows/MingW |
-| X86-64 | FreeBSD |
-| X86-64 | Linux |
-| X86-64 | OpenBSD |
-| X86-64 | Windows/MingW |
-|--------------+------------------|
+|-----------------+------------------|
+| Architecture | Operating System |
+|-----------------+------------------|
+| AArch64 | Linux |
+| Alpha | Linux |
+| Alpha | Tru64 |
+| ARM | Linux |
+| ARM | iOS |
+| AVR32 | Linux |
+| Blackfin | uClinux |
+| HPPA | HPUX |
+| IA-64 | Linux |
+| M68K | FreeMiNT |
+| M68K | RTEMS |
+| MIPS | IRIX |
+| MIPS | Linux |
+| MIPS | RTEMS |
+| MIPS64 | Linux |
+| PowerPC | AMIGA |
+| PowerPC | Linux |
+| PowerPC | Mac OSX |
+| PowerPC | FreeBSD |
+| PowerPC64 | Linux |
+| S390 | Linux |
+| S390X | Linux |
+| SPARC | Linux |
+| SPARC | Solaris |
+| SPARC64 | Linux |
+| SPARC64 | FreeBSD |
+| TILE-Gx/TILEPro | Linux |
+| X86 | FreeBSD |
+| X86 | Interix |
+| X86 | kFreeBSD |
+| X86 | Linux |
+| X86 | Mac OSX |
+| X86 | OpenBSD |
+| X86 | OS/2 |
+| X86 | Solaris |
+| X86 | Windows/Cygwin |
+| X86 | Windows/MingW |
+| X86-64 | FreeBSD |
+| X86-64 | Linux |
+| X86-64 | Linux/x32 |
+| X86-64 | OpenBSD |
+| X86-64 | Windows/MingW |
+|-----------------+------------------|
Please send additional platform test results to
libffi-discuss@sourceware.org and feel free to update the wiki page
@@ -128,7 +132,7 @@ under a MingW environment, you may need to remove the line in configure
that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not
present in MingW, and is not required when using MingW-style paths.)
-For iOS builds, refer to the build-ios.sh script for guidance.
+For iOS builds, the 'libffi.xcodeproj' Xcode project is available.
Configure has many other options. Use "configure --help" to see them all.
@@ -146,13 +150,24 @@ History
See the ChangeLog files for details.
-3.0.11 MMM-DD-YY
+3.0.12 XXX-XX-XX
+ Add Blackfin support.
+ Add TILE-Gx/TILEPro support.
+ Add AArch64 support.
+ Add support for PaX enabled kernels with MPROTECT.
+
+3.0.11 Apr-11-12
Lots of build fixes.
- Add Amiga newer MacOS support.
+ Add Amiga newer MacOS support.
+ Add support for variadic functions (ffi_prep_cif_var).
Add Linux/x32 support.
- Add thiscall and fastcall support on Windows.
+ Add thiscall, fastcall and MSVC cdecl support on Windows.
+ Add Amiga and newer MacOS support.
+ Add m68k FreeMiNT support.
+ Integration with iOS' xcode build tools.
Fix Octeon and MC68881 support.
Fix code pessimizations.
+ Lots of build fixes.
3.0.10 Aug-23-11
Add support for Apple's iOS.
@@ -311,8 +326,10 @@ Thorup.
Major processor architecture ports were contributed by the following
developers:
+aarch64 Marcus Shawcroft, James Greenhalgh
alpha Richard Henderson
arm Raffaele Sena
+blackfin Alexandre Keunecke I. de Mendonca
cris Simon Posnjak, Hans-Peter Nilsson
frv Anthony Green
ia64 Hans Boehm
@@ -328,6 +345,7 @@ s390 Gerhard Tonn, Ulrich Weigand
sh Kaz Kojima
sh64 Kaz Kojima
sparc Anthony Green, Gordon Irlam
+tile-gx/tilepro Walter Lee
x86 Anthony Green, Jon Beniston
x86-64 Bo Thorsen
diff --git a/libffi/aclocal.m4 b/libffi/aclocal.m4
index 9d6a6694fd2..93d09b3a3ca 100644
--- a/libffi/aclocal.m4
+++ b/libffi/aclocal.m4
@@ -1025,6 +1025,7 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
+m4_include([../config/acx.m4])
m4_include([../config/asmcfi.m4])
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
diff --git a/libffi/configure b/libffi/configure
index 24b9f418127..ce6c8adced7 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for libffi 3.0.9.
+# Generated by GNU Autoconf 2.64 for libffi 3.0.11.
#
# Report bugs to <http://gcc.gnu.org/bugs.html>.
#
@@ -559,8 +559,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libffi'
PACKAGE_TARNAME='libffi'
-PACKAGE_VERSION='3.0.9'
-PACKAGE_STRING='libffi 3.0.9'
+PACKAGE_VERSION='3.0.11'
+PACKAGE_STRING='libffi 3.0.11'
PACKAGE_BUGREPORT='http://gcc.gnu.org/bugs.html'
PACKAGE_URL=''
@@ -606,10 +606,17 @@ LTLIBOBJS
LIBOBJS
toolexeclibdir
toolexecdir
+FFI_DEBUG_FALSE
+FFI_DEBUG_TRUE
TARGETDIR
TARGET
+FFI_EXEC_TRAMPOLINE_TABLE
+FFI_EXEC_TRAMPOLINE_TABLE_FALSE
+FFI_EXEC_TRAMPOLINE_TABLE_TRUE
HAVE_LONG_DOUBLE
ALLOCA
+TILE_FALSE
+TILE_TRUE
PA64_HPUX_FALSE
PA64_HPUX_TRUE
PA_HPUX_FALSE
@@ -632,6 +639,8 @@ AVR32_FALSE
AVR32_TRUE
ARM_FALSE
ARM_TRUE
+AARCH64_FALSE
+AARCH64_TRUE
POWERPC_FREEBSD_FALSE
POWERPC_FREEBSD_TRUE
POWERPC_DARWIN_FALSE
@@ -660,6 +669,8 @@ X86_FALSE
X86_TRUE
SPARC_FALSE
SPARC_TRUE
+BFIN_FALSE
+BFIN_TRUE
MIPS_FALSE
MIPS_TRUE
AM_LTLDFLAGS
@@ -709,6 +720,10 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
+GENINSRC_FALSE
+GENINSRC_TRUE
+BUILD_INFO_FALSE
+BUILD_INFO_TRUE
am__untar
am__tar
AMTAR
@@ -787,6 +802,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_multilib
+enable_generated_files_in_srcdir
enable_dependency_tracking
enable_shared
enable_static
@@ -795,6 +811,7 @@ enable_fast_install
with_gnu_ld
enable_libtool_lock
enable_maintainer_mode
+enable_pax_emutramp
enable_debug
enable_structs
enable_raw_api
@@ -1348,7 +1365,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libffi 3.0.9 to adapt to many kinds of systems.
+\`configure' configures libffi 3.0.11 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1419,7 +1436,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libffi 3.0.9:";;
+ short | recursive ) echo "Configuration of libffi 3.0.11:";;
esac
cat <<\_ACEOF
@@ -1428,6 +1445,10 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-multilib build many library versions (default)
+ --enable-generated-files-in-srcdir
+ put copies of generated files in source dir intended
+ for creating source tarballs for users without
+ texinfo bison or flex
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--enable-shared[=PKGS] build shared libraries [default=yes]
@@ -1437,6 +1458,7 @@ Optional Features:
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
+ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC
--enable-debug debugging mode
--disable-structs omit code for struct support
--disable-raw-api make the raw api unavailable
@@ -1527,7 +1549,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libffi configure 3.0.9
+libffi configure 3.0.11
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2076,7 +2098,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libffi $as_me 3.0.9, which was
+It was created by libffi $as_me 3.0.11, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
@@ -3043,7 +3065,7 @@ fi
# Define the identity of the package.
PACKAGE='libffi'
- VERSION='3.0.9'
+ VERSION='3.0.11'
cat >>confdefs.h <<_ACEOF
@@ -3084,6 +3106,110 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+# See if makeinfo has been installed and is modern enough
+# that we can use it.
+
+ # Extract the first word of "makeinfo", so it can be a program name with args.
+set dummy makeinfo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_MAKEINFO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$MAKEINFO"; then
+ ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_MAKEINFO="makeinfo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+MAKEINFO=$ac_cv_prog_MAKEINFO
+if test -n "$MAKEINFO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKEINFO" >&5
+$as_echo "$MAKEINFO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test -n "$MAKEINFO"; then
+ # Found it, now check the version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for modern makeinfo" >&5
+$as_echo_n "checking for modern makeinfo... " >&6; }
+if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_prog_version=`eval $MAKEINFO --version 2>&1 |
+ sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+
+ case $ac_prog_version in
+ '') gcc_cv_prog_makeinfo_modern=no;;
+ 4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*) gcc_cv_prog_makeinfo_modern=yes;;
+ *) gcc_cv_prog_makeinfo_modern=no;;
+ esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_prog_makeinfo_modern" >&5
+$as_echo "$gcc_cv_prog_makeinfo_modern" >&6; }
+ else
+ gcc_cv_prog_makeinfo_modern=no
+ fi
+ if test $gcc_cv_prog_makeinfo_modern = no; then
+ MAKEINFO="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing makeinfo"
+ fi
+
+ if test $gcc_cv_prog_makeinfo_modern = "yes"; then
+ BUILD_INFO_TRUE=
+ BUILD_INFO_FALSE='#'
+else
+ BUILD_INFO_TRUE='#'
+ BUILD_INFO_FALSE=
+fi
+
+
+# We would like our source tree to be readonly. However when releases or
+# pre-releases are generated, the flex/bison generated files as well as the
+# various formats of manuals need to be included along with the rest of the
+# sources. Therefore we have --enable-generated-files-in-srcdir to do
+# just that.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking generated-files-in-srcdir" >&5
+$as_echo_n "checking generated-files-in-srcdir... " >&6; }
+# Check whether --enable-generated-files-in-srcdir was given.
+if test "${enable_generated_files_in_srcdir+set}" = set; then :
+ enableval=$enable_generated_files_in_srcdir; case "$enableval" in
+ yes) enable_generated_files_in_srcdir=yes ;;
+ no) enable_generated_files_in_srcdir=no ;;
+ *) as_fn_error "Unknown argument to enable/disable version-specific libs" "$LINENO" 5;;
+ esac
+else
+ enable_generated_files_in_srcdir=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_generated_files_in_srcdir" >&5
+$as_echo "$enable_generated_files_in_srcdir" >&6; }
+ if test "$enable_generated_files_in_srcdir" = yes; then
+ GENINSRC_TRUE=
+ GENINSRC_FALSE='#'
+else
+ GENINSRC_TRUE='#'
+ GENINSRC_FALSE=
+fi
+
+
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
# We must force CC to /not/ be precious variables; otherwise
# the wrong, non-multilib-adjusted value will be used in multilibs.
@@ -10774,7 +10900,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10777 "configure"
+#line 10903 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10880,7 +11006,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10883 "configure"
+#line 11009 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11318,6 +11444,10 @@ fi
TARGETDIR="unknown"
case "$host" in
+ aarch64*-*-*)
+ TARGET=AARCH64; TARGETDIR=aarch64
+ ;;
+
alpha*-*-*)
TARGET=ALPHA; TARGETDIR=alpha;
# Support 128-bit long double, changeable via command-line switch.
@@ -11330,12 +11460,20 @@ case "$host" in
amd64-*-freebsd* | amd64-*-openbsd*)
TARGET=X86_64; TARGETDIR=x86
+ ;;
+
+ amd64-*-freebsd*)
+ TARGET=X86_64; TARGETDIR=x86
;;
avr32*-*-*)
TARGET=AVR32; TARGETDIR=avr32
;;
+ bfin*)
+ TARGET=BFIN; TARGETDIR=bfin
+ ;;
+
cris-*-*)
TARGET=LIBFFI_CRIS; TARGETDIR=cris
;;
@@ -11344,7 +11482,7 @@ case "$host" in
TARGET=FRV; TARGETDIR=frv
;;
- hppa*-*-linux* | parisc*-*-linux*)
+ hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
TARGET=PA_LINUX; TARGETDIR=pa
;;
hppa*64-*-hpux*)
@@ -11357,7 +11495,7 @@ case "$host" in
i?86-*-freebsd* | i?86-*-openbsd*)
TARGET=X86_FREEBSD; TARGETDIR=x86
;;
- i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2*)
+ i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*)
TARGET=X86_WIN32; TARGETDIR=x86
# All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
# We must also check with_cross_host to decide if this is a native
@@ -11394,7 +11532,7 @@ case "$host" in
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
TARGET=MIPS; TARGETDIR=mips
;;
- mips*-*-linux*)
+ mips*-*-linux* | mips*-*-openbsd*)
# Support 128-bit long double for NewABI.
HAVE_LONG_DOUBLE='defined(__mips64)'
TARGET=MIPS; TARGETDIR=mips
@@ -11403,19 +11541,22 @@ case "$host" in
powerpc*-*-linux* | powerpc-*-sysv*)
TARGET=POWERPC; TARGETDIR=powerpc
;;
+ powerpc-*-amigaos*)
+ TARGET=POWERPC; TARGETDIR=powerpc
+ ;;
powerpc-*-beos*)
TARGET=POWERPC; TARGETDIR=powerpc
;;
- powerpc-*-darwin*)
+ powerpc-*-darwin* | powerpc64-*-darwin*)
TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
;;
powerpc-*-aix* | rs6000-*-aix*)
TARGET=POWERPC_AIX; TARGETDIR=powerpc
;;
- powerpc-*-freebsd*)
+ powerpc-*-freebsd* | powerpc-*-openbsd*)
TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
;;
- powerpc64-*-freebsd*)
+ powerpc64-*-freebsd*)
TARGET=POWERPC; TARGETDIR=powerpc
;;
powerpc*-*-rtems*)
@@ -11437,6 +11578,10 @@ case "$host" in
TARGET=SPARC; TARGETDIR=sparc
;;
+ tile*-*)
+ TARGET=TILE; TARGETDIR=tile
+ ;;
+
x86_64-*-darwin*)
TARGET=X86_DARWIN; TARGETDIR=x86
;;
@@ -11474,6 +11619,14 @@ else
MIPS_FALSE=
fi
+ if test x$TARGET = xBFIN; then
+ BFIN_TRUE=
+ BFIN_FALSE='#'
+else
+ BFIN_TRUE='#'
+ BFIN_FALSE=
+fi
+
if test x$TARGET = xSPARC; then
SPARC_TRUE=
SPARC_FALSE='#'
@@ -11586,6 +11739,14 @@ else
POWERPC_FREEBSD_FALSE=
fi
+ if test x$TARGET = xAARCH64; then
+ AARCH64_TRUE=
+ AARCH64_FALSE='#'
+else
+ AARCH64_TRUE='#'
+ AARCH64_FALSE=
+fi
+
if test x$TARGET = xARM; then
ARM_TRUE=
ARM_FALSE='#'
@@ -11674,6 +11835,14 @@ else
PA64_HPUX_FALSE=
fi
+ if test x$TARGET = xTILE; then
+ TILE_TRUE=
+ TILE_FALSE='#'
+else
+ TILE_TRUE='#'
+ TILE_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
@@ -12501,13 +12670,40 @@ $as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h
fi
fi
+# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
+# Check whether --enable-pax_emutramp was given.
+if test "${enable_pax_emutramp+set}" = set; then :
+ enableval=$enable_pax_emutramp; if test "$enable_pax_emutramp" = "yes"; then
+
+$as_echo "#define FFI_MMAP_EXEC_EMUTRAMP_PAX 1" >>confdefs.h
+
+ fi
+fi
+
+
+FFI_EXEC_TRAMPOLINE_TABLE=0
case "$target" in
- *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+ *arm*-apple-darwin*)
+ FFI_EXEC_TRAMPOLINE_TABLE=1
+
+$as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h
+
+ ;;
+ *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
$as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h
;;
esac
+ if test x$FFI_EXEC_TRAMPOLINE_TABLE = x1; then
+ FFI_EXEC_TRAMPOLINE_TABLE_TRUE=
+ FFI_EXEC_TRAMPOLINE_TABLE_FALSE='#'
+else
+ FFI_EXEC_TRAMPOLINE_TABLE_TRUE='#'
+ FFI_EXEC_TRAMPOLINE_TABLE_FALSE=
+fi
+
+
if test x$TARGET = xX86_64; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports unwind section type" >&5
@@ -12532,67 +12728,69 @@ $as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5
+if test "x$GCC" = "xyes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5
$as_echo_n "checking whether .eh_frame section should be read-only... " >&6; }
if test "${libffi_cv_ro_eh_frame+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- libffi_cv_ro_eh_frame=no
- echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
- if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
- if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
- libffi_cv_ro_eh_frame=yes
- elif grep '.section.*eh_frame.*#alloc' conftest.c \
- | grep -v '#write' > /dev/null; then
- libffi_cv_ro_eh_frame=yes
- fi
- fi
- rm -f conftest.*
+ libffi_cv_ro_eh_frame=no
+ echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
+ if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
+ if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
+ libffi_cv_ro_eh_frame=yes
+ elif grep '.section.*eh_frame.*#alloc' conftest.c \
+ | grep -v '#write' > /dev/null; then
+ libffi_cv_ro_eh_frame=yes
+ fi
+ fi
+ rm -f conftest.*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_ro_eh_frame" >&5
$as_echo "$libffi_cv_ro_eh_frame" >&6; }
-if test "x$libffi_cv_ro_eh_frame" = xyes; then
+ if test "x$libffi_cv_ro_eh_frame" = xyes; then
$as_echo "#define HAVE_RO_EH_FRAME 1" >>confdefs.h
$as_echo "#define EH_FRAME_FLAGS \"a\"" >>confdefs.h
-else
+ else
$as_echo "#define EH_FRAME_FLAGS \"aw\"" >>confdefs.h
-fi
+ fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5
$as_echo_n "checking for __attribute__((visibility(\"hidden\")))... " >&6; }
if test "${libffi_cv_hidden_visibility_attribute+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
- libffi_cv_hidden_visibility_attribute=no
- if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5'
+ echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c
+ libffi_cv_hidden_visibility_attribute=no
+ if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
- if grep '\.hidden.*foo' conftest.s >/dev/null; then
- libffi_cv_hidden_visibility_attribute=yes
- fi
- fi
- rm -f conftest.*
+ if grep '\.hidden.*foo' conftest.s >/dev/null; then
+ libffi_cv_hidden_visibility_attribute=yes
+ fi
+ fi
+ rm -f conftest.*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_hidden_visibility_attribute" >&5
$as_echo "$libffi_cv_hidden_visibility_attribute" >&6; }
-if test $libffi_cv_hidden_visibility_attribute = yes; then
+ if test $libffi_cv_hidden_visibility_attribute = yes; then
$as_echo "#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1" >>confdefs.h
+ fi
fi
@@ -12611,6 +12809,14 @@ $as_echo "#define FFI_DEBUG 1" >>confdefs.h
fi
fi
+ if test "$enable_debug" = "yes"; then
+ FFI_DEBUG_TRUE=
+ FFI_DEBUG_FALSE='#'
+else
+ FFI_DEBUG_TRUE='#'
+ FFI_DEBUG_FALSE=
+fi
+
# Check whether --enable-structs was given.
if test "${enable_structs+set}" = set; then :
@@ -12780,6 +12986,14 @@ else
am__EXEEXT_FALSE=
fi
+if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then
+ as_fn_error "conditional \"BUILD_INFO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GENINSRC_TRUE}" && test -z "${GENINSRC_FALSE}"; then
+ as_fn_error "conditional \"GENINSRC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
as_fn_error "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -12804,6 +13018,10 @@ if test -z "${MIPS_TRUE}" && test -z "${MIPS_FALSE}"; then
as_fn_error "conditional \"MIPS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${BFIN_TRUE}" && test -z "${BFIN_FALSE}"; then
+ as_fn_error "conditional \"BFIN\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${SPARC_TRUE}" && test -z "${SPARC_FALSE}"; then
as_fn_error "conditional \"SPARC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -12860,6 +13078,10 @@ if test -z "${POWERPC_FREEBSD_TRUE}" && test -z "${POWERPC_FREEBSD_FALSE}"; then
as_fn_error "conditional \"POWERPC_FREEBSD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${AARCH64_TRUE}" && test -z "${AARCH64_FALSE}"; then
+ as_fn_error "conditional \"AARCH64\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${ARM_TRUE}" && test -z "${ARM_FALSE}"; then
as_fn_error "conditional \"ARM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -12904,7 +13126,19 @@ if test -z "${PA64_HPUX_TRUE}" && test -z "${PA64_HPUX_FALSE}"; then
as_fn_error "conditional \"PA64_HPUX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${TILE_TRUE}" && test -z "${TILE_FALSE}"; then
+ as_fn_error "conditional \"TILE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${FFI_EXEC_TRAMPOLINE_TABLE_TRUE}" && test -z "${FFI_EXEC_TRAMPOLINE_TABLE_FALSE}"; then
+ as_fn_error "conditional \"FFI_EXEC_TRAMPOLINE_TABLE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then
+ as_fn_error "conditional \"FFI_DEBUG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
@@ -13313,7 +13547,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libffi $as_me 3.0.9, which was
+This file was extended by libffi $as_me 3.0.11, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -13381,7 +13615,7 @@ Report bugs to <http://gcc.gnu.org/bugs.html>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-libffi config.status 3.0.9
+libffi config.status 3.0.11
configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 5036e25a288..22fc5690df0 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure
AC_PREREQ(2.64)
-AC_INIT([libffi], [3.0.9], [http://gcc.gnu.org/bugs.html])
+AC_INIT([libffi], [3.0.11], [http://gcc.gnu.org/bugs.html])
AC_CONFIG_HEADERS([fficonfig.h])
AM_ENABLE_MULTILIB(, ..)
@@ -14,6 +14,31 @@ target_alias=${target_alias-$host_alias}
AM_INIT_AUTOMAKE
+# See if makeinfo has been installed and is modern enough
+# that we can use it.
+ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+ [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
+AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
+
+# We would like our source tree to be readonly. However when releases or
+# pre-releases are generated, the flex/bison generated files as well as the
+# various formats of manuals need to be included along with the rest of the
+# sources. Therefore we have --enable-generated-files-in-srcdir to do
+# just that.
+AC_MSG_CHECKING(generated-files-in-srcdir)
+AC_ARG_ENABLE(generated-files-in-srcdir,
+AS_HELP_STRING([--enable-generated-files-in-srcdir],
+ [put copies of generated files in source dir intended for creating source tarballs for users without texinfo bison or flex]),
+[case "$enableval" in
+ yes) enable_generated_files_in_srcdir=yes ;;
+ no) enable_generated_files_in_srcdir=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
+ esac],
+[enable_generated_files_in_srcdir=no])
+AC_MSG_RESULT($enable_generated_files_in_srcdir)
+AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
+
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
# We must force CC to /not/ be precious variables; otherwise
# the wrong, non-multilib-adjusted value will be used in multilibs.
@@ -41,6 +66,10 @@ AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
TARGETDIR="unknown"
case "$host" in
+ aarch64*-*-*)
+ TARGET=AARCH64; TARGETDIR=aarch64
+ ;;
+
alpha*-*-*)
TARGET=ALPHA; TARGETDIR=alpha;
# Support 128-bit long double, changeable via command-line switch.
@@ -53,12 +82,20 @@ case "$host" in
amd64-*-freebsd* | amd64-*-openbsd*)
TARGET=X86_64; TARGETDIR=x86
+ ;;
+
+ amd64-*-freebsd*)
+ TARGET=X86_64; TARGETDIR=x86
;;
avr32*-*-*)
TARGET=AVR32; TARGETDIR=avr32
;;
+ bfin*)
+ TARGET=BFIN; TARGETDIR=bfin
+ ;;
+
cris-*-*)
TARGET=LIBFFI_CRIS; TARGETDIR=cris
;;
@@ -67,7 +104,7 @@ case "$host" in
TARGET=FRV; TARGETDIR=frv
;;
- hppa*-*-linux* | parisc*-*-linux*)
+ hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
TARGET=PA_LINUX; TARGETDIR=pa
;;
hppa*64-*-hpux*)
@@ -80,7 +117,7 @@ case "$host" in
i?86-*-freebsd* | i?86-*-openbsd*)
TARGET=X86_FREEBSD; TARGETDIR=x86
;;
- i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2*)
+ i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*)
TARGET=X86_WIN32; TARGETDIR=x86
# All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
# We must also check with_cross_host to decide if this is a native
@@ -117,7 +154,7 @@ case "$host" in
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
TARGET=MIPS; TARGETDIR=mips
;;
- mips*-*-linux*)
+ mips*-*-linux* | mips*-*-openbsd*)
# Support 128-bit long double for NewABI.
HAVE_LONG_DOUBLE='defined(__mips64)'
TARGET=MIPS; TARGETDIR=mips
@@ -126,19 +163,22 @@ case "$host" in
powerpc*-*-linux* | powerpc-*-sysv*)
TARGET=POWERPC; TARGETDIR=powerpc
;;
+ powerpc-*-amigaos*)
+ TARGET=POWERPC; TARGETDIR=powerpc
+ ;;
powerpc-*-beos*)
TARGET=POWERPC; TARGETDIR=powerpc
;;
- powerpc-*-darwin*)
+ powerpc-*-darwin* | powerpc64-*-darwin*)
TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
;;
powerpc-*-aix* | rs6000-*-aix*)
TARGET=POWERPC_AIX; TARGETDIR=powerpc
;;
- powerpc-*-freebsd*)
+ powerpc-*-freebsd* | powerpc-*-openbsd*)
TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
;;
- powerpc64-*-freebsd*)
+ powerpc64-*-freebsd*)
TARGET=POWERPC; TARGETDIR=powerpc
;;
powerpc*-*-rtems*)
@@ -160,6 +200,10 @@ case "$host" in
TARGET=SPARC; TARGETDIR=sparc
;;
+ tile*-*)
+ TARGET=TILE; TARGETDIR=tile
+ ;;
+
x86_64-*-darwin*)
TARGET=X86_DARWIN; TARGETDIR=x86
;;
@@ -190,6 +234,7 @@ if test $TARGETDIR = unknown; then
fi
AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
+AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN)
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
AM_CONDITIONAL(X86, test x$TARGET = xX86)
AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
@@ -204,6 +249,7 @@ AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
+AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64)
AM_CONDITIONAL(ARM, test x$TARGET = xARM)
AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32)
AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS)
@@ -215,6 +261,7 @@ AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX)
AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
+AM_CONDITIONAL(TILE, test x$TARGET = xTILE)
AC_HEADER_STDC
AC_CHECK_FUNCS(memcpy)
@@ -311,13 +358,30 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
fi
fi
+# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
+AC_ARG_ENABLE(pax_emutramp,
+ [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC],
+ if test "$enable_pax_emutramp" = "yes"; then
+ AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1,
+ [Define this if you want to enable pax emulated trampolines])
+ fi)
+
+FFI_EXEC_TRAMPOLINE_TABLE=0
case "$target" in
- *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+ *arm*-apple-darwin*)
+ FFI_EXEC_TRAMPOLINE_TABLE=1
+ AC_DEFINE(FFI_EXEC_TRAMPOLINE_TABLE, 1,
+ [Cannot use PROT_EXEC on this target, so, we revert to
+ alternative means])
+ ;;
+ *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
[Cannot use malloc on this target, so, we revert to
alternative means])
;;
esac
+AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1)
+AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE)
if test x$TARGET = xX86_64; then
AC_CACHE_CHECK([assembler supports unwind section type],
@@ -334,44 +398,46 @@ if test x$TARGET = xX86_64; then
fi
fi
-AC_CACHE_CHECK([whether .eh_frame section should be read-only],
- libffi_cv_ro_eh_frame, [
- libffi_cv_ro_eh_frame=no
- echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
- if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
- if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
- libffi_cv_ro_eh_frame=yes
- elif grep '.section.*eh_frame.*#alloc' conftest.c \
- | grep -v '#write' > /dev/null; then
- libffi_cv_ro_eh_frame=yes
- fi
- fi
- rm -f conftest.*
- ])
-if test "x$libffi_cv_ro_eh_frame" = xyes; then
- AC_DEFINE(HAVE_RO_EH_FRAME, 1,
- [Define if .eh_frame sections should be read-only.])
- AC_DEFINE(EH_FRAME_FLAGS, "a",
- [Define to the flags needed for the .section .eh_frame directive.])
-else
- AC_DEFINE(EH_FRAME_FLAGS, "aw",
- [Define to the flags needed for the .section .eh_frame directive.])
-fi
+if test "x$GCC" = "xyes"; then
+ AC_CACHE_CHECK([whether .eh_frame section should be read-only],
+ libffi_cv_ro_eh_frame, [
+ libffi_cv_ro_eh_frame=no
+ echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
+ if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
+ if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
+ libffi_cv_ro_eh_frame=yes
+ elif grep '.section.*eh_frame.*#alloc' conftest.c \
+ | grep -v '#write' > /dev/null; then
+ libffi_cv_ro_eh_frame=yes
+ fi
+ fi
+ rm -f conftest.*
+ ])
+ if test "x$libffi_cv_ro_eh_frame" = xyes; then
+ AC_DEFINE(HAVE_RO_EH_FRAME, 1,
+ [Define if .eh_frame sections should be read-only.])
+ AC_DEFINE(EH_FRAME_FLAGS, "a",
+ [Define to the flags needed for the .section .eh_frame directive. ])
+ else
+ AC_DEFINE(EH_FRAME_FLAGS, "aw",
+ [Define to the flags needed for the .section .eh_frame directive. ])
+ fi
-AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
- libffi_cv_hidden_visibility_attribute, [
- echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
- libffi_cv_hidden_visibility_attribute=no
- if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
- if grep '\.hidden.*foo' conftest.s >/dev/null; then
- libffi_cv_hidden_visibility_attribute=yes
- fi
- fi
- rm -f conftest.*
- ])
-if test $libffi_cv_hidden_visibility_attribute = yes; then
- AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1,
- [Define if __attribute__((visibility("hidden"))) is supported.])
+ AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
+ libffi_cv_hidden_visibility_attribute, [
+ echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c
+ libffi_cv_hidden_visibility_attribute=no
+ if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
+ if grep '\.hidden.*foo' conftest.s >/dev/null; then
+ libffi_cv_hidden_visibility_attribute=yes
+ fi
+ fi
+ rm -f conftest.*
+ ])
+ if test $libffi_cv_hidden_visibility_attribute = yes; then
+ AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1,
+ [Define if __attribute__((visibility("hidden"))) is supported.])
+ fi
fi
AH_BOTTOM([
@@ -400,6 +466,7 @@ AC_ARG_ENABLE(debug,
if test "$enable_debug" = "yes"; then
AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.])
fi)
+AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
AC_ARG_ENABLE(structs,
[ --disable-structs omit code for struct support],
diff --git a/libffi/doc/stamp-vti b/libffi/doc/stamp-vti
index 81d0b79d2d8..b9b21311f09 100644
--- a/libffi/doc/stamp-vti
+++ b/libffi/doc/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 14 February 2008
-@set UPDATED-MONTH February 2008
-@set EDITION 3.0.8
-@set VERSION 3.0.8
+@set UPDATED 6 March 2012
+@set UPDATED-MONTH March 2012
+@set EDITION 3.0.11
+@set VERSION 3.0.11
diff --git a/libffi/doc/version.texi b/libffi/doc/version.texi
index 81d0b79d2d8..b9b21311f09 100644
--- a/libffi/doc/version.texi
+++ b/libffi/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 14 February 2008
-@set UPDATED-MONTH February 2008
-@set EDITION 3.0.8
-@set VERSION 3.0.8
+@set UPDATED 6 March 2012
+@set UPDATED-MONTH March 2012
+@set EDITION 3.0.11
+@set VERSION 3.0.11
diff --git a/libffi/fficonfig.h.in b/libffi/fficonfig.h.in
index b54b273f957..52694eb9f05 100644
--- a/libffi/fficonfig.h.in
+++ b/libffi/fficonfig.h.in
@@ -20,6 +20,9 @@
/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */
#undef FFI_EXEC_TRAMPOLINE_TABLE
+/* Define this if you want to enable pax emulated trampolines */
+#undef FFI_MMAP_EXEC_EMUTRAMP_PAX
+
/* Cannot use malloc on this target, so, we revert to alternative means */
#undef FFI_MMAP_EXEC_WRIT
diff --git a/libffi/generate-ios-source-and-headers.py b/libffi/generate-ios-source-and-headers.py
new file mode 100644
index 00000000000..c2bca734ef1
--- /dev/null
+++ b/libffi/generate-ios-source-and-headers.py
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+
+import subprocess
+import re
+import os
+import errno
+import collections
+import sys
+
+class Platform(object):
+ pass
+
+sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)')
+
+def sdkinfo(sdkname):
+ ret = {}
+ for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIPE).stdout:
+ kv = line.strip().split(': ', 1)
+ if len(kv) == 2:
+ k,v = kv
+ ret[k] = v
+ return ret
+
+sim_sdk_info = sdkinfo('iphonesimulator')
+device_sdk_info = sdkinfo('iphoneos')
+
+def latest_sdks():
+ latest_sim = None
+ latest_device = None
+ for line in subprocess.Popen(['xcodebuild', '-showsdks'], stdout=subprocess.PIPE).stdout:
+ match = sdk_re.match(line)
+ if match:
+ if 'Simulator' in line:
+ latest_sim = match.group(1)
+ elif 'iOS' in line:
+ latest_device = match.group(1)
+
+ return latest_sim, latest_device
+
+sim_sdk, device_sdk = latest_sdks()
+
+class simulator_platform(Platform):
+ sdk='iphonesimulator'
+ arch = 'i386'
+ name = 'simulator'
+ triple = 'i386-apple-darwin10'
+ sdkroot = sim_sdk_info['Path']
+
+ prefix = "#if !defined(__arm__) && defined(__i386__)\n\n"
+ suffix = "\n\n#endif"
+
+class device_platform(Platform):
+ sdk='iphoneos'
+ name = 'ios'
+ arch = 'armv7'
+ triple = 'arm-apple-darwin10'
+ sdkroot = device_sdk_info['Path']
+
+ prefix = "#ifdef __arm__\n\n"
+ suffix = "\n\n#endif"
+
+
+def move_file(src_dir, dst_dir, filename, file_suffix=None, prefix='', suffix=''):
+ if not os.path.exists(dst_dir):
+ os.makedirs(dst_dir)
+
+ out_filename = filename
+
+ if file_suffix:
+ split_name = os.path.splitext(filename)
+ out_filename = "%s_%s%s" % (split_name[0], file_suffix, split_name[1])
+
+ with open(os.path.join(src_dir, filename)) as in_file:
+ with open(os.path.join(dst_dir, out_filename), 'w') as out_file:
+ if prefix:
+ out_file.write(prefix)
+
+ out_file.write(in_file.read())
+
+ if suffix:
+ out_file.write(suffix)
+
+headers_seen = collections.defaultdict(set)
+
+def move_source_tree(src_dir, dest_dir, dest_include_dir, arch=None, prefix=None, suffix=None):
+ for root, dirs, files in os.walk(src_dir, followlinks=True):
+ relroot = os.path.relpath(root,src_dir)
+
+ def move_dir(arch, prefix='', suffix='', files=[]):
+ for file in files:
+ file_suffix = None
+ if file.endswith('.h'):
+ if dest_include_dir:
+ file_suffix = arch
+ if arch:
+ headers_seen[file].add(arch)
+ move_file(root, dest_include_dir, file, arch, prefix=prefix, suffix=suffix)
+
+ elif dest_dir:
+ outroot = os.path.join(dest_dir, relroot)
+ move_file(root, outroot, file, prefix=prefix, suffix=suffix)
+
+ if relroot == '.':
+ move_dir(arch=arch,
+ files=files,
+ prefix=prefix,
+ suffix=suffix)
+ elif relroot == 'arm':
+ move_dir(arch='arm',
+ prefix="#ifdef __arm__\n\n",
+ suffix="\n\n#endif",
+ files=files)
+ elif relroot == 'x86':
+ move_dir(arch='i386',
+ prefix="#if !defined(__arm__) && defined(__i386__)\n\n",
+ suffix="\n\n#endif",
+ files=files)
+
+def build_target(platform):
+ def xcrun_cmd(cmd):
+ return subprocess.check_output(['xcrun', '-sdk', platform.sdkroot, '-find', cmd]).strip()
+
+ build_dir = 'build_' + platform.name
+ if not os.path.exists(build_dir):
+ os.makedirs(build_dir)
+ env = dict(CC=xcrun_cmd('clang'),
+ LD=xcrun_cmd('ld'),
+ CFLAGS='-arch %s -isysroot %s -miphoneos-version-min=4.0' % (platform.arch, platform.sdkroot))
+ working_dir=os.getcwd()
+ try:
+ os.chdir(build_dir)
+ subprocess.check_call(['../configure', '-host', platform.triple], env=env)
+ move_source_tree('.', None, '../ios/include',
+ arch=platform.arch,
+ prefix=platform.prefix,
+ suffix=platform.suffix)
+ move_source_tree('./include', None, '../ios/include',
+ arch=platform.arch,
+ prefix=platform.prefix,
+ suffix=platform.suffix)
+ finally:
+ os.chdir(working_dir)
+
+ for header_name, archs in headers_seen.iteritems():
+ basename, suffix = os.path.splitext(header_name)
+
+def main():
+ move_source_tree('src', 'ios/src', 'ios/include')
+ move_source_tree('include', None, 'ios/include')
+ build_target(simulator_platform)
+ build_target(device_platform)
+
+ for header_name, archs in headers_seen.iteritems():
+ basename, suffix = os.path.splitext(header_name)
+ with open(os.path.join('ios/include', header_name), 'w') as header:
+ for arch in archs:
+ header.write('#include <%s_%s%s>\n' % (basename, arch, suffix))
+
+if __name__ == '__main__':
+ main()
diff --git a/libffi/generate-osx-source-and-headers.py b/libffi/generate-osx-source-and-headers.py
new file mode 100644
index 00000000000..64313c1a364
--- /dev/null
+++ b/libffi/generate-osx-source-and-headers.py
@@ -0,0 +1,153 @@
+#!/usr/bin/env python
+import subprocess
+import re
+import os
+import errno
+import collections
+import sys
+
+class Platform(object):
+ pass
+
+sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)')
+
+def sdkinfo(sdkname):
+ ret = {}
+ for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIPE).stdout:
+ kv = line.strip().split(': ', 1)
+ if len(kv) == 2:
+ k,v = kv
+ ret[k] = v
+ return ret
+
+desktop_sdk_info = sdkinfo('macosx')
+
+def latest_sdks():
+ latest_desktop = None
+ for line in subprocess.Popen(['xcodebuild', '-showsdks'], stdout=subprocess.PIPE).stdout:
+ match = sdk_re.match(line)
+ if match:
+ if 'OS X' in line:
+ latest_desktop = match.group(1)
+
+ return latest_desktop
+
+desktop_sdk = latest_sdks()
+
+class desktop_platform_32(Platform):
+ sdk='macosx'
+ arch = 'i386'
+ name = 'mac32'
+ triple = 'i386-apple-darwin10'
+ sdkroot = desktop_sdk_info['Path']
+
+ prefix = "#if defined(__i386__) && !defined(__x86_64__)\n\n"
+ suffix = "\n\n#endif"
+
+class desktop_platform_64(Platform):
+ sdk='macosx'
+ arch = 'x86_64'
+ name = 'mac'
+ triple = 'x86_64-apple-darwin10'
+ sdkroot = desktop_sdk_info['Path']
+
+ prefix = "#if !defined(__i386__) && defined(__x86_64__)\n\n"
+ suffix = "\n\n#endif"
+
+def move_file(src_dir, dst_dir, filename, file_suffix=None, prefix='', suffix=''):
+ if not os.path.exists(dst_dir):
+ os.makedirs(dst_dir)
+
+ out_filename = filename
+
+ if file_suffix:
+ split_name = os.path.splitext(filename)
+ out_filename = "%s_%s%s" % (split_name[0], file_suffix, split_name[1])
+
+ with open(os.path.join(src_dir, filename)) as in_file:
+ with open(os.path.join(dst_dir, out_filename), 'w') as out_file:
+ if prefix:
+ out_file.write(prefix)
+
+ out_file.write(in_file.read())
+
+ if suffix:
+ out_file.write(suffix)
+
+headers_seen = collections.defaultdict(set)
+
+def move_source_tree(src_dir, dest_dir, dest_include_dir, arch=None, prefix=None, suffix=None):
+ for root, dirs, files in os.walk(src_dir, followlinks=True):
+ relroot = os.path.relpath(root,src_dir)
+
+ def move_dir(arch, prefix='', suffix='', files=[]):
+ for file in files:
+ file_suffix = None
+ if file.endswith('.h'):
+ if dest_include_dir:
+ file_suffix = arch
+ if arch:
+ headers_seen[file].add(arch)
+ move_file(root, dest_include_dir, file, arch, prefix=prefix, suffix=suffix)
+
+ elif dest_dir:
+ outroot = os.path.join(dest_dir, relroot)
+ move_file(root, outroot, file, prefix=prefix, suffix=suffix)
+
+ if relroot == '.':
+ move_dir(arch=arch,
+ files=files,
+ prefix=prefix,
+ suffix=suffix)
+ elif relroot == 'x86':
+ move_dir(arch='i386',
+ prefix="#if defined(__i386__) && !defined(__x86_64__)\n\n",
+ suffix="\n\n#endif",
+ files=files)
+ move_dir(arch='x86_64',
+ prefix="#if !defined(__i386__) && defined(__x86_64__)\n\n",
+ suffix="\n\n#endif",
+ files=files)
+
+def build_target(platform):
+ def xcrun_cmd(cmd):
+ return subprocess.check_output(['xcrun', '-sdk', platform.sdkroot, '-find', cmd]).strip()
+
+ build_dir = 'build_' + platform.name
+ if not os.path.exists(build_dir):
+ os.makedirs(build_dir)
+ env = dict(CC=xcrun_cmd('clang'),
+ LD=xcrun_cmd('ld'),
+ CFLAGS='-arch %s -isysroot %s -mmacosx-version-min=10.6' % (platform.arch, platform.sdkroot))
+ working_dir=os.getcwd()
+ try:
+ os.chdir(build_dir)
+ subprocess.check_call(['../configure', '-host', platform.triple], env=env)
+ move_source_tree('.', None, '../osx/include',
+ arch=platform.arch,
+ prefix=platform.prefix,
+ suffix=platform.suffix)
+ move_source_tree('./include', None, '../osx/include',
+ arch=platform.arch,
+ prefix=platform.prefix,
+ suffix=platform.suffix)
+ finally:
+ os.chdir(working_dir)
+
+ for header_name, archs in headers_seen.iteritems():
+ basename, suffix = os.path.splitext(header_name)
+
+def main():
+ move_source_tree('src', 'osx/src', 'osx/include')
+ move_source_tree('include', None, 'osx/include')
+ build_target(desktop_platform_32)
+ build_target(desktop_platform_64)
+
+ for header_name, archs in headers_seen.iteritems():
+ basename, suffix = os.path.splitext(header_name)
+ with open(os.path.join('osx/include', header_name), 'w') as header:
+ for arch in archs:
+ header.write('#include <%s_%s%s>\n' % (basename, arch, suffix))
+
+if __name__ == '__main__':
+ main()
diff --git a/libffi/include/Makefile.in b/libffi/include/Makefile.in
index 781b9a8ce86..5a54c45a776 100644
--- a/libffi/include/Makefile.in
+++ b/libffi/include/Makefile.in
@@ -39,7 +39,9 @@ subdir = include
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/ffi.h.in $(toollibffi_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/asmcfi.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -109,6 +111,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@
FGREP = @FGREP@
GREP = @GREP@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
diff --git a/libffi/libffi.xcodeproj/project.pbxproj b/libffi/libffi.xcodeproj/project.pbxproj
new file mode 100644
index 00000000000..14c39a2a4e1
--- /dev/null
+++ b/libffi/libffi.xcodeproj/project.pbxproj
@@ -0,0 +1,579 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 6C43CBDC1534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBBD1534F76F00162364 /* ffi.c */; };
+ 6C43CBDD1534F76F00162364 /* sysv.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBBF1534F76F00162364 /* sysv.S */; };
+ 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC01534F76F00162364 /* trampoline.S */; };
+ 6C43CBE61534F76F00162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC91534F76F00162364 /* darwin.S */; };
+ 6C43CBE81534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBCB1534F76F00162364 /* ffi.c */; };
+ 6C43CC1F1534F77800162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC051534F77800162364 /* darwin.S */; };
+ 6C43CC201534F77800162364 /* darwin64.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC061534F77800162364 /* darwin64.S */; };
+ 6C43CC211534F77800162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC071534F77800162364 /* ffi.c */; };
+ 6C43CC221534F77800162364 /* ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC081534F77800162364 /* ffi64.c */; };
+ 6C43CC2F1534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; };
+ 6C43CC301534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; };
+ 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; };
+ 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; };
+ 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; };
+ 6C43CC381534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; };
+ 6C43CC391534F7BE00162364 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2D1534F7BE00162364 /* raw_api.c */; };
+ 6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2D1534F7BE00162364 /* raw_api.c */; };
+ 6C43CC3B1534F7BE00162364 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2E1534F7BE00162364 /* types.c */; };
+ 6C43CC3C1534F7BE00162364 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2E1534F7BE00162364 /* types.c */; };
+ 6C43CC971535032600162364 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8D1535032600162364 /* ffi.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CC981535032600162364 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8E1535032600162364 /* ffi_common.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CC991535032600162364 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC8F1535032600162364 /* ffi_i386.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CC9A1535032600162364 /* ffi_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC901535032600162364 /* ffi_x86_64.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CC9B1535032600162364 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC911535032600162364 /* fficonfig.h */; };
+ 6C43CC9C1535032600162364 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC921535032600162364 /* fficonfig_i386.h */; };
+ 6C43CC9D1535032600162364 /* fficonfig_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC931535032600162364 /* fficonfig_x86_64.h */; };
+ 6C43CC9E1535032600162364 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC941535032600162364 /* ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CC9F1535032600162364 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC951535032600162364 /* ffitarget_i386.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCA01535032600162364 /* ffitarget_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CC961535032600162364 /* ffitarget_x86_64.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCAD1535039600162364 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA21535039600162364 /* ffi.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCAE1535039600162364 /* ffi_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA31535039600162364 /* ffi_armv7.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCAF1535039600162364 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA41535039600162364 /* ffi_common.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCB01535039600162364 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA51535039600162364 /* ffi_i386.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCB11535039600162364 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA61535039600162364 /* fficonfig.h */; };
+ 6C43CCB21535039600162364 /* fficonfig_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA71535039600162364 /* fficonfig_armv7.h */; };
+ 6C43CCB31535039600162364 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA81535039600162364 /* fficonfig_i386.h */; };
+ 6C43CCB41535039600162364 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCA91535039600162364 /* ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCB51535039600162364 /* ffitarget_arm.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAA1535039600162364 /* ffitarget_arm.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCB61535039600162364 /* ffitarget_armv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAB1535039600162364 /* ffitarget_armv7.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C43CCB71535039600162364 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C43CCAC1535039600162364 /* ffitarget_i386.h */; settings = {ATTRIBUTES = (Public, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 6C43CB3D1534E9D100162364 /* libffi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 6C43CBBD1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = "<group>"; };
+ 6C43CBBF1534F76F00162364 /* sysv.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sysv.S; sourceTree = "<group>"; };
+ 6C43CBC01534F76F00162364 /* trampoline.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = trampoline.S; sourceTree = "<group>"; };
+ 6C43CBC91534F76F00162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = "<group>"; };
+ 6C43CBCB1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = "<group>"; };
+ 6C43CC051534F77800162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = "<group>"; };
+ 6C43CC061534F77800162364 /* darwin64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin64.S; sourceTree = "<group>"; };
+ 6C43CC071534F77800162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = "<group>"; };
+ 6C43CC081534F77800162364 /* ffi64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64.c; sourceTree = "<group>"; };
+ 6C43CC281534F7BE00162364 /* closures.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = closures.c; path = src/closures.c; sourceTree = SOURCE_ROOT; };
+ 6C43CC2B1534F7BE00162364 /* java_raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = java_raw_api.c; path = src/java_raw_api.c; sourceTree = SOURCE_ROOT; };
+ 6C43CC2C1534F7BE00162364 /* prep_cif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prep_cif.c; path = src/prep_cif.c; sourceTree = SOURCE_ROOT; };
+ 6C43CC2D1534F7BE00162364 /* raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = raw_api.c; path = src/raw_api.c; sourceTree = SOURCE_ROOT; };
+ 6C43CC2E1534F7BE00162364 /* types.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = types.c; path = src/types.c; sourceTree = SOURCE_ROOT; };
+ 6C43CC8D1535032600162364 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = "<group>"; };
+ 6C43CC8E1535032600162364 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = "<group>"; };
+ 6C43CC8F1535032600162364 /* ffi_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = "<group>"; };
+ 6C43CC901535032600162364 /* ffi_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_x86_64.h; sourceTree = "<group>"; };
+ 6C43CC911535032600162364 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = "<group>"; };
+ 6C43CC921535032600162364 /* fficonfig_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_i386.h; sourceTree = "<group>"; };
+ 6C43CC931535032600162364 /* fficonfig_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_x86_64.h; sourceTree = "<group>"; };
+ 6C43CC941535032600162364 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = "<group>"; };
+ 6C43CC951535032600162364 /* ffitarget_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = "<group>"; };
+ 6C43CC961535032600162364 /* ffitarget_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_x86_64.h; sourceTree = "<group>"; };
+ 6C43CCA21535039600162364 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = "<group>"; };
+ 6C43CCA31535039600162364 /* ffi_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_armv7.h; sourceTree = "<group>"; };
+ 6C43CCA41535039600162364 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = "<group>"; };
+ 6C43CCA51535039600162364 /* ffi_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = "<group>"; };
+ 6C43CCA61535039600162364 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = "<group>"; };
+ 6C43CCA71535039600162364 /* fficonfig_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_armv7.h; sourceTree = "<group>"; };
+ 6C43CCA81535039600162364 /* fficonfig_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_i386.h; sourceTree = "<group>"; };
+ 6C43CCA91535039600162364 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = "<group>"; };
+ 6C43CCAA1535039600162364 /* ffitarget_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_arm.h; sourceTree = "<group>"; };
+ 6C43CCAB1535039600162364 /* ffitarget_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_armv7.h; sourceTree = "<group>"; };
+ 6C43CCAC1535039600162364 /* ffitarget_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = "<group>"; };
+ F6F980BA147386130008F121 /* libffi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 6C43CB3A1534E9D100162364 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F6F980B7147386130008F121 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 6C43CBAF1534F76F00162364 /* iOS */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CCA11535039600162364 /* include */,
+ 6C43CBBB1534F76F00162364 /* src */,
+ );
+ name = iOS;
+ path = ios;
+ sourceTree = "<group>";
+ };
+ 6C43CBBB1534F76F00162364 /* src */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CBC81534F76F00162364 /* x86 */,
+ 6C43CBBC1534F76F00162364 /* arm */,
+ );
+ path = src;
+ sourceTree = "<group>";
+ };
+ 6C43CBBC1534F76F00162364 /* arm */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CBBD1534F76F00162364 /* ffi.c */,
+ 6C43CBBF1534F76F00162364 /* sysv.S */,
+ 6C43CBC01534F76F00162364 /* trampoline.S */,
+ );
+ path = arm;
+ sourceTree = "<group>";
+ };
+ 6C43CBC81534F76F00162364 /* x86 */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CBC91534F76F00162364 /* darwin.S */,
+ 6C43CBCB1534F76F00162364 /* ffi.c */,
+ );
+ path = x86;
+ sourceTree = "<group>";
+ };
+ 6C43CBF01534F77800162364 /* OS X */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CC8C1535032600162364 /* include */,
+ 6C43CBFC1534F77800162364 /* src */,
+ );
+ name = "OS X";
+ path = osx;
+ sourceTree = "<group>";
+ };
+ 6C43CBFC1534F77800162364 /* src */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CC041534F77800162364 /* x86 */,
+ );
+ path = src;
+ sourceTree = "<group>";
+ };
+ 6C43CC041534F77800162364 /* x86 */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CC051534F77800162364 /* darwin.S */,
+ 6C43CC061534F77800162364 /* darwin64.S */,
+ 6C43CC071534F77800162364 /* ffi.c */,
+ 6C43CC081534F77800162364 /* ffi64.c */,
+ );
+ path = x86;
+ sourceTree = "<group>";
+ };
+ 6C43CC3D1534F7C400162364 /* src */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CC281534F7BE00162364 /* closures.c */,
+ 6C43CC2B1534F7BE00162364 /* java_raw_api.c */,
+ 6C43CC2C1534F7BE00162364 /* prep_cif.c */,
+ 6C43CC2D1534F7BE00162364 /* raw_api.c */,
+ 6C43CC2E1534F7BE00162364 /* types.c */,
+ );
+ name = src;
+ path = ios;
+ sourceTree = "<group>";
+ };
+ 6C43CC8C1535032600162364 /* include */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CC8D1535032600162364 /* ffi.h */,
+ 6C43CC8E1535032600162364 /* ffi_common.h */,
+ 6C43CC8F1535032600162364 /* ffi_i386.h */,
+ 6C43CC901535032600162364 /* ffi_x86_64.h */,
+ 6C43CC911535032600162364 /* fficonfig.h */,
+ 6C43CC921535032600162364 /* fficonfig_i386.h */,
+ 6C43CC931535032600162364 /* fficonfig_x86_64.h */,
+ 6C43CC941535032600162364 /* ffitarget.h */,
+ 6C43CC951535032600162364 /* ffitarget_i386.h */,
+ 6C43CC961535032600162364 /* ffitarget_x86_64.h */,
+ );
+ path = include;
+ sourceTree = "<group>";
+ };
+ 6C43CCA11535039600162364 /* include */ = {
+ isa = PBXGroup;
+ children = (
+ 6C43CCA21535039600162364 /* ffi.h */,
+ 6C43CCA31535039600162364 /* ffi_armv7.h */,
+ 6C43CCA41535039600162364 /* ffi_common.h */,
+ 6C43CCA51535039600162364 /* ffi_i386.h */,
+ 6C43CCA61535039600162364 /* fficonfig.h */,
+ 6C43CCA71535039600162364 /* fficonfig_armv7.h */,
+ 6C43CCA81535039600162364 /* fficonfig_i386.h */,
+ 6C43CCA91535039600162364 /* ffitarget.h */,
+ 6C43CCAA1535039600162364 /* ffitarget_arm.h */,
+ 6C43CCAB1535039600162364 /* ffitarget_armv7.h */,
+ 6C43CCAC1535039600162364 /* ffitarget_i386.h */,
+ );
+ path = include;
+ sourceTree = "<group>";
+ };
+ F6B0839514721EE50031D8A1 = {
+ isa = PBXGroup;
+ children = (
+ 6C43CC3D1534F7C400162364 /* src */,
+ 6C43CBAF1534F76F00162364 /* iOS */,
+ 6C43CBF01534F77800162364 /* OS X */,
+ F6F980C6147386260008F121 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ F6F980C6147386260008F121 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ F6F980BA147386130008F121 /* libffi.a */,
+ 6C43CB3D1534E9D100162364 /* libffi.a */,
+ );
+ name = Products;
+ path = ../..;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 6C43CB3B1534E9D100162364 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6C43CC971535032600162364 /* ffi.h in Headers */,
+ 6C43CC981535032600162364 /* ffi_common.h in Headers */,
+ 6C43CC991535032600162364 /* ffi_i386.h in Headers */,
+ 6C43CC9A1535032600162364 /* ffi_x86_64.h in Headers */,
+ 6C43CC9E1535032600162364 /* ffitarget.h in Headers */,
+ 6C43CC9F1535032600162364 /* ffitarget_i386.h in Headers */,
+ 6C43CCA01535032600162364 /* ffitarget_x86_64.h in Headers */,
+ 6C43CC9B1535032600162364 /* fficonfig.h in Headers */,
+ 6C43CC9C1535032600162364 /* fficonfig_i386.h in Headers */,
+ 6C43CC9D1535032600162364 /* fficonfig_x86_64.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F6F980B8147386130008F121 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6C43CCAD1535039600162364 /* ffi.h in Headers */,
+ 6C43CCAE1535039600162364 /* ffi_armv7.h in Headers */,
+ 6C43CCAF1535039600162364 /* ffi_common.h in Headers */,
+ 6C43CCB01535039600162364 /* ffi_i386.h in Headers */,
+ 6C43CCB41535039600162364 /* ffitarget.h in Headers */,
+ 6C43CCB51535039600162364 /* ffitarget_arm.h in Headers */,
+ 6C43CCB61535039600162364 /* ffitarget_armv7.h in Headers */,
+ 6C43CCB71535039600162364 /* ffitarget_i386.h in Headers */,
+ 6C43CCB11535039600162364 /* fficonfig.h in Headers */,
+ 6C43CCB21535039600162364 /* fficonfig_armv7.h in Headers */,
+ 6C43CCB31535039600162364 /* fficonfig_i386.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 6C43CB3C1534E9D100162364 /* libffi OS X */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 6C43CB4A1534E9D100162364 /* Build configuration list for PBXNativeTarget "libffi OS X" */;
+ buildPhases = (
+ 6C43CC401534FF3B00162364 /* Generate Source and Headers */,
+ 6C43CB391534E9D100162364 /* Sources */,
+ 6C43CB3A1534E9D100162364 /* Frameworks */,
+ 6C43CB3B1534E9D100162364 /* Headers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "libffi OS X";
+ productName = "ffi OS X";
+ productReference = 6C43CB3D1534E9D100162364 /* libffi.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+ F6F980B9147386130008F121 /* libffi iOS */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F6F980C4147386130008F121 /* Build configuration list for PBXNativeTarget "libffi iOS" */;
+ buildPhases = (
+ 6C43CC3E1534F8E200162364 /* Generate Trampoline */,
+ 6C43CC3F1534FF1B00162364 /* Generate Source and Headers */,
+ F6F980B6147386130008F121 /* Sources */,
+ F6F980B7147386130008F121 /* Frameworks */,
+ F6F980B8147386130008F121 /* Headers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "libffi iOS";
+ productName = ffi;
+ productReference = F6F980BA147386130008F121 /* libffi.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ F6B0839714721EE50031D8A1 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0430;
+ };
+ buildConfigurationList = F6B0839A14721EE50031D8A1 /* Build configuration list for PBXProject "libffi" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = F6B0839514721EE50031D8A1;
+ productRefGroup = F6B0839514721EE50031D8A1;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ F6F980B9147386130008F121 /* libffi iOS */,
+ 6C43CB3C1534E9D100162364 /* libffi OS X */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 6C43CC3E1534F8E200162364 /* Generate Trampoline */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Generate Trampoline";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /usr/bin/python;
+ shellScript = "import subprocess\nimport re\nimport os\nimport errno\nimport sys\n\ndef main():\n with open('src/arm/trampoline.S', 'w') as tramp_out:\n p = subprocess.Popen(['bash', 'src/arm/gentramp.sh'], stdout=tramp_out)\n p.wait()\n\nif __name__ == '__main__':\n main()";
+ };
+ 6C43CC3F1534FF1B00162364 /* Generate Source and Headers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Generate Source and Headers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/usr/bin/python generate-ios-source-and-headers.py";
+ };
+ 6C43CC401534FF3B00162364 /* Generate Source and Headers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Generate Source and Headers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/usr/bin/python generate-osx-source-and-headers.py";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 6C43CB391534E9D100162364 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6C43CC1F1534F77800162364 /* darwin.S in Sources */,
+ 6C43CC201534F77800162364 /* darwin64.S in Sources */,
+ 6C43CC211534F77800162364 /* ffi.c in Sources */,
+ 6C43CC221534F77800162364 /* ffi64.c in Sources */,
+ 6C43CC301534F7BE00162364 /* closures.c in Sources */,
+ 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */,
+ 6C43CC381534F7BE00162364 /* prep_cif.c in Sources */,
+ 6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */,
+ 6C43CC3C1534F7BE00162364 /* types.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F6F980B6147386130008F121 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6C43CBDC1534F76F00162364 /* ffi.c in Sources */,
+ 6C43CBDD1534F76F00162364 /* sysv.S in Sources */,
+ 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */,
+ 6C43CBE61534F76F00162364 /* darwin.S in Sources */,
+ 6C43CBE81534F76F00162364 /* ffi.c in Sources */,
+ 6C43CC2F1534F7BE00162364 /* closures.c in Sources */,
+ 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */,
+ 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */,
+ 6C43CC391534F7BE00162364 /* raw_api.c in Sources */,
+ 6C43CC3B1534F7BE00162364 /* types.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 6C43CB4B1534E9D100162364 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DSTROOT = /tmp/ffi.dst;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"",
+ );
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.6;
+ ONLY_ACTIVE_ARCH = YES;
+ PRODUCT_NAME = ffi;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 6C43CB4C1534E9D100162364 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ DSTROOT = /tmp/ffi.dst;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"",
+ );
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.6;
+ PRODUCT_NAME = ffi;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ F6B083AB14721EE50031D8A1 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VALUE = NO;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = ios/include;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ F6B083AC14721EE50031D8A1 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VALUE = NO;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = ios/include;
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ F6F980C2147386130008F121 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ armv6,
+ armv7,
+ );
+ DSTROOT = /tmp/ffi.dst;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_THUMB_SUPPORT = NO;
+ IPHONEOS_DEPLOYMENT_TARGET = 4.0;
+ OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_NAME = ffi;
+ SKIP_INSTALL = YES;
+ };
+ name = Debug;
+ };
+ F6F980C3147386130008F121 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ armv6,
+ armv7,
+ );
+ DSTROOT = /tmp/ffi.dst;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_THUMB_SUPPORT = NO;
+ IPHONEOS_DEPLOYMENT_TARGET = 4.0;
+ OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_NAME = ffi;
+ SKIP_INSTALL = YES;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 6C43CB4A1534E9D100162364 /* Build configuration list for PBXNativeTarget "libffi OS X" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 6C43CB4B1534E9D100162364 /* Debug */,
+ 6C43CB4C1534E9D100162364 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ F6B0839A14721EE50031D8A1 /* Build configuration list for PBXProject "libffi" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F6B083AB14721EE50031D8A1 /* Debug */,
+ F6B083AC14721EE50031D8A1 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ F6F980C4147386130008F121 /* Build configuration list for PBXNativeTarget "libffi iOS" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F6F980C2147386130008F121 /* Debug */,
+ F6F980C3147386130008F121 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = F6B0839714721EE50031D8A1 /* Project object */;
+}
diff --git a/libffi/man/Makefile.am b/libffi/man/Makefile.am
index 25192774887..afcbfb69f1d 100644
--- a/libffi/man/Makefile.am
+++ b/libffi/man/Makefile.am
@@ -2,7 +2,7 @@
AUTOMAKE_OPTIONS=foreign
-EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3
+EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
-man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3
+man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
diff --git a/libffi/man/Makefile.in b/libffi/man/Makefile.in
index 79466b353b9..1642f44307d 100644
--- a/libffi/man/Makefile.in
+++ b/libffi/man/Makefile.in
@@ -37,7 +37,9 @@ target_triplet = @target@
subdir = man
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/asmcfi.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -107,6 +109,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@
FGREP = @FGREP@
GREP = @GREP@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
@@ -207,8 +210,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
-EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3
-man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3
+EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
+man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
all: all-am
.SUFFIXES:
diff --git a/libffi/mdate-sh b/libffi/mdate-sh
new file mode 100644
index 00000000000..e631b2219a3
--- /dev/null
+++ b/libffi/mdate-sh
@@ -0,0 +1,205 @@
+#!/bin/sh
+# Get modification time of a file or directory and pretty-print it.
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009 Free
+# Software Foundation, Inc.
+# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+ '')
+ echo "$0: No file. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: mdate-sh [--help] [--version] FILE
+
+Pretty-print the modification time of FILE.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "mdate-sh $scriptversion"
+ exit $?
+ ;;
+esac
+
+# Prevent date giving response in another language.
+LANG=C
+export LANG
+LC_ALL=C
+export LC_ALL
+LC_TIME=C
+export LC_TIME
+
+# GNU ls changes its time format in response to the TIME_STYLE
+# variable. Since we cannot assume `unset' works, revert this
+# variable to its documented default.
+if test "${TIME_STYLE+set}" = set; then
+ TIME_STYLE=posix-long-iso
+ export TIME_STYLE
+fi
+
+save_arg1=$1
+
+# Find out how to get the extended ls output of a file or directory.
+if ls -L /dev/null 1>/dev/null 2>&1; then
+ ls_command='ls -L -l -d'
+else
+ ls_command='ls -l -d'
+fi
+# Avoid user/group names that might have spaces, when possible.
+if ls -n /dev/null 1>/dev/null 2>&1; then
+ ls_command="$ls_command -n"
+fi
+
+# A `ls -l' line looks as follows on OS/2.
+# drwxrwx--- 0 Aug 11 2001 foo
+# This differs from Unix, which adds ownership information.
+# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
+#
+# To find the date, we split the line on spaces and iterate on words
+# until we find a month. This cannot work with files whose owner is a
+# user named `Jan', or `Feb', etc. However, it's unlikely that `/'
+# will be owned by a user whose name is a month. So we first look at
+# the extended ls output of the root directory to decide how many
+# words should be skipped to get the date.
+
+# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
+set x`$ls_command /`
+
+# Find which argument is the month.
+month=
+command=
+until test $month
+do
+ shift
+ # Add another shift to the command.
+ command="$command shift;"
+ case $1 in
+ Jan) month=January; nummonth=1;;
+ Feb) month=February; nummonth=2;;
+ Mar) month=March; nummonth=3;;
+ Apr) month=April; nummonth=4;;
+ May) month=May; nummonth=5;;
+ Jun) month=June; nummonth=6;;
+ Jul) month=July; nummonth=7;;
+ Aug) month=August; nummonth=8;;
+ Sep) month=September; nummonth=9;;
+ Oct) month=October; nummonth=10;;
+ Nov) month=November; nummonth=11;;
+ Dec) month=December; nummonth=12;;
+ esac
+done
+
+# Get the extended ls output of the file or directory.
+set dummy x`eval "$ls_command \"\$save_arg1\""`
+
+# Remove all preceding arguments
+eval $command
+
+# Because of the dummy argument above, month is in $2.
+#
+# On a POSIX system, we should have
+#
+# $# = 5
+# $1 = file size
+# $2 = month
+# $3 = day
+# $4 = year or time
+# $5 = filename
+#
+# On Darwin 7.7.0 and 7.6.0, we have
+#
+# $# = 4
+# $1 = day
+# $2 = month
+# $3 = year or time
+# $4 = filename
+
+# Get the month.
+case $2 in
+ Jan) month=January; nummonth=1;;
+ Feb) month=February; nummonth=2;;
+ Mar) month=March; nummonth=3;;
+ Apr) month=April; nummonth=4;;
+ May) month=May; nummonth=5;;
+ Jun) month=June; nummonth=6;;
+ Jul) month=July; nummonth=7;;
+ Aug) month=August; nummonth=8;;
+ Sep) month=September; nummonth=9;;
+ Oct) month=October; nummonth=10;;
+ Nov) month=November; nummonth=11;;
+ Dec) month=December; nummonth=12;;
+esac
+
+case $3 in
+ ???*) day=$1;;
+ *) day=$3; shift;;
+esac
+
+# Here we have to deal with the problem that the ls output gives either
+# the time of day or the year.
+case $3 in
+ *:*) set `date`; eval year=\$$#
+ case $2 in
+ Jan) nummonthtod=1;;
+ Feb) nummonthtod=2;;
+ Mar) nummonthtod=3;;
+ Apr) nummonthtod=4;;
+ May) nummonthtod=5;;
+ Jun) nummonthtod=6;;
+ Jul) nummonthtod=7;;
+ Aug) nummonthtod=8;;
+ Sep) nummonthtod=9;;
+ Oct) nummonthtod=10;;
+ Nov) nummonthtod=11;;
+ Dec) nummonthtod=12;;
+ esac
+ # For the first six month of the year the time notation can also
+ # be used for files modified in the last year.
+ if (expr $nummonth \> $nummonthtod) > /dev/null;
+ then
+ year=`expr $year - 1`
+ fi;;
+ *) year=$3;;
+esac
+
+# The result.
+echo $day $month $year
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/libffi/src/aarch64/ffi.c b/libffi/src/aarch64/ffi.c
new file mode 100644
index 00000000000..14056656951
--- /dev/null
+++ b/libffi/src/aarch64/ffi.c
@@ -0,0 +1,1076 @@
+/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+``Software''), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdio.h>
+
+#include <ffi.h>
+#include <ffi_common.h>
+
+#include <stdlib.h>
+
+/* Stack alignment requirement in bytes */
+#define AARCH64_STACK_ALIGN 16
+
+#define N_X_ARG_REG 8
+#define N_V_ARG_REG 8
+
+#define AARCH64_FFI_WITH_V (1 << AARCH64_FFI_WITH_V_BIT)
+
+union _d
+{
+ UINT64 d;
+ UINT32 s[2];
+};
+
+struct call_context
+{
+ UINT64 x [AARCH64_N_XREG];
+ struct
+ {
+ union _d d[2];
+ } v [AARCH64_N_VREG];
+};
+
+static void *
+get_x_addr (struct call_context *context, unsigned n)
+{
+ return &context->x[n];
+}
+
+static void *
+get_s_addr (struct call_context *context, unsigned n)
+{
+#if defined __AARCH64EB__
+ return &context->v[n].d[1].s[1];
+#else
+ return &context->v[n].d[0].s[0];
+#endif
+}
+
+static void *
+get_d_addr (struct call_context *context, unsigned n)
+{
+#if defined __AARCH64EB__
+ return &context->v[n].d[1];
+#else
+ return &context->v[n].d[0];
+#endif
+}
+
+static void *
+get_v_addr (struct call_context *context, unsigned n)
+{
+ return &context->v[n];
+}
+
+/* Return the memory location at which a basic type would reside
+ were it to have been stored in register n. */
+
+static void *
+get_basic_type_addr (unsigned short type, struct call_context *context,
+ unsigned n)
+{
+ switch (type)
+ {
+ case FFI_TYPE_FLOAT:
+ return get_s_addr (context, n);
+ case FFI_TYPE_DOUBLE:
+ return get_d_addr (context, n);
+ case FFI_TYPE_LONGDOUBLE:
+ return get_v_addr (context, n);
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ return get_x_addr (context, n);
+ default:
+ FFI_ASSERT (0);
+ return NULL;
+ }
+}
+
+/* Return the alignment width for each of the basic types. */
+
+static size_t
+get_basic_type_alignment (unsigned short type)
+{
+ switch (type)
+ {
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ return sizeof (UINT64);
+ case FFI_TYPE_LONGDOUBLE:
+ return sizeof (long double);
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ return sizeof (UINT64);
+
+ default:
+ FFI_ASSERT (0);
+ return 0;
+ }
+}
+
+/* Return the size in bytes for each of the basic types. */
+
+static size_t
+get_basic_type_size (unsigned short type)
+{
+ switch (type)
+ {
+ case FFI_TYPE_FLOAT:
+ return sizeof (UINT32);
+ case FFI_TYPE_DOUBLE:
+ return sizeof (UINT64);
+ case FFI_TYPE_LONGDOUBLE:
+ return sizeof (long double);
+ case FFI_TYPE_UINT8:
+ return sizeof (UINT8);
+ case FFI_TYPE_SINT8:
+ return sizeof (SINT8);
+ case FFI_TYPE_UINT16:
+ return sizeof (UINT16);
+ case FFI_TYPE_SINT16:
+ return sizeof (SINT16);
+ case FFI_TYPE_UINT32:
+ return sizeof (UINT32);
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT32:
+ return sizeof (SINT32);
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ return sizeof (UINT64);
+ case FFI_TYPE_SINT64:
+ return sizeof (SINT64);
+
+ default:
+ FFI_ASSERT (0);
+ return 0;
+ }
+}
+
+extern void
+ffi_call_SYSV (unsigned (*)(struct call_context *context, unsigned char *,
+ extended_cif *),
+ struct call_context *context,
+ extended_cif *,
+ unsigned,
+ void (*fn)(void));
+
+extern void
+ffi_closure_SYSV (ffi_closure *);
+
+/* Test for an FFI floating point representation. */
+
+static unsigned
+is_floating_type (unsigned short type)
+{
+ return (type == FFI_TYPE_FLOAT || type == FFI_TYPE_DOUBLE
+ || type == FFI_TYPE_LONGDOUBLE);
+}
+
+/* Test for a homogeneous structure. */
+
+static unsigned short
+get_homogeneous_type (ffi_type *ty)
+{
+ if (ty->type == FFI_TYPE_STRUCT && ty->elements)
+ {
+ unsigned i;
+ unsigned short candidate_type
+ = get_homogeneous_type (ty->elements[0]);
+ for (i =1; ty->elements[i]; i++)
+ {
+ unsigned short iteration_type = 0;
+ /* If we have a nested struct, we must find its homogeneous type.
+ If that fits with our candidate type, we are still
+ homogeneous. */
+ if (ty->elements[i]->type == FFI_TYPE_STRUCT
+ && ty->elements[i]->elements)
+ {
+ iteration_type = get_homogeneous_type (ty->elements[i]);
+ }
+ else
+ {
+ iteration_type = ty->elements[i]->type;
+ }
+
+ /* If we are not homogeneous, return FFI_TYPE_STRUCT. */
+ if (candidate_type != iteration_type)
+ return FFI_TYPE_STRUCT;
+ }
+ return candidate_type;
+ }
+
+ /* Base case, we have no more levels of nesting, so we
+ are a basic type, and so, trivially homogeneous in that type. */
+ return ty->type;
+}
+
+/* Determine the number of elements within a STRUCT.
+
+ Note, we must handle nested structs.
+
+ If ty is not a STRUCT this function will return 0. */
+
+static unsigned
+element_count (ffi_type *ty)
+{
+ if (ty->type == FFI_TYPE_STRUCT && ty->elements)
+ {
+ unsigned n;
+ unsigned elems = 0;
+ for (n = 0; ty->elements[n]; n++)
+ {
+ if (ty->elements[n]->type == FFI_TYPE_STRUCT
+ && ty->elements[n]->elements)
+ elems += element_count (ty->elements[n]);
+ else
+ elems++;
+ }
+ return elems;
+ }
+ return 0;
+}
+
+/* Test for a homogeneous floating point aggregate.
+
+ A homogeneous floating point aggregate is a homogeneous aggregate of
+ a half- single- or double- precision floating point type with one
+ to four elements. Note that this includes nested structs of the
+ basic type. */
+
+static int
+is_hfa (ffi_type *ty)
+{
+ if (ty->type == FFI_TYPE_STRUCT
+ && ty->elements[0]
+ && is_floating_type (get_homogeneous_type (ty)))
+ {
+ unsigned n = element_count (ty);
+ return n >= 1 && n <= 4;
+ }
+ return 0;
+}
+
+/* Test if an ffi_type is a candidate for passing in a register.
+
+ This test does not check that sufficient registers of the
+ appropriate class are actually available, merely that IFF
+ sufficient registers are available then the argument will be passed
+ in register(s).
+
+ Note that an ffi_type that is deemed to be a register candidate
+ will always be returned in registers.
+
+ Returns 1 if a register candidate else 0. */
+
+static int
+is_register_candidate (ffi_type *ty)
+{
+ switch (ty->type)
+ {
+ case FFI_TYPE_VOID:
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ case FFI_TYPE_LONGDOUBLE:
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT64:
+ return 1;
+
+ case FFI_TYPE_STRUCT:
+ if (is_hfa (ty))
+ {
+ return 1;
+ }
+ else if (ty->size > 16)
+ {
+ /* Too large. Will be replaced with a pointer to memory. The
+ pointer MAY be passed in a register, but the value will
+ not. This test specifically fails since the argument will
+ never be passed by value in registers. */
+ return 0;
+ }
+ else
+ {
+ /* Might be passed in registers depending on the number of
+ registers required. */
+ return (ty->size + 7) / 8 < N_X_ARG_REG;
+ }
+ break;
+
+ default:
+ FFI_ASSERT (0);
+ break;
+ }
+
+ return 0;
+}
+
+/* Test if an ffi_type argument or result is a candidate for a vector
+ register. */
+
+static int
+is_v_register_candidate (ffi_type *ty)
+{
+ return is_floating_type (ty->type)
+ || (ty->type == FFI_TYPE_STRUCT && is_hfa (ty));
+}
+
+/* Representation of the procedure call argument marshalling
+ state.
+
+ The terse state variable names match the names used in the AARCH64
+ PCS. */
+
+struct arg_state
+{
+ unsigned ngrn; /* Next general-purpose register number. */
+ unsigned nsrn; /* Next vector register number. */
+ unsigned nsaa; /* Next stack offset. */
+};
+
+/* Initialize a procedure call argument marshalling state. */
+static void
+arg_init (struct arg_state *state, unsigned call_frame_size)
+{
+ state->ngrn = 0;
+ state->nsrn = 0;
+ state->nsaa = 0;
+}
+
+/* Return the number of available consecutive core argument
+ registers. */
+
+static unsigned
+available_x (struct arg_state *state)
+{
+ return N_X_ARG_REG - state->ngrn;
+}
+
+/* Return the number of available consecutive vector argument
+ registers. */
+
+static unsigned
+available_v (struct arg_state *state)
+{
+ return N_V_ARG_REG - state->nsrn;
+}
+
+static void *
+allocate_to_x (struct call_context *context, struct arg_state *state)
+{
+ FFI_ASSERT (state->ngrn < N_X_ARG_REG)
+ return get_x_addr (context, (state->ngrn)++);
+}
+
+static void *
+allocate_to_s (struct call_context *context, struct arg_state *state)
+{
+ FFI_ASSERT (state->nsrn < N_V_ARG_REG)
+ return get_s_addr (context, (state->nsrn)++);
+}
+
+static void *
+allocate_to_d (struct call_context *context, struct arg_state *state)
+{
+ FFI_ASSERT (state->nsrn < N_V_ARG_REG)
+ return get_d_addr (context, (state->nsrn)++);
+}
+
+static void *
+allocate_to_v (struct call_context *context, struct arg_state *state)
+{
+ FFI_ASSERT (state->nsrn < N_V_ARG_REG)
+ return get_v_addr (context, (state->nsrn)++);
+}
+
+/* Allocate an aligned slot on the stack and return a pointer to it. */
+static void *
+allocate_to_stack (struct arg_state *state, void *stack, unsigned alignment,
+ unsigned size)
+{
+ void *allocation;
+
+ /* Round up the NSAA to the larger of 8 or the natural
+ alignment of the argument's type. */
+ state->nsaa = ALIGN (state->nsaa, alignment);
+ state->nsaa = ALIGN (state->nsaa, alignment);
+ state->nsaa = ALIGN (state->nsaa, 8);
+
+ allocation = stack + state->nsaa;
+
+ state->nsaa += size;
+ return allocation;
+}
+
+static void
+copy_basic_type (void *dest, void *source, unsigned short type)
+{
+ /* This is neccessary to ensure that basic types are copied
+ sign extended to 64-bits as libffi expects. */
+ switch (type)
+ {
+ case FFI_TYPE_FLOAT:
+ *(float *) dest = *(float *) source;
+ break;
+ case FFI_TYPE_DOUBLE:
+ *(double *) dest = *(double *) source;
+ break;
+ case FFI_TYPE_LONGDOUBLE:
+ *(long double *) dest = *(long double *) source;
+ break;
+ case FFI_TYPE_UINT8:
+ *(ffi_arg *) dest = *(UINT8 *) source;
+ break;
+ case FFI_TYPE_SINT8:
+ *(ffi_sarg *) dest = *(SINT8 *) source;
+ break;
+ case FFI_TYPE_UINT16:
+ *(ffi_arg *) dest = *(UINT16 *) source;
+ break;
+ case FFI_TYPE_SINT16:
+ *(ffi_sarg *) dest = *(SINT16 *) source;
+ break;
+ case FFI_TYPE_UINT32:
+ *(ffi_arg *) dest = *(UINT32 *) source;
+ break;
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT32:
+ *(ffi_sarg *) dest = *(SINT32 *) source;
+ break;
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ *(ffi_arg *) dest = *(UINT64 *) source;
+ break;
+ case FFI_TYPE_SINT64:
+ *(ffi_sarg *) dest = *(SINT64 *) source;
+ break;
+
+ default:
+ FFI_ASSERT (0);
+ }
+}
+
+static void
+copy_hfa_to_reg_or_stack (void *memory,
+ ffi_type *ty,
+ struct call_context *context,
+ unsigned char *stack,
+ struct arg_state *state)
+{
+ unsigned elems = element_count (ty);
+ if (available_v (state) < elems)
+ {
+ /* There are insufficient V registers. Further V register allocations
+ are prevented, the NSAA is adjusted (by allocate_to_stack ())
+ and the argument is copied to memory at the adjusted NSAA. */
+ state->nsrn = N_V_ARG_REG;
+ memcpy (allocate_to_stack (state, stack, ty->alignment, ty->size),
+ memory,
+ ty->size);
+ }
+ else
+ {
+ int i;
+ unsigned short type = get_homogeneous_type (ty);
+ unsigned elems = element_count (ty);
+ for (i = 0; i < elems; i++)
+ {
+ void *reg = allocate_to_v (context, state);
+ copy_basic_type (reg, memory, type);
+ memory += get_basic_type_size (type);
+ }
+ }
+}
+
+/* Either allocate an appropriate register for the argument type, or if
+ none are available, allocate a stack slot and return a pointer
+ to the allocated space. */
+
+static void *
+allocate_to_register_or_stack (struct call_context *context,
+ unsigned char *stack,
+ struct arg_state *state,
+ unsigned short type)
+{
+ size_t alignment = get_basic_type_alignment (type);
+ size_t size = alignment;
+ switch (type)
+ {
+ case FFI_TYPE_FLOAT:
+ /* This is the only case for which the allocated stack size
+ should not match the alignment of the type. */
+ size = sizeof (UINT32);
+ /* Fall through. */
+ case FFI_TYPE_DOUBLE:
+ if (state->nsrn < N_V_ARG_REG)
+ return allocate_to_d (context, state);
+ state->nsrn = N_V_ARG_REG;
+ break;
+ case FFI_TYPE_LONGDOUBLE:
+ if (state->nsrn < N_V_ARG_REG)
+ return allocate_to_v (context, state);
+ state->nsrn = N_V_ARG_REG;
+ break;
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ if (state->ngrn < N_X_ARG_REG)
+ return allocate_to_x (context, state);
+ state->ngrn = N_X_ARG_REG;
+ break;
+ default:
+ FFI_ASSERT (0);
+ }
+
+ return allocate_to_stack (state, stack, alignment, size);
+}
+
+/* Copy a value to an appropriate register, or if none are
+ available, to the stack. */
+
+static void
+copy_to_register_or_stack (struct call_context *context,
+ unsigned char *stack,
+ struct arg_state *state,
+ void *value,
+ unsigned short type)
+{
+ copy_basic_type (
+ allocate_to_register_or_stack (context, stack, state, type),
+ value,
+ type);
+}
+
+/* Marshall the arguments from FFI representation to procedure call
+ context and stack. */
+
+static unsigned
+aarch64_prep_args (struct call_context *context, unsigned char *stack,
+ extended_cif *ecif)
+{
+ int i;
+ struct arg_state state;
+
+ arg_init (&state, ALIGN(ecif->cif->bytes, 16));
+
+ for (i = 0; i < ecif->cif->nargs; i++)
+ {
+ ffi_type *ty = ecif->cif->arg_types[i];
+ switch (ty->type)
+ {
+ case FFI_TYPE_VOID:
+ FFI_ASSERT (0);
+ break;
+
+ /* If the argument is a basic type the argument is allocated to an
+ appropriate register, or if none are available, to the stack. */
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ case FFI_TYPE_LONGDOUBLE:
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ copy_to_register_or_stack (context, stack, &state,
+ ecif->avalue[i], ty->type);
+ break;
+
+ case FFI_TYPE_STRUCT:
+ if (is_hfa (ty))
+ {
+ copy_hfa_to_reg_or_stack (ecif->avalue[i], ty, context,
+ stack, &state);
+ }
+ else if (ty->size > 16)
+ {
+ /* If the argument is a composite type that is larger than 16
+ bytes, then the argument has been copied to memory, and
+ the argument is replaced by a pointer to the copy. */
+
+ copy_to_register_or_stack (context, stack, &state,
+ &(ecif->avalue[i]), FFI_TYPE_POINTER);
+ }
+ else if (available_x (&state) >= (ty->size + 7) / 8)
+ {
+ /* If the argument is a composite type and the size in
+ double-words is not more than the number of available
+ X registers, then the argument is copied into consecutive
+ X registers. */
+ int j;
+ for (j = 0; j < (ty->size + 7) / 8; j++)
+ {
+ memcpy (allocate_to_x (context, &state),
+ &(((UINT64 *) ecif->avalue[i])[j]),
+ sizeof (UINT64));
+ }
+ }
+ else
+ {
+ /* Otherwise, there are insufficient X registers. Further X
+ register allocations are prevented, the NSAA is adjusted
+ (by allocate_to_stack ()) and the argument is copied to
+ memory at the adjusted NSAA. */
+ state.ngrn = N_X_ARG_REG;
+
+ memcpy (allocate_to_stack (&state, stack, ty->alignment,
+ ty->size), ecif->avalue + i, ty->size);
+ }
+ break;
+
+ default:
+ FFI_ASSERT (0);
+ break;
+ }
+ }
+
+ return ecif->cif->aarch64_flags;
+}
+
+ffi_status
+ffi_prep_cif_machdep (ffi_cif *cif)
+{
+ /* Round the stack up to a multiple of the stack alignment requirement. */
+ cif->bytes =
+ (cif->bytes + (AARCH64_STACK_ALIGN - 1)) & ~ (AARCH64_STACK_ALIGN - 1);
+
+ /* Initialize our flags. We are interested if this CIF will touch a
+ vector register, if so we will enable context save and load to
+ those registers, otherwise not. This is intended to be friendly
+ to lazy float context switching in the kernel. */
+ cif->aarch64_flags = 0;
+
+ if (is_v_register_candidate (cif->rtype))
+ {
+ cif->aarch64_flags |= AARCH64_FFI_WITH_V;
+ }
+ else
+ {
+ int i;
+ for (i = 0; i < cif->nargs; i++)
+ if (is_v_register_candidate (cif->arg_types[i]))
+ {
+ cif->aarch64_flags |= AARCH64_FFI_WITH_V;
+ break;
+ }
+ }
+
+ return FFI_OK;
+}
+
+/* Call a function with the provided arguments and capture the return
+ value. */
+void
+ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
+{
+ extended_cif ecif;
+
+ ecif.cif = cif;
+ ecif.avalue = avalue;
+ ecif.rvalue = rvalue;
+
+ switch (cif->abi)
+ {
+ case FFI_SYSV:
+ {
+ struct call_context context;
+ unsigned stack_bytes;
+
+ /* Figure out the total amount of stack space we need, the
+ above call frame space needs to be 16 bytes aligned to
+ ensure correct alignment of the first object inserted in
+ that space hence the ALIGN applied to cif->bytes.*/
+ stack_bytes = ALIGN(cif->bytes, 16);
+
+ memset (&context, 0, sizeof (context));
+ if (is_register_candidate (cif->rtype))
+ {
+ ffi_call_SYSV (aarch64_prep_args, &context, &ecif, stack_bytes, fn);
+ switch (cif->rtype->type)
+ {
+ case FFI_TYPE_VOID:
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ case FFI_TYPE_LONGDOUBLE:
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT64:
+ {
+ void *addr = get_basic_type_addr (cif->rtype->type,
+ &context, 0);
+ copy_basic_type (rvalue, addr, cif->rtype->type);
+ break;
+ }
+
+ case FFI_TYPE_STRUCT:
+ if (is_hfa (cif->rtype))
+ {
+ int j;
+ unsigned short type = get_homogeneous_type (cif->rtype);
+ unsigned elems = element_count (cif->rtype);
+ for (j = 0; j < elems; j++)
+ {
+ void *reg = get_basic_type_addr (type, &context, j);
+ copy_basic_type (rvalue, reg, type);
+ rvalue += get_basic_type_size (type);
+ }
+ }
+ else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG)
+ {
+ unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64));
+ memcpy (rvalue, get_x_addr (&context, 0), size);
+ }
+ else
+ {
+ FFI_ASSERT (0);
+ }
+ break;
+
+ default:
+ FFI_ASSERT (0);
+ break;
+ }
+ }
+ else
+ {
+ memcpy (get_x_addr (&context, 8), &rvalue, sizeof (UINT64));
+ ffi_call_SYSV (aarch64_prep_args, &context, &ecif,
+ stack_bytes, fn);
+ }
+ break;
+ }
+
+ default:
+ FFI_ASSERT (0);
+ break;
+ }
+}
+
+static unsigned char trampoline [] =
+{ 0x70, 0x00, 0x00, 0x58, /* ldr x16, 1f */
+ 0x91, 0x00, 0x00, 0x10, /* adr x17, 2f */
+ 0x00, 0x02, 0x1f, 0xd6 /* br x16 */
+};
+
+/* Build a trampoline. */
+
+#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX,FLAGS) \
+ ({unsigned char *__tramp = (unsigned char*)(TRAMP); \
+ UINT64 __fun = (UINT64)(FUN); \
+ UINT64 __ctx = (UINT64)(CTX); \
+ UINT64 __flags = (UINT64)(FLAGS); \
+ memcpy (__tramp, trampoline, sizeof (trampoline)); \
+ memcpy (__tramp + 12, &__fun, sizeof (__fun)); \
+ memcpy (__tramp + 20, &__ctx, sizeof (__ctx)); \
+ memcpy (__tramp + 28, &__flags, sizeof (__flags)); \
+ __clear_cache(__tramp, __tramp + FFI_TRAMPOLINE_SIZE); \
+ })
+
+ffi_status
+ffi_prep_closure_loc (ffi_closure* closure,
+ ffi_cif* cif,
+ void (*fun)(ffi_cif*,void*,void**,void*),
+ void *user_data,
+ void *codeloc)
+{
+ if (cif->abi != FFI_SYSV)
+ return FFI_BAD_ABI;
+
+ FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, codeloc,
+ cif->aarch64_flags);
+
+ closure->cif = cif;
+ closure->user_data = user_data;
+ closure->fun = fun;
+
+ return FFI_OK;
+}
+
+/* Primary handler to setup and invoke a function within a closure.
+
+ A closure when invoked enters via the assembler wrapper
+ ffi_closure_SYSV(). The wrapper allocates a call context on the
+ stack, saves the interesting registers (from the perspective of
+ the calling convention) into the context then passes control to
+ ffi_closure_SYSV_inner() passing the saved context and a pointer to
+ the stack at the point ffi_closure_SYSV() was invoked.
+
+ On the return path the assembler wrapper will reload call context
+ regsiters.
+
+ ffi_closure_SYSV_inner() marshalls the call context into ffi value
+ desriptors, invokes the wrapped function, then marshalls the return
+ value back into the call context. */
+
+void
+ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context,
+ void *stack)
+{
+ ffi_cif *cif = closure->cif;
+ void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
+ void *rvalue = NULL;
+ int i;
+ struct arg_state state;
+
+ arg_init (&state, ALIGN(cif->bytes, 16));
+
+ for (i = 0; i < cif->nargs; i++)
+ {
+ ffi_type *ty = cif->arg_types[i];
+
+ switch (ty->type)
+ {
+ case FFI_TYPE_VOID:
+ FFI_ASSERT (0);
+ break;
+
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ case FFI_TYPE_LONGDOUBLE:
+ avalue[i] = allocate_to_register_or_stack (context, stack,
+ &state, ty->type);
+ break;
+
+ case FFI_TYPE_STRUCT:
+ if (is_hfa (ty))
+ {
+ unsigned n = element_count (ty);
+ if (available_v (&state) < n)
+ {
+ state.nsrn = N_V_ARG_REG;
+ avalue[i] = allocate_to_stack (&state, stack, ty->alignment,
+ ty->size);
+ }
+ else
+ {
+ switch (get_homogeneous_type (ty))
+ {
+ case FFI_TYPE_FLOAT:
+ {
+ /* Eeek! We need a pointer to the structure,
+ however the homogeneous float elements are
+ being passed in individual S registers,
+ therefore the structure is not represented as
+ a contiguous sequence of bytes in our saved
+ register context. We need to fake up a copy
+ of the structure layed out in memory
+ correctly. The fake can be tossed once the
+ closure function has returned hence alloca()
+ is sufficient. */
+ int j;
+ UINT32 *p = avalue[i] = alloca (ty->size);
+ for (j = 0; j < element_count (ty); j++)
+ memcpy (&p[j],
+ allocate_to_s (context, &state),
+ sizeof (*p));
+ break;
+ }
+
+ case FFI_TYPE_DOUBLE:
+ {
+ /* Eeek! We need a pointer to the structure,
+ however the homogeneous float elements are
+ being passed in individual S registers,
+ therefore the structure is not represented as
+ a contiguous sequence of bytes in our saved
+ register context. We need to fake up a copy
+ of the structure layed out in memory
+ correctly. The fake can be tossed once the
+ closure function has returned hence alloca()
+ is sufficient. */
+ int j;
+ UINT64 *p = avalue[i] = alloca (ty->size);
+ for (j = 0; j < element_count (ty); j++)
+ memcpy (&p[j],
+ allocate_to_d (context, &state),
+ sizeof (*p));
+ break;
+ }
+
+ case FFI_TYPE_LONGDOUBLE:
+ memcpy (&avalue[i],
+ allocate_to_v (context, &state),
+ sizeof (*avalue));
+ break;
+
+ default:
+ FFI_ASSERT (0);
+ break;
+ }
+ }
+ }
+ else if (ty->size > 16)
+ {
+ /* Replace Composite type of size greater than 16 with a
+ pointer. */
+ memcpy (&avalue[i],
+ allocate_to_register_or_stack (context, stack,
+ &state, FFI_TYPE_POINTER),
+ sizeof (avalue[i]));
+ }
+ else if (available_x (&state) >= (ty->size + 7) / 8)
+ {
+ avalue[i] = get_x_addr (context, state.ngrn);
+ state.ngrn += (ty->size + 7) / 8;
+ }
+ else
+ {
+ state.ngrn = N_X_ARG_REG;
+
+ avalue[i] = allocate_to_stack (&state, stack, ty->alignment,
+ ty->size);
+ }
+ break;
+
+ default:
+ FFI_ASSERT (0);
+ break;
+ }
+ }
+
+ /* Figure out where the return value will be passed, either in
+ registers or in a memory block allocated by the caller and passed
+ in x8. */
+
+ if (is_register_candidate (cif->rtype))
+ {
+ /* Register candidates are *always* returned in registers. */
+
+ /* Allocate a scratchpad for the return value, we will let the
+ callee scrible the result into the scratch pad then move the
+ contents into the appropriate return value location for the
+ call convention. */
+ rvalue = alloca (cif->rtype->size);
+ (closure->fun) (cif, rvalue, avalue, closure->user_data);
+
+ /* Copy the return value into the call context so that it is returned
+ as expected to our caller. */
+ switch (cif->rtype->type)
+ {
+ case FFI_TYPE_VOID:
+ break;
+
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ case FFI_TYPE_LONGDOUBLE:
+ {
+ void *addr = get_basic_type_addr (cif->rtype->type, context, 0);
+ copy_basic_type (addr, rvalue, cif->rtype->type);
+ break;
+ }
+ case FFI_TYPE_STRUCT:
+ if (is_hfa (cif->rtype))
+ {
+ int i;
+ unsigned short type = get_homogeneous_type (cif->rtype);
+ unsigned elems = element_count (cif->rtype);
+ for (i = 0; i < elems; i++)
+ {
+ void *reg = get_basic_type_addr (type, context, i);
+ copy_basic_type (reg, rvalue, type);
+ rvalue += get_basic_type_size (type);
+ }
+ }
+ else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG)
+ {
+ unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)) ;
+ memcpy (get_x_addr (context, 0), rvalue, size);
+ }
+ else
+ {
+ FFI_ASSERT (0);
+ }
+ break;
+ default:
+ FFI_ASSERT (0);
+ break;
+ }
+ }
+ else
+ {
+ memcpy (&rvalue, get_x_addr (context, 8), sizeof (UINT64));
+ (closure->fun) (cif, rvalue, avalue, closure->user_data);
+ }
+}
+
diff --git a/libffi/src/aarch64/ffitarget.h b/libffi/src/aarch64/ffitarget.h
new file mode 100644
index 00000000000..6f1a348f532
--- /dev/null
+++ b/libffi/src/aarch64/ffitarget.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+``Software''), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+#ifndef LIBFFI_H
+#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
+#endif
+
+#ifndef LIBFFI_ASM
+typedef unsigned long ffi_arg;
+typedef signed long ffi_sarg;
+
+typedef enum ffi_abi
+ {
+ FFI_FIRST_ABI = 0,
+ FFI_SYSV,
+ FFI_LAST_ABI,
+ FFI_DEFAULT_ABI = FFI_SYSV
+ } ffi_abi;
+#endif
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#define FFI_CLOSURES 1
+#define FFI_TRAMPOLINE_SIZE 36
+#define FFI_NATIVE_RAW_API 0
+
+/* ---- Internal ---- */
+
+
+#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags
+
+#define AARCH64_FFI_WITH_V_BIT 0
+
+#define AARCH64_N_XREG 32
+#define AARCH64_N_VREG 32
+#define AARCH64_CALL_CONTEXT_SIZE (AARCH64_N_XREG * 8 + AARCH64_N_VREG * 16)
+
+#endif
diff --git a/libffi/src/aarch64/sysv.S b/libffi/src/aarch64/sysv.S
new file mode 100644
index 00000000000..b8cd421a8a5
--- /dev/null
+++ b/libffi/src/aarch64/sysv.S
@@ -0,0 +1,307 @@
+/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+``Software''), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define LIBFFI_ASM
+#include <fficonfig.h>
+#include <ffi.h>
+
+#define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
+#define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
+#define cfi_restore(reg) .cfi_restore reg
+#define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
+
+ .text
+ .globl ffi_call_SYSV
+ .type ffi_call_SYSV, #function
+
+/* ffi_call_SYSV()
+
+ Create a stack frame, setup an argument context, call the callee
+ and extract the result.
+
+ The maximum required argument stack size is provided,
+ ffi_call_SYSV() allocates that stack space then calls the
+ prepare_fn to populate register context and stack. The
+ argument passing registers are loaded from the register
+ context and the callee called, on return the register passing
+ register are saved back to the context. Our caller will
+ extract the return value from the final state of the saved
+ register context.
+
+ Prototype:
+
+ extern unsigned
+ ffi_call_SYSV (void (*)(struct call_context *context, unsigned char *,
+ extended_cif *),
+ struct call_context *context,
+ extended_cif *,
+ unsigned required_stack_size,
+ void (*fn)(void));
+
+ Therefore on entry we have:
+
+ x0 prepare_fn
+ x1 &context
+ x2 &ecif
+ x3 bytes
+ x4 fn
+
+ This function uses the following stack frame layout:
+
+ ==
+ saved x30(lr)
+ x29(fp)-> saved x29(fp)
+ saved x24
+ saved x23
+ saved x22
+ sp' -> saved x21
+ ...
+ sp -> (constructed callee stack arguments)
+ ==
+
+ Voila! */
+
+#define ffi_call_SYSV_FS (8 * 4)
+
+ .cfi_startproc
+ffi_call_SYSV:
+ stp x29, x30, [sp, #-16]!
+ cfi_adjust_cfa_offset (16)
+ cfi_rel_offset (x29, 0)
+ cfi_rel_offset (x30, 8)
+
+ mov x29, sp
+ cfi_def_cfa_register (x29)
+ sub sp, sp, #ffi_call_SYSV_FS
+
+ stp x21, x22, [sp, 0]
+ cfi_rel_offset (x21, 0 - ffi_call_SYSV_FS)
+ cfi_rel_offset (x22, 8 - ffi_call_SYSV_FS)
+
+ stp x23, x24, [sp, 16]
+ cfi_rel_offset (x23, 16 - ffi_call_SYSV_FS)
+ cfi_rel_offset (x24, 24 - ffi_call_SYSV_FS)
+
+ mov x21, x1
+ mov x22, x2
+ mov x24, x4
+
+ /* Allocate the stack space for the actual arguments, many
+ arguments will be passed in registers, but we assume
+ worst case and allocate sufficient stack for ALL of
+ the arguments. */
+ sub sp, sp, x3
+
+ /* unsigned (*prepare_fn) (struct call_context *context,
+ unsigned char *stack, extended_cif *ecif);
+ */
+ mov x23, x0
+ mov x0, x1
+ mov x1, sp
+ /* x2 already in place */
+ blr x23
+
+ /* Preserve the flags returned. */
+ mov x23, x0
+
+ /* Figure out if we should touch the vector registers. */
+ tbz x23, #AARCH64_FFI_WITH_V_BIT, 1f
+
+ /* Load the vector argument passing registers. */
+ ldp q0, q1, [x21, #8*32 + 0]
+ ldp q2, q3, [x21, #8*32 + 32]
+ ldp q4, q5, [x21, #8*32 + 64]
+ ldp q6, q7, [x21, #8*32 + 96]
+1:
+ /* Load the core argument passing registers. */
+ ldp x0, x1, [x21, #0]
+ ldp x2, x3, [x21, #16]
+ ldp x4, x5, [x21, #32]
+ ldp x6, x7, [x21, #48]
+
+ /* Don't forget x8 which may be holding the address of a return buffer.
+ */
+ ldr x8, [x21, #8*8]
+
+ blr x24
+
+ /* Save the core argument passing registers. */
+ stp x0, x1, [x21, #0]
+ stp x2, x3, [x21, #16]
+ stp x4, x5, [x21, #32]
+ stp x6, x7, [x21, #48]
+
+ /* Note nothing useful ever comes back in x8! */
+
+ /* Figure out if we should touch the vector registers. */
+ tbz x23, #AARCH64_FFI_WITH_V_BIT, 1f
+
+ /* Save the vector argument passing registers. */
+ stp q0, q1, [x21, #8*32 + 0]
+ stp q2, q3, [x21, #8*32 + 32]
+ stp q4, q5, [x21, #8*32 + 64]
+ stp q6, q7, [x21, #8*32 + 96]
+1:
+ /* All done, unwind our stack frame. */
+ ldp x21, x22, [x29, # - ffi_call_SYSV_FS]
+ cfi_restore (x21)
+ cfi_restore (x22)
+
+ ldp x23, x24, [x29, # - ffi_call_SYSV_FS + 16]
+ cfi_restore (x23)
+ cfi_restore (x24)
+
+ mov sp, x29
+ cfi_def_cfa_register (sp)
+
+ ldp x29, x30, [sp], #16
+ cfi_adjust_cfa_offset (-16)
+ cfi_restore (x29)
+ cfi_restore (x30)
+
+ ret
+
+ .cfi_endproc
+ .size ffi_call_SYSV, .-ffi_call_SYSV
+
+#define ffi_closure_SYSV_FS (8 * 2 + AARCH64_CALL_CONTEXT_SIZE)
+
+/* ffi_closure_SYSV
+
+ Closure invocation glue. This is the low level code invoked directly by
+ the closure trampoline to setup and call a closure.
+
+ On entry x17 points to a struct trampoline_data, x16 has been clobbered
+ all other registers are preserved.
+
+ We allocate a call context and save the argument passing registers,
+ then invoked the generic C ffi_closure_SYSV_inner() function to do all
+ the real work, on return we load the result passing registers back from
+ the call context.
+
+ On entry
+
+ extern void
+ ffi_closure_SYSV (struct trampoline_data *);
+
+ struct trampoline_data
+ {
+ UINT64 *ffi_closure;
+ UINT64 flags;
+ };
+
+ This function uses the following stack frame layout:
+
+ ==
+ saved x30(lr)
+ x29(fp)-> saved x29(fp)
+ saved x22
+ saved x21
+ ...
+ sp -> call_context
+ ==
+
+ Voila! */
+
+ .text
+ .globl ffi_closure_SYSV
+ .cfi_startproc
+ffi_closure_SYSV:
+ stp x29, x30, [sp, #-16]!
+ cfi_adjust_cfa_offset (16)
+ cfi_rel_offset (x29, 0)
+ cfi_rel_offset (x30, 8)
+
+ mov x29, sp
+
+ sub sp, sp, #ffi_closure_SYSV_FS
+ cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
+
+ stp x21, x22, [x29, #-16]
+ cfi_rel_offset (x21, 0)
+ cfi_rel_offset (x22, 8)
+
+ /* Load x21 with &call_context. */
+ mov x21, sp
+ /* Preserve our struct trampoline_data * */
+ mov x22, x17
+
+ /* Save the rest of the argument passing registers. */
+ stp x0, x1, [x21, #0]
+ stp x2, x3, [x21, #16]
+ stp x4, x5, [x21, #32]
+ stp x6, x7, [x21, #48]
+ /* Don't forget we may have been given a result scratch pad address.
+ */
+ str x8, [x21, #64]
+
+ /* Figure out if we should touch the vector registers. */
+ ldr x0, [x22, #8]
+ tbz x0, #AARCH64_FFI_WITH_V_BIT, 1f
+
+ /* Save the argument passing vector registers. */
+ stp q0, q1, [x21, #8*32 + 0]
+ stp q2, q3, [x21, #8*32 + 32]
+ stp q4, q5, [x21, #8*32 + 64]
+ stp q6, q7, [x21, #8*32 + 96]
+1:
+ /* Load &ffi_closure.. */
+ ldr x0, [x22, #0]
+ mov x1, x21
+ /* Compute the location of the stack at the point that the
+ trampoline was called. */
+ add x2, x29, #16
+
+ bl ffi_closure_SYSV_inner
+
+ /* Figure out if we should touch the vector registers. */
+ ldr x0, [x22, #8]
+ tbz x0, #AARCH64_FFI_WITH_V_BIT, 1f
+
+ /* Load the result passing vector registers. */
+ ldp q0, q1, [x21, #8*32 + 0]
+ ldp q2, q3, [x21, #8*32 + 32]
+ ldp q4, q5, [x21, #8*32 + 64]
+ ldp q6, q7, [x21, #8*32 + 96]
+1:
+ /* Load the result passing core registers. */
+ ldp x0, x1, [x21, #0]
+ ldp x2, x3, [x21, #16]
+ ldp x4, x5, [x21, #32]
+ ldp x6, x7, [x21, #48]
+ /* Note nothing usefull is returned in x8. */
+
+ /* We are done, unwind our frame. */
+ ldp x21, x22, [x29, #-16]
+ cfi_restore (x21)
+ cfi_restore (x22)
+
+ mov sp, x29
+ cfi_adjust_cfa_offset (-ffi_closure_SYSV_FS)
+
+ ldp x29, x30, [sp], #16
+ cfi_adjust_cfa_offset (-16)
+ cfi_restore (x29)
+ cfi_restore (x30)
+
+ ret
+ .cfi_endproc
+ .size ffi_closure_SYSV, .-ffi_closure_SYSV
diff --git a/libffi/src/arm/ffi.c b/libffi/src/arm/ffi.c
index 1f8597da88c..3ccceb9a508 100644
--- a/libffi/src/arm/ffi.c
+++ b/libffi/src/arm/ffi.c
@@ -251,8 +251,10 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
break;
case FFI_VFP:
+#ifdef __ARM_EABI__
ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue);
break;
+#endif
default:
FFI_ASSERT(0);
@@ -609,8 +611,10 @@ ffi_prep_closure_loc (ffi_closure* closure,
if (cif->abi == FFI_SYSV)
closure_func = &ffi_closure_SYSV;
+#ifdef __ARM_EABI__
else if (cif->abi == FFI_VFP)
closure_func = &ffi_closure_VFP;
+#endif
else
return FFI_BAD_ABI;
diff --git a/libffi/src/arm/sysv.S b/libffi/src/arm/sysv.S
index 60e2ae3d552..fb38cd6406a 100644
--- a/libffi/src/arm/sysv.S
+++ b/libffi/src/arm/sysv.S
@@ -41,7 +41,7 @@
#define CNAME(x) x
#endif
#ifdef __APPLE__
-#define ENTRY(x) .globl CNAME(x); CNAME(x):
+#define ENTRY(x) .globl _##x; _##x:
#else
#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
#endif /* __APPLE__ */
@@ -187,7 +187,7 @@ ARM_FUNC_START ffi_call_SYSV
@ r1 already set
@ Call ffi_prep_args(stack, &ecif)
- bl ffi_prep_args
+ bl CNAME(ffi_prep_args)
@ move first 4 parameters in registers
ldmia sp, {r0-r3}
@@ -334,7 +334,9 @@ ARM_FUNC_START ffi_closure_SYSV
/* Below are VFP hard-float ABI call and closure implementations.
- Add VFP FPU directive here. */
+ Add VFP FPU directive here. This is only compiled into the library
+ under EABI. */
+#ifdef __ARM_EABI__
.fpu vfp
@ r0: fn
@@ -362,7 +364,7 @@ ARM_FUNC_START ffi_call_VFP
sub r2, fp, #64 @ VFP scratch space
@ Call ffi_prep_args(stack, &ecif, vfp_space)
- bl ffi_prep_args
+ bl CNAME(ffi_prep_args)
@ Load VFP register args if needed
cmp r0, #0
@@ -444,7 +446,7 @@ ARM_FUNC_START ffi_closure_VFP
sub sp, sp, #72
str sp, [sp, #64]
add r1, sp, #64
- bl ffi_closure_SYSV_inner
+ bl CNAME(ffi_closure_SYSV_inner)
cmp r0, #FFI_TYPE_INT
beq .Lretint_vfp
@@ -491,6 +493,7 @@ ARM_FUNC_START ffi_closure_VFP
.ffi_closure_VFP_end:
UNWIND .fnend
.size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
+#endif
ENTRY(ffi_arm_trampoline)
stmfd sp!, {r0-r3}
diff --git a/libffi/src/arm/trampoline.S b/libffi/src/arm/trampoline.S
index 7b474291a25..935e8de1795 100644
--- a/libffi/src/arm/trampoline.S
+++ b/libffi/src/arm/trampoline.S
@@ -1,5 +1,5 @@
# GENERATED CODE - DO NOT EDIT
-# This file was generated by ./gentramp.sh
+# This file was generated by src/arm/gentramp.sh
# Copyright (c) 2010, Plausible Labs Cooperative, Inc.
#
diff --git a/libffi/src/bfin/ffi.c b/libffi/src/bfin/ffi.c
new file mode 100644
index 00000000000..0beccc14c93
--- /dev/null
+++ b/libffi/src/bfin/ffi.c
@@ -0,0 +1,195 @@
+/* -----------------------------------------------------------------------
+ ffi.c - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>
+
+ Blackfin Foreign Function Interface
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+#include <ffi.h>
+#include <ffi_common.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+/* Maximum number of GPRs available for argument passing. */
+#define MAX_GPRARGS 3
+
+/*
+ * Return types
+ */
+#define FFIBFIN_RET_VOID 0
+#define FFIBFIN_RET_BYTE 1
+#define FFIBFIN_RET_HALFWORD 2
+#define FFIBFIN_RET_INT64 3
+#define FFIBFIN_RET_INT32 4
+
+/*====================================================================*/
+/* PROTOTYPE *
+ /*====================================================================*/
+void ffi_prep_args(unsigned char *, extended_cif *);
+
+/*====================================================================*/
+/* Externals */
+/* (Assembly) */
+/*====================================================================*/
+
+extern void ffi_call_SYSV(unsigned, extended_cif *, void(*)(unsigned char *, extended_cif *), unsigned, void *, void(*fn)(void));
+
+/*====================================================================*/
+/* Implementation */
+/* */
+/*====================================================================*/
+
+
+/*
+ * This function calculates the return type (size) based on type.
+ */
+
+ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
+{
+ /* --------------------------------------*
+ * Return handling *
+ * --------------------------------------*/
+ switch (cif->rtype->type) {
+ case FFI_TYPE_VOID:
+ cif->flags = FFIBFIN_RET_VOID;
+ break;
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ cif->flags = FFIBFIN_RET_HALFWORD;
+ break;
+ case FFI_TYPE_UINT8:
+ cif->flags = FFIBFIN_RET_BYTE;
+ break;
+ case FFI_TYPE_INT:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_SINT8:
+ cif->flags = FFIBFIN_RET_INT32;
+ break;
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_DOUBLE:
+ cif->flags = FFIBFIN_RET_INT64;
+ break;
+ case FFI_TYPE_STRUCT:
+ if (cif->rtype->size <= 4){
+ cif->flags = FFIBFIN_RET_INT32;
+ }else if (cif->rtype->size == 8){
+ cif->flags = FFIBFIN_RET_INT64;
+ }else{
+ //it will return via a hidden pointer in P0
+ cif->flags = FFIBFIN_RET_VOID;
+ }
+ break;
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+ return FFI_OK;
+}
+
+/*
+ * This will prepare the arguments and will call the assembly routine
+ * cif = the call interface
+ * fn = the function to be called
+ * rvalue = the return value
+ * avalue = the arguments
+ */
+void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue)
+{
+ int ret_type = cif->flags;
+ extended_cif ecif;
+ ecif.cif = cif;
+ ecif.avalue = avalue;
+ ecif.rvalue = rvalue;
+
+ switch (cif->abi) {
+ case FFI_SYSV:
+ ffi_call_SYSV(cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn);
+ break;
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+}
+
+
+/*
+* This function prepares the parameters (copies them from the ecif to the stack)
+* to call the function (ffi_prep_args is called by the assembly routine in file
+* sysv.S, which also calls the actual function)
+*/
+void ffi_prep_args(unsigned char *stack, extended_cif *ecif)
+{
+ register unsigned int i = 0;
+ void **p_argv;
+ unsigned char *argp;
+ ffi_type **p_arg;
+ argp = stack;
+ p_argv = ecif->avalue;
+ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
+ (i != 0);
+ i--, p_arg++) {
+ size_t z;
+ z = (*p_arg)->size;
+ if (z < sizeof(int)) {
+ z = sizeof(int);
+ switch ((*p_arg)->type) {
+ case FFI_TYPE_SINT8: {
+ signed char v = *(SINT8 *)(* p_argv);
+ signed int t = v;
+ *(signed int *) argp = t;
+ }
+ break;
+ case FFI_TYPE_UINT8: {
+ unsigned char v = *(UINT8 *)(* p_argv);
+ unsigned int t = v;
+ *(unsigned int *) argp = t;
+ }
+ break;
+ case FFI_TYPE_SINT16:
+ *(signed int *) argp = (signed int) * (SINT16 *)(* p_argv);
+ break;
+ case FFI_TYPE_UINT16:
+ *(unsigned int *) argp = (unsigned int) * (UINT16 *)(* p_argv);
+ break;
+ case FFI_TYPE_STRUCT:
+ memcpy(argp, *p_argv, (*p_arg)->size);
+ break;
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+ } else if (z == sizeof(int)) {
+ *(unsigned int *) argp = (unsigned int) * (UINT32 *)(* p_argv);
+ } else {
+ memcpy(argp, *p_argv, z);
+ }
+ p_argv++;
+ argp += z;
+ }
+}
+
+
+
diff --git a/libffi/src/bfin/ffitarget.h b/libffi/src/bfin/ffitarget.h
new file mode 100644
index 00000000000..2175c010162
--- /dev/null
+++ b/libffi/src/bfin/ffitarget.h
@@ -0,0 +1,43 @@
+/* -----------------------------------------------------------------------
+ ffitarget.h - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>
+
+ Blackfin Foreign Function Interface
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+#ifndef LIBFFI_ASM
+typedef unsigned long ffi_arg;
+typedef signed long ffi_sarg;
+
+typedef enum ffi_abi {
+ FFI_FIRST_ABI = 0,
+ FFI_SYSV,
+ FFI_LAST_ABI,
+ FFI_DEFAULT_ABI = FFI_SYSV
+} ffi_abi;
+#endif
+
+#endif
+
diff --git a/libffi/src/bfin/sysv.S b/libffi/src/bfin/sysv.S
new file mode 100644
index 00000000000..ae7a1529b12
--- /dev/null
+++ b/libffi/src/bfin/sysv.S
@@ -0,0 +1,177 @@
+/* -----------------------------------------------------------------------
+ sysv.S - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>
+
+ Blackfin Foreign Function Interface
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#define LIBFFI_ASM
+#include <fficonfig.h>
+#include <ffi.h>
+
+.text
+.align 4
+
+ /*
+ There is a "feature" in the bfin toolchain that it puts a _ before funcion names
+ that's why the function here it's called _ffi_call_SYSV and not ffi_call_SYSV
+ */
+ .global _ffi_call_SYSV;
+ .type _ffi_call_SYSV, STT_FUNC;
+ .func ffi_call_SYSV
+
+ /*
+ cif->bytes = R0 (fp+8)
+ &ecif = R1 (fp+12)
+ ffi_prep_args = R2 (fp+16)
+ ret_type = stack (fp+20)
+ ecif.rvalue = stack (fp+24)
+ fn = stack (fp+28)
+ got (fp+32)
+ There is room for improvement here (we can use temporary registers
+ instead of saving the values in the memory)
+ REGS:
+ P5 => Stack pointer (function arguments)
+ R5 => cif->bytes
+ R4 => ret->type
+
+ FP-20 = P3
+ FP-16 = SP (parameters area)
+ FP-12 = SP (temp)
+ FP-08 = function return part 1 [R0]
+ FP-04 = function return part 2 [R1]
+ */
+
+_ffi_call_SYSV:
+.prologue:
+ LINK 20;
+ [FP-20] = P3;
+ [FP+8] = R0;
+ [FP+12] = R1;
+ [FP+16] = R2;
+
+.allocate_stack:
+ //alocate cif->bytes into the stack
+ R1 = [FP+8];
+ R0 = SP;
+ R0 = R0 - R1;
+ R1 = 4;
+ R0 = R0 - R1;
+ [FP-12] = SP;
+ SP = R0;
+ [FP-16] = SP;
+
+.call_prep_args:
+ //get the addr of prep_args
+ P0 = [P3 + _ffi_prep_args@FUNCDESC_GOT17M4];
+ P1 = [P0];
+ P3 = [P0+4];
+ R0 = [FP-16];//SP (parameter area)
+ R1 = [FP+12];//ecif
+ call (P1);
+
+.call_user_function:
+ //ajust SP so as to allow the user function access the parameters on the stack
+ SP = [FP-16]; //point to function parameters
+ R0 = [SP];
+ R1 = [SP+4];
+ R2 = [SP+8];
+ //load user function address
+ P0 = FP;
+ P0 +=28;
+ P1 = [P0];
+ P1 = [P1];
+ P3 = [P0+4];
+ /*
+ For functions returning aggregate values (struct) occupying more than 8 bytes,
+ the caller allocates the return value object on the stack and the address
+ of this object is passed to the callee as a hidden argument in register P0.
+ */
+ P0 = [FP+24];
+
+ call (P1);
+ SP = [FP-12];
+.compute_return:
+ P2 = [FP-20];
+ [FP-8] = R0;
+ [FP-4] = R1;
+
+ R0 = [FP+20];
+ R1 = R0 << 2;
+
+ R0 = [P2+.rettable@GOT17M4];
+ R0 = R1 + R0;
+ P2 = R0;
+ R1 = [P2];
+
+ P2 = [FP+-20];
+ R0 = [P2+.rettable@GOT17M4];
+ R0 = R1 + R0;
+ P2 = R0;
+ R0 = [FP-8];
+ R1 = [FP-4];
+ jump (P2);
+
+/*
+#define FFIBFIN_RET_VOID 0
+#define FFIBFIN_RET_BYTE 1
+#define FFIBFIN_RET_HALFWORD 2
+#define FFIBFIN_RET_INT64 3
+#define FFIBFIN_RET_INT32 4
+*/
+.align 4
+.align 4
+.rettable:
+ .dd .epilogue - .rettable
+ .dd .rbyte - .rettable;
+ .dd .rhalfword - .rettable;
+ .dd .rint64 - .rettable;
+ .dd .rint32 - .rettable;
+
+.rbyte:
+ P0 = [FP+24];
+ R0 = R0.B (Z);
+ [P0] = R0;
+ JUMP .epilogue
+.rhalfword:
+ P0 = [FP+24];
+ R0 = R0.L;
+ [P0] = R0;
+ JUMP .epilogue
+.rint64:
+ P0 = [FP+24];// &rvalue
+ [P0] = R0;
+ [P0+4] = R1;
+ JUMP .epilogue
+.rint32:
+ P0 = [FP+24];
+ [P0] = R0;
+.epilogue:
+ R0 = [FP+8];
+ R1 = [FP+12];
+ R2 = [FP+16];
+ P3 = [FP-20];
+ UNLINK;
+ RTS;
+
+.size _ffi_call_SYSV,.-_ffi_call_SYSV;
+.endfunc
diff --git a/libffi/src/closures.c b/libffi/src/closures.c
index 1b378270363..fecbc4ae2c9 100644
--- a/libffi/src/closures.c
+++ b/libffi/src/closures.c
@@ -172,6 +172,27 @@ selinux_enabled_check (void)
#endif /* !FFI_MMAP_EXEC_SELINUX */
+/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */
+#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX
+#include <stdlib.h>
+
+static int emutramp_enabled = -1;
+
+static int
+emutramp_enabled_check (void)
+{
+ if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL)
+ return 1;
+ else
+ return 0;
+}
+
+#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \
+ : (emutramp_enabled = emutramp_enabled_check ()))
+#else
+#define is_emutramp_enabled() 0
+#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */
+
#elif defined (__CYGWIN__) || defined(__INTERIX)
#include <sys/mman.h>
@@ -458,6 +479,12 @@ dlmmap (void *start, size_t length, int prot,
printf ("mapping in %zi\n", length);
#endif
+ if (execfd == -1 && is_emutramp_enabled ())
+ {
+ ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset);
+ return ptr;
+ }
+
if (execfd == -1 && !is_selinux_enabled ())
{
ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset);
diff --git a/libffi/src/m68k/ffi.c b/libffi/src/m68k/ffi.c
index d95c72b93bd..37a078437ea 100644
--- a/libffi/src/m68k/ffi.c
+++ b/libffi/src/m68k/ffi.c
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
ffi.c
-
- m68k Foreign Function Interface
+
+ m68k Foreign Function Interface
----------------------------------------------------------------------- */
#include <ffi.h>
@@ -13,8 +13,13 @@
void rtems_cache_flush_multiple_data_lines( const void *, size_t );
#else
#include <sys/syscall.h>
+#ifdef __MINT__
+#include <mint/mintbind.h>
+#include <mint/ssystem.h>
+#else
#include <asm/cachectl.h>
#endif
+#endif
void ffi_call_SYSV (extended_cif *,
unsigned, unsigned,
@@ -39,8 +44,12 @@ ffi_prep_args (void *stack, extended_cif *ecif)
argp = stack;
- if (ecif->cif->rtype->type == FFI_TYPE_STRUCT
- && !ecif->cif->flags)
+ if (
+#ifdef __MINT__
+ (ecif->cif->rtype->type == FFI_TYPE_LONGDOUBLE) ||
+#endif
+ (((ecif->cif->rtype->type == FFI_TYPE_STRUCT)
+ && !ecif->cif->flags)))
struct_value_ptr = ecif->rvalue;
else
struct_value_ptr = NULL;
@@ -51,12 +60,12 @@ ffi_prep_args (void *stack, extended_cif *ecif)
i != 0;
i--, p_arg++)
{
- size_t z;
+ size_t z = (*p_arg)->size;
+ int type = (*p_arg)->type;
- z = (*p_arg)->size;
if (z < sizeof (int))
{
- switch ((*p_arg)->type)
+ switch (type)
{
case FFI_TYPE_SINT8:
*(signed int *) argp = (signed int) *(SINT8 *) *p_argv;
@@ -75,7 +84,14 @@ ffi_prep_args (void *stack, extended_cif *ecif)
break;
case FFI_TYPE_STRUCT:
+#ifdef __MINT__
+ if (z == 1 || z == 2)
+ memcpy (argp + 2, *p_argv, z);
+ else
+ memcpy (argp, *p_argv, z);
+#else
memcpy (argp + sizeof (int) - z, *p_argv, z);
+#endif
break;
default:
@@ -120,17 +136,34 @@ ffi_prep_cif_machdep (ffi_cif *cif)
break;
case FFI_TYPE_STRUCT:
+ if (cif->rtype->elements[0]->type == FFI_TYPE_STRUCT &&
+ cif->rtype->elements[1])
+ {
+ cif->flags = 0;
+ break;
+ }
+
switch (cif->rtype->size)
{
case 1:
+#ifdef __MINT__
+ cif->flags = CIF_FLAGS_STRUCT2;
+#else
cif->flags = CIF_FLAGS_STRUCT1;
+#endif
break;
case 2:
cif->flags = CIF_FLAGS_STRUCT2;
break;
+#ifdef __MINT__
+ case 3:
+#endif
case 4:
cif->flags = CIF_FLAGS_INT;
break;
+#ifdef __MINT__
+ case 7:
+#endif
case 8:
cif->flags = CIF_FLAGS_DINT;
break;
@@ -150,7 +183,11 @@ ffi_prep_cif_machdep (ffi_cif *cif)
#if (FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE)
case FFI_TYPE_LONGDOUBLE:
+#ifdef __MINT__
+ cif->flags = 0;
+#else
cif->flags = CIF_FLAGS_LDOUBLE;
+#endif
break;
#endif
@@ -218,6 +255,26 @@ ffi_prep_incoming_args_SYSV (char *stack, void **avalue, ffi_cif *cif)
size_t z;
z = (*p_arg)->size;
+#ifdef __MINT__
+ if (cif->flags &&
+ cif->rtype->type == FFI_TYPE_STRUCT &&
+ (z == 1 || z == 2))
+ {
+ *p_argv = (void *) (argp + 2);
+
+ z = 4;
+ }
+ else
+ if (cif->flags &&
+ cif->rtype->type == FFI_TYPE_STRUCT &&
+ (z == 3 || z == 4))
+ {
+ *p_argv = (void *) (argp);
+
+ z = 4;
+ }
+ else
+#endif
if (z <= 4)
{
*p_argv = (void *) (argp + 4 - z);
@@ -267,14 +324,21 @@ ffi_prep_closure_loc (ffi_closure* closure,
*(unsigned short *)closure->tramp = 0x207c;
*(void **)(closure->tramp + 2) = codeloc;
*(unsigned short *)(closure->tramp + 6) = 0x4ef9;
- if (cif->rtype->type == FFI_TYPE_STRUCT
- && !cif->flags)
+
+ if (
+#ifdef __MINT__
+ (cif->rtype->type == FFI_TYPE_LONGDOUBLE) ||
+#endif
+ (((cif->rtype->type == FFI_TYPE_STRUCT)
+ && !cif->flags)))
*(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV;
else
*(void **)(closure->tramp + 8) = ffi_closure_SYSV;
#ifdef __rtems__
rtems_cache_flush_multiple_data_lines( codeloc, FFI_TRAMPOLINE_SIZE );
+#elif defined(__MINT__)
+ Ssystem(S_FLUSHCACHE, codeloc, FFI_TRAMPOLINE_SIZE);
#else
syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE,
FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE);
@@ -286,4 +350,3 @@ ffi_prep_closure_loc (ffi_closure* closure,
return FFI_OK;
}
-
diff --git a/libffi/src/m68k/sysv.S b/libffi/src/m68k/sysv.S
index dfdd8644384..f6f4ef97eaf 100644
--- a/libffi/src/m68k/sysv.S
+++ b/libffi/src/m68k/sysv.S
@@ -1,6 +1,7 @@
/* -----------------------------------------------------------------------
- sysv.S - Copyright (c) 1998, 2012 Andreas Schwab
+ sysv.S - Copyright (c) 2012 Alan Hourihane
+ Copyright (c) 1998, 2012 Andreas Schwab
Copyright (c) 2008 Red Hat, Inc.
m68k Foreign Function Interface
@@ -42,13 +43,19 @@
#define CFI_ENDPROC()
#endif
+#ifdef __MINT__
+#define CALLFUNC(funcname) _ ## funcname
+#else
+#define CALLFUNC(funcname) funcname
+#endif
+
.text
- .globl ffi_call_SYSV
- .type ffi_call_SYSV,@function
+ .globl CALLFUNC(ffi_call_SYSV)
+ .type CALLFUNC(ffi_call_SYSV),@function
.align 4
-ffi_call_SYSV:
+CALLFUNC(ffi_call_SYSV):
CFI_STARTPROC()
link %fp,#0
CFI_OFFSET(14,-8)
@@ -63,14 +70,18 @@ ffi_call_SYSV:
move.l 8(%fp),-(%sp)
pea 4(%sp)
#if !defined __PIC__
- jsr ffi_prep_args
+ jsr CALLFUNC(ffi_prep_args)
#else
- bsr.l ffi_prep_args@PLTPC
+ bsr.l CALLFUNC(ffi_prep_args@PLTPC)
#endif
addq.l #8,%sp
| Pass pointer to struct value, if any
+#ifdef __MINT__
+ move.l %d0,%a1
+#else
move.l %a0,%a1
+#endif
| Call the function
move.l 24(%fp),%a0
@@ -142,7 +153,11 @@ retlongdouble:
retpointer:
btst #5,%d2
jbeq retstruct1
+#ifdef __MINT__
+ move.l %d0,(%a1)
+#else
move.l %a0,(%a1)
+#endif
jbra epilogue
retstruct1:
@@ -162,13 +177,13 @@ epilogue:
unlk %fp
rts
CFI_ENDPROC()
- .size ffi_call_SYSV,.-ffi_call_SYSV
+ .size CALLFUNC(ffi_call_SYSV),.-CALLFUNC(ffi_call_SYSV)
- .globl ffi_closure_SYSV
- .type ffi_closure_SYSV, @function
+ .globl CALLFUNC(ffi_closure_SYSV)
+ .type CALLFUNC(ffi_closure_SYSV), @function
.align 4
-ffi_closure_SYSV:
+CALLFUNC(ffi_closure_SYSV):
CFI_STARTPROC()
link %fp,#-12
CFI_OFFSET(14,-8)
@@ -178,9 +193,9 @@ ffi_closure_SYSV:
pea -12(%fp)
move.l %a0,-(%sp)
#if !defined __PIC__
- jsr ffi_closure_SYSV_inner
+ jsr CALLFUNC(ffi_closure_SYSV_inner)
#else
- bsr.l ffi_closure_SYSV_inner@PLTPC
+ bsr.l CALLFUNC(ffi_closure_SYSV_inner@PLTPC)
#endif
lsr.l #1,%d0
@@ -240,13 +255,13 @@ ffi_closure_SYSV:
jra .Lcls_epilogue
CFI_ENDPROC()
- .size ffi_closure_SYSV,.-ffi_closure_SYSV
+ .size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV)
- .globl ffi_closure_struct_SYSV
- .type ffi_closure_struct_SYSV, @function
+ .globl CALLFUNC(ffi_closure_struct_SYSV)
+ .type CALLFUNC(ffi_closure_struct_SYSV), @function
.align 4
-ffi_closure_struct_SYSV:
+CALLFUNC(ffi_closure_struct_SYSV):
CFI_STARTPROC()
link %fp,#0
CFI_OFFSET(14,-8)
@@ -256,14 +271,14 @@ ffi_closure_struct_SYSV:
move.l %a1,-(%sp)
move.l %a0,-(%sp)
#if !defined __PIC__
- jsr ffi_closure_SYSV_inner
+ jsr CALLFUNC(ffi_closure_SYSV_inner)
#else
- bsr.l ffi_closure_SYSV_inner@PLTPC
+ bsr.l CALLFUNC(ffi_closure_SYSV_inner@PLTPC)
#endif
unlk %fp
rts
CFI_ENDPROC()
- .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV
+ .size CALLFUNC(ffi_closure_struct_SYSV),.-CALLFUNC(ffi_closure_struct_SYSV)
#if defined __ELF__ && defined __linux__
.section .note.GNU-stack,"",@progbits
diff --git a/libffi/src/powerpc/ffi_darwin.c b/libffi/src/powerpc/ffi_darwin.c
index ee03dab6989..dd897f4c631 100644
--- a/libffi/src/powerpc/ffi_darwin.c
+++ b/libffi/src/powerpc/ffi_darwin.c
@@ -1065,10 +1065,10 @@ ffi_prep_closure_loc (ffi_closure* closure,
closure->cif = cif;
closure->fun = fun;
closure->user_data = user_data;
+ break;
default:
-
- FFI_ASSERT(0);
+ return FFI_BAD_ABI;
break;
}
return FFI_OK;
@@ -1235,7 +1235,7 @@ ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue,
if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE)
size_al = ALIGN(arg_types[i]->size, 8);
# if defined(POWERPC64)
- FFI_ASSERT (cif->abi != FFI_DARWIN)
+ FFI_ASSERT (cif->abi != FFI_DARWIN);
avalue[i] = pgr;
pgr += (size_al + 7) / 8;
# else
diff --git a/libffi/src/prep_cif.c b/libffi/src/prep_cif.c
index eb6834199b1..5d1924bbe58 100644
--- a/libffi/src/prep_cif.c
+++ b/libffi/src/prep_cif.c
@@ -140,6 +140,9 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
#ifdef SPARC
&& (cif->abi != FFI_V9 || cif->rtype->size > 32)
#endif
+#ifdef TILE
+ && (cif->rtype->size > 10 * FFI_SIZEOF_ARG)
+#endif
)
bytes = STACK_ARG_SIZE(sizeof(void*));
#endif
@@ -169,6 +172,16 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
if (((*ptr)->alignment - 1) & bytes)
bytes = ALIGN(bytes, (*ptr)->alignment);
+#ifdef TILE
+ if (bytes < 10 * FFI_SIZEOF_ARG &&
+ bytes + STACK_ARG_SIZE((*ptr)->size) > 10 * FFI_SIZEOF_ARG)
+ {
+ /* An argument is never split between the 10 parameter
+ registers and the stack. */
+ bytes = 10 * FFI_SIZEOF_ARG;
+ }
+#endif
+
bytes += STACK_ARG_SIZE((*ptr)->size);
}
#endif
diff --git a/libffi/src/tile/ffi.c b/libffi/src/tile/ffi.c
new file mode 100644
index 00000000000..3a94469c7fa
--- /dev/null
+++ b/libffi/src/tile/ffi.c
@@ -0,0 +1,355 @@
+/* -----------------------------------------------------------------------
+ ffi.c - Copyright (c) 2012 Tilera Corp.
+
+ TILE Foreign Function Interface
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#include <ffi.h>
+#include <ffi_common.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <arch/abi.h>
+#include <arch/icache.h>
+#include <arch/opcode.h>
+
+
+/* The first 10 registers are used to pass arguments and return values. */
+#define NUM_ARG_REGS 10
+
+/* Performs a raw function call with the given NUM_ARG_REGS register arguments
+ and the specified additional stack arguments (if any). */
+extern void ffi_call_tile(ffi_sarg reg_args[NUM_ARG_REGS],
+ const ffi_sarg *stack_args,
+ size_t stack_args_bytes,
+ void (*fnaddr)(void))
+ FFI_HIDDEN;
+
+/* This handles the raw call from the closure stub, cleaning up the
+ parameters and delegating to ffi_closure_tile_inner. */
+extern void ffi_closure_tile(void) FFI_HIDDEN;
+
+
+ffi_status
+ffi_prep_cif_machdep(ffi_cif *cif)
+{
+ /* We always allocate room for all registers. Even if we don't
+ use them as parameters, they get returned in the same array
+ as struct return values so we need to make room. */
+ if (cif->bytes < NUM_ARG_REGS * FFI_SIZEOF_ARG)
+ cif->bytes = NUM_ARG_REGS * FFI_SIZEOF_ARG;
+
+ if (cif->rtype->size > NUM_ARG_REGS * FFI_SIZEOF_ARG)
+ cif->flags = FFI_TYPE_STRUCT;
+ else
+ cif->flags = FFI_TYPE_INT;
+
+ /* Nothing to do. */
+ return FFI_OK;
+}
+
+
+static long
+assign_to_ffi_arg(ffi_sarg *out, void *in, const ffi_type *type,
+ int write_to_reg)
+{
+ switch (type->type)
+ {
+ case FFI_TYPE_SINT8:
+ *out = *(SINT8 *)in;
+ return 1;
+
+ case FFI_TYPE_UINT8:
+ *out = *(UINT8 *)in;
+ return 1;
+
+ case FFI_TYPE_SINT16:
+ *out = *(SINT16 *)in;
+ return 1;
+
+ case FFI_TYPE_UINT16:
+ *out = *(UINT16 *)in;
+ return 1;
+
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_UINT32:
+#ifndef __LP64__
+ case FFI_TYPE_POINTER:
+#endif
+ /* Note that even unsigned 32-bit quantities are sign extended
+ on tilegx when stored in a register. */
+ *out = *(SINT32 *)in;
+ return 1;
+
+ case FFI_TYPE_FLOAT:
+#ifdef __tilegx__
+ if (write_to_reg)
+ {
+ /* Properly sign extend the value. */
+ union { float f; SINT32 s32; } val;
+ val.f = *(float *)in;
+ *out = val.s32;
+ }
+ else
+#endif
+ {
+ *(float *)out = *(float *)in;
+ }
+ return 1;
+
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_DOUBLE:
+#ifdef __LP64__
+ case FFI_TYPE_POINTER:
+#endif
+ *(UINT64 *)out = *(UINT64 *)in;
+ return sizeof(UINT64) / FFI_SIZEOF_ARG;
+
+ case FFI_TYPE_STRUCT:
+ memcpy(out, in, type->size);
+ return (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG;
+
+ case FFI_TYPE_VOID:
+ /* Must be a return type. Nothing to do. */
+ return 0;
+
+ default:
+ FFI_ASSERT(0);
+ return -1;
+ }
+}
+
+
+void
+ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
+{
+ ffi_sarg * const arg_mem = alloca(cif->bytes);
+ ffi_sarg * const reg_args = arg_mem;
+ ffi_sarg * const stack_args = &reg_args[NUM_ARG_REGS];
+ ffi_sarg *argp = arg_mem;
+ ffi_type ** const arg_types = cif->arg_types;
+ const long num_args = cif->nargs;
+ long i;
+
+ if (cif->flags == FFI_TYPE_STRUCT)
+ {
+ /* Pass a hidden pointer to the return value. We make sure there
+ is scratch space for the callee to store the return value even if
+ our caller doesn't care about it. */
+ *argp++ = (intptr_t)(rvalue ? rvalue : alloca(cif->rtype->size));
+
+ /* No more work needed to return anything. */
+ rvalue = NULL;
+ }
+
+ for (i = 0; i < num_args; i++)
+ {
+ ffi_type *type = arg_types[i];
+ void * const arg_in = avalue[i];
+ ptrdiff_t arg_word = argp - arg_mem;
+
+#ifndef __tilegx__
+ /* Doubleword-aligned values are always in an even-number register
+ pair, or doubleword-aligned stack slot if out of registers. */
+ long align = arg_word & (type->alignment > FFI_SIZEOF_ARG);
+ argp += align;
+ arg_word += align;
+#endif
+
+ if (type->type == FFI_TYPE_STRUCT)
+ {
+ const size_t arg_size_in_words =
+ (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG;
+
+ if (arg_word < NUM_ARG_REGS &&
+ arg_word + arg_size_in_words > NUM_ARG_REGS)
+ {
+ /* Args are not allowed to span registers and the stack. */
+ argp = stack_args;
+ }
+
+ memcpy(argp, arg_in, type->size);
+ argp += arg_size_in_words;
+ }
+ else
+ {
+ argp += assign_to_ffi_arg(argp, arg_in, arg_types[i], 1);
+ }
+ }
+
+ /* Actually do the call. */
+ ffi_call_tile(reg_args, stack_args,
+ cif->bytes - (NUM_ARG_REGS * FFI_SIZEOF_ARG), fn);
+
+ if (rvalue != NULL)
+ assign_to_ffi_arg(rvalue, reg_args, cif->rtype, 0);
+}
+
+
+/* Template code for closure. */
+extern const UINT64 ffi_template_tramp_tile[] FFI_HIDDEN;
+
+
+ffi_status
+ffi_prep_closure_loc (ffi_closure *closure,
+ ffi_cif *cif,
+ void (*fun)(ffi_cif*, void*, void**, void*),
+ void *user_data,
+ void *codeloc)
+{
+#ifdef __tilegx__
+ /* TILE-Gx */
+ SINT64 c;
+ SINT64 h;
+ int s;
+ UINT64 *out;
+
+ if (cif->abi != FFI_UNIX)
+ return FFI_BAD_ABI;
+
+ out = (UINT64 *)closure->tramp;
+
+ c = (intptr_t)closure;
+ h = (intptr_t)ffi_closure_tile;
+ s = 0;
+
+ /* Find the smallest shift count that doesn't lose information
+ (i.e. no need to explicitly insert high bits of the address that
+ are just the sign extension of the low bits). */
+ while ((c >> s) != (SINT16)(c >> s) || (h >> s) != (SINT16)(h >> s))
+ s += 16;
+
+#define OPS(a, b, shift) \
+ (create_Imm16_X0((a) >> (shift)) | create_Imm16_X1((b) >> (shift)))
+
+ /* Emit the moveli. */
+ *out++ = ffi_template_tramp_tile[0] | OPS(c, h, s);
+ for (s -= 16; s >= 0; s -= 16)
+ *out++ = ffi_template_tramp_tile[1] | OPS(c, h, s);
+
+#undef OPS
+
+ *out++ = ffi_template_tramp_tile[2];
+
+#else
+ /* TILEPro */
+ UINT64 *out;
+ intptr_t delta;
+
+ if (cif->abi != FFI_UNIX)
+ return FFI_BAD_ABI;
+
+ out = (UINT64 *)closure->tramp;
+ delta = (intptr_t)ffi_closure_tile - (intptr_t)codeloc;
+
+ *out++ = ffi_template_tramp_tile[0] | create_JOffLong_X1(delta >> 3);
+#endif
+
+ closure->cif = cif;
+ closure->fun = fun;
+ closure->user_data = user_data;
+
+ invalidate_icache(closure->tramp, (char *)out - closure->tramp,
+ getpagesize());
+
+ return FFI_OK;
+}
+
+
+/* This is called by the assembly wrapper for closures. This does
+ all of the work. On entry reg_args[0] holds the values the registers
+ had when the closure was invoked. On return reg_args[1] holds the register
+ values to be returned to the caller (many of which may be garbage). */
+void FFI_HIDDEN
+ffi_closure_tile_inner(ffi_closure *closure,
+ ffi_sarg reg_args[2][NUM_ARG_REGS],
+ ffi_sarg *stack_args)
+{
+ ffi_cif * const cif = closure->cif;
+ void ** const avalue = alloca(cif->nargs * sizeof(void *));
+ void *rvalue;
+ ffi_type ** const arg_types = cif->arg_types;
+ ffi_sarg * const reg_args_in = reg_args[0];
+ ffi_sarg * const reg_args_out = reg_args[1];
+ ffi_sarg * argp;
+ long i, arg_word, nargs = cif->nargs;
+ /* Use a union to guarantee proper alignment for double. */
+ union { ffi_sarg arg[NUM_ARG_REGS]; double d; UINT64 u64; } closure_ret;
+
+ /* Start out reading register arguments. */
+ argp = reg_args_in;
+
+ /* Copy the caller's structure return address to that the closure
+ returns the data directly to the caller. */
+ if (cif->flags == FFI_TYPE_STRUCT)
+ {
+ /* Return by reference via hidden pointer. */
+ rvalue = (void *)(intptr_t)*argp++;
+ arg_word = 1;
+ }
+ else
+ {
+ /* Return the value in registers. */
+ rvalue = &closure_ret;
+ arg_word = 0;
+ }
+
+ /* Grab the addresses of the arguments. */
+ for (i = 0; i < nargs; i++)
+ {
+ ffi_type * const type = arg_types[i];
+ const size_t arg_size_in_words =
+ (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG;
+
+#ifndef __tilegx__
+ /* Doubleword-aligned values are always in an even-number register
+ pair, or doubleword-aligned stack slot if out of registers. */
+ long align = arg_word & (type->alignment > FFI_SIZEOF_ARG);
+ argp += align;
+ arg_word += align;
+#endif
+
+ if (arg_word == NUM_ARG_REGS ||
+ (arg_word < NUM_ARG_REGS &&
+ arg_word + arg_size_in_words > NUM_ARG_REGS))
+ {
+ /* Switch to reading arguments from the stack. */
+ argp = stack_args;
+ arg_word = NUM_ARG_REGS;
+ }
+
+ avalue[i] = argp;
+ argp += arg_size_in_words;
+ arg_word += arg_size_in_words;
+ }
+
+ /* Invoke the closure. */
+ closure->fun(cif, rvalue, avalue, closure->user_data);
+
+ if (cif->flags != FFI_TYPE_STRUCT)
+ {
+ /* Canonicalize for register representation. */
+ assign_to_ffi_arg(reg_args_out, &closure_ret, cif->rtype, 1);
+ }
+}
diff --git a/libffi/src/tile/ffitarget.h b/libffi/src/tile/ffitarget.h
new file mode 100644
index 00000000000..679fb5d904b
--- /dev/null
+++ b/libffi/src/tile/ffitarget.h
@@ -0,0 +1,65 @@
+/* -----------------------------------------------------------------*-C-*-
+ ffitarget.h - Copyright (c) 2012 Tilera Corp.
+ Target configuration macros for TILE.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+#ifndef LIBFFI_H
+#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
+#endif
+
+#ifndef LIBFFI_ASM
+
+#include <arch/abi.h>
+
+typedef uint_reg_t ffi_arg;
+typedef int_reg_t ffi_sarg;
+
+typedef enum ffi_abi {
+ FFI_FIRST_ABI = 0,
+ FFI_UNIX,
+ FFI_LAST_ABI,
+ FFI_DEFAULT_ABI = FFI_UNIX
+} ffi_abi;
+#endif
+
+/* ---- Definitions for closures ----------------------------------------- */
+#define FFI_CLOSURES 1
+
+#ifdef __tilegx__
+/* We always pass 8-byte values, even in -m32 mode. */
+# define FFI_SIZEOF_ARG 8
+# ifdef __LP64__
+# define FFI_TRAMPOLINE_SIZE (8 * 5) /* 5 bundles */
+# else
+# define FFI_TRAMPOLINE_SIZE (8 * 3) /* 3 bundles */
+# endif
+#else
+# define FFI_SIZEOF_ARG 4
+# define FFI_TRAMPOLINE_SIZE 8 /* 1 bundle */
+#endif
+#define FFI_NATIVE_RAW_API 0
+
+#endif
diff --git a/libffi/src/tile/tile.S b/libffi/src/tile/tile.S
new file mode 100644
index 00000000000..a186e1f8f00
--- /dev/null
+++ b/libffi/src/tile/tile.S
@@ -0,0 +1,360 @@
+/* -----------------------------------------------------------------------
+ tile.S - Copyright (c) 2011 Tilera Corp.
+
+ Tilera TILEPro and TILE-Gx Foreign Function Interface
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#define LIBFFI_ASM
+#include <fficonfig.h>
+#include <ffi.h>
+
+/* Number of bytes in a register. */
+#define REG_SIZE FFI_SIZEOF_ARG
+
+/* Number of bytes in stack linkage area for backtracing.
+
+ A note about the ABI: on entry to a procedure, sp points to a stack
+ slot where it must spill the return address if it's not a leaf.
+ REG_SIZE bytes beyond that is a slot owned by the caller which
+ contains the sp value that the caller had when it was originally
+ entered (i.e. the caller's frame pointer). */
+#define LINKAGE_SIZE (2 * REG_SIZE)
+
+/* The first 10 registers are used to pass arguments and return values. */
+#define NUM_ARG_REGS 10
+
+#ifdef __tilegx__
+#define SW st
+#define LW ld
+#define BGZT bgtzt
+#else
+#define SW sw
+#define LW lw
+#define BGZT bgzt
+#endif
+
+
+/* void ffi_call_tile (int_reg_t reg_args[NUM_ARG_REGS],
+ const int_reg_t *stack_args,
+ unsigned long stack_args_bytes,
+ void (*fnaddr)(void));
+
+ On entry, REG_ARGS contain the outgoing register values,
+ and STACK_ARGS containts STACK_ARG_BYTES of additional values
+ to be passed on the stack. If STACK_ARG_BYTES is zero, then
+ STACK_ARGS is ignored.
+
+ When the invoked function returns, the values of r0-r9 are
+ blindly stored back into REG_ARGS for the caller to examine. */
+
+ .section .text.ffi_call_tile, "ax", @progbits
+ .align 8
+ .globl ffi_call_tile
+ FFI_HIDDEN(ffi_call_tile)
+ffi_call_tile:
+
+/* Incoming arguments. */
+#define REG_ARGS r0
+#define INCOMING_STACK_ARGS r1
+#define STACK_ARG_BYTES r2
+#define ORIG_FNADDR r3
+
+/* Temporary values. */
+#define FRAME_SIZE r10
+#define TMP r11
+#define TMP2 r12
+#define OUTGOING_STACK_ARGS r13
+#define REG_ADDR_PTR r14
+#define RETURN_REG_ADDR r15
+#define FNADDR r16
+
+ .cfi_startproc
+ {
+ /* Save return address. */
+ SW sp, lr
+ .cfi_offset lr, 0
+ /* Prepare to spill incoming r52. */
+ addi TMP, sp, -REG_SIZE
+ /* Increase frame size to have room to spill r52 and REG_ARGS.
+ The +7 is to round up mod 8. */
+ addi FRAME_SIZE, STACK_ARG_BYTES, \
+ REG_SIZE + REG_SIZE + LINKAGE_SIZE + 7
+ }
+ {
+ /* Round stack frame size to a multiple of 8 to satisfy ABI. */
+ andi FRAME_SIZE, FRAME_SIZE, -8
+ /* Compute where to spill REG_ARGS value. */
+ addi TMP2, sp, -(REG_SIZE * 2)
+ }
+ {
+ /* Spill incoming r52. */
+ SW TMP, r52
+ .cfi_offset r52, -REG_SIZE
+ /* Set up our frame pointer. */
+ move r52, sp
+ .cfi_def_cfa_register r52
+ /* Push stack frame. */
+ sub sp, sp, FRAME_SIZE
+ }
+ {
+ /* Prepare to set up stack linkage. */
+ addi TMP, sp, REG_SIZE
+ /* Prepare to memcpy stack args. */
+ addi OUTGOING_STACK_ARGS, sp, LINKAGE_SIZE
+ /* Save REG_ARGS which we will need after we call the subroutine. */
+ SW TMP2, REG_ARGS
+ }
+ {
+ /* Set up linkage info to hold incoming stack pointer. */
+ SW TMP, r52
+ }
+ {
+ /* Skip stack args memcpy if we don't have any stack args (common). */
+ blezt STACK_ARG_BYTES, .Ldone_stack_args_memcpy
+ }
+
+.Lmemcpy_stack_args:
+ {
+ /* Load incoming argument from stack_args. */
+ LW TMP, INCOMING_STACK_ARGS
+ addi INCOMING_STACK_ARGS, INCOMING_STACK_ARGS, REG_SIZE
+ }
+ {
+ /* Store stack argument into outgoing stack argument area. */
+ SW OUTGOING_STACK_ARGS, TMP
+ addi OUTGOING_STACK_ARGS, OUTGOING_STACK_ARGS, REG_SIZE
+ addi STACK_ARG_BYTES, STACK_ARG_BYTES, -REG_SIZE
+ }
+ {
+ BGZT STACK_ARG_BYTES, .Lmemcpy_stack_args
+ }
+.Ldone_stack_args_memcpy:
+
+ {
+ /* Copy aside ORIG_FNADDR so we can overwrite its register. */
+ move FNADDR, ORIG_FNADDR
+ /* Prepare to load argument registers. */
+ addi REG_ADDR_PTR, r0, REG_SIZE
+ /* Load outgoing r0. */
+ LW r0, r0
+ }
+
+ /* Load up argument registers from the REG_ARGS array. */
+#define LOAD_REG(REG, PTR) \
+ { \
+ LW REG, PTR ; \
+ addi PTR, PTR, REG_SIZE \
+ }
+
+ LOAD_REG(r1, REG_ADDR_PTR)
+ LOAD_REG(r2, REG_ADDR_PTR)
+ LOAD_REG(r3, REG_ADDR_PTR)
+ LOAD_REG(r4, REG_ADDR_PTR)
+ LOAD_REG(r5, REG_ADDR_PTR)
+ LOAD_REG(r6, REG_ADDR_PTR)
+ LOAD_REG(r7, REG_ADDR_PTR)
+ LOAD_REG(r8, REG_ADDR_PTR)
+ LOAD_REG(r9, REG_ADDR_PTR)
+
+ {
+ /* Call the subroutine. */
+ jalr FNADDR
+ }
+
+ {
+ /* Restore original lr. */
+ LW lr, r52
+ /* Prepare to recover ARGS, which we spilled earlier. */
+ addi TMP, r52, -(2 * REG_SIZE)
+ }
+ {
+ /* Restore ARGS, so we can fill it in with the return regs r0-r9. */
+ LW RETURN_REG_ADDR, TMP
+ /* Prepare to restore original r52. */
+ addi TMP, r52, -REG_SIZE
+ }
+
+ {
+ /* Pop stack frame. */
+ move sp, r52
+ /* Restore original r52. */
+ LW r52, TMP
+ }
+
+#define STORE_REG(REG, PTR) \
+ { \
+ SW PTR, REG ; \
+ addi PTR, PTR, REG_SIZE \
+ }
+
+ /* Return all register values by reference. */
+ STORE_REG(r0, RETURN_REG_ADDR)
+ STORE_REG(r1, RETURN_REG_ADDR)
+ STORE_REG(r2, RETURN_REG_ADDR)
+ STORE_REG(r3, RETURN_REG_ADDR)
+ STORE_REG(r4, RETURN_REG_ADDR)
+ STORE_REG(r5, RETURN_REG_ADDR)
+ STORE_REG(r6, RETURN_REG_ADDR)
+ STORE_REG(r7, RETURN_REG_ADDR)
+ STORE_REG(r8, RETURN_REG_ADDR)
+ STORE_REG(r9, RETURN_REG_ADDR)
+
+ {
+ jrp lr
+ }
+
+ .cfi_endproc
+ .size ffi_call_tile, .-ffi_call_tile
+
+/* ffi_closure_tile(...)
+
+ On entry, lr points to the closure plus 8 bytes, and r10
+ contains the actual return address.
+
+ This function simply dumps all register parameters into a stack array
+ and passes the closure, the registers array, and the stack arguments
+ to C code that does all of the actual closure processing. */
+
+ .section .text.ffi_closure_tile, "ax", @progbits
+ .align 8
+ .globl ffi_closure_tile
+ FFI_HIDDEN(ffi_closure_tile)
+
+ .cfi_startproc
+/* Room to spill all NUM_ARG_REGS incoming registers, plus frame linkage. */
+#define CLOSURE_FRAME_SIZE (((NUM_ARG_REGS * REG_SIZE * 2 + LINKAGE_SIZE) + 7) & -8)
+ffi_closure_tile:
+ {
+#ifdef __tilegx__
+ st sp, lr
+ .cfi_offset lr, 0
+#else
+ /* Save return address (in r10 due to closure stub wrapper). */
+ SW sp, r10
+ .cfi_return_column r10
+ .cfi_offset r10, 0
+#endif
+ /* Compute address for stack frame linkage. */
+ addli r10, sp, -(CLOSURE_FRAME_SIZE - REG_SIZE)
+ }
+ {
+ /* Save incoming stack pointer in linkage area. */
+ SW r10, sp
+ .cfi_offset sp, -(CLOSURE_FRAME_SIZE - REG_SIZE)
+ /* Push a new stack frame. */
+ addli sp, sp, -CLOSURE_FRAME_SIZE
+ .cfi_adjust_cfa_offset CLOSURE_FRAME_SIZE
+ }
+
+ {
+ /* Create pointer to where to start spilling registers. */
+ addi r10, sp, LINKAGE_SIZE
+ }
+
+ /* Spill all the incoming registers. */
+ STORE_REG(r0, r10)
+ STORE_REG(r1, r10)
+ STORE_REG(r2, r10)
+ STORE_REG(r3, r10)
+ STORE_REG(r4, r10)
+ STORE_REG(r5, r10)
+ STORE_REG(r6, r10)
+ STORE_REG(r7, r10)
+ STORE_REG(r8, r10)
+ {
+ /* Save r9. */
+ SW r10, r9
+#ifdef __tilegx__
+ /* Pointer to closure is passed in r11. */
+ move r0, r11
+#else
+ /* Compute pointer to the closure object. Because the closure
+ starts with a "jal ffi_closure_tile", we can just take the
+ value of lr (a phony return address pointing into the closure)
+ and subtract 8. */
+ addi r0, lr, -8
+#endif
+ /* Compute a pointer to the register arguments we just spilled. */
+ addi r1, sp, LINKAGE_SIZE
+ }
+ {
+ /* Compute a pointer to the extra stack arguments (if any). */
+ addli r2, sp, CLOSURE_FRAME_SIZE + LINKAGE_SIZE
+ /* Call C code to deal with all of the grotty details. */
+ jal ffi_closure_tile_inner
+ }
+ {
+ addli r10, sp, CLOSURE_FRAME_SIZE
+ }
+ {
+ /* Restore the return address. */
+ LW lr, r10
+ /* Compute pointer to registers array. */
+ addli r10, sp, LINKAGE_SIZE + (NUM_ARG_REGS * REG_SIZE)
+ }
+ /* Return all the register values, which C code may have set. */
+ LOAD_REG(r0, r10)
+ LOAD_REG(r1, r10)
+ LOAD_REG(r2, r10)
+ LOAD_REG(r3, r10)
+ LOAD_REG(r4, r10)
+ LOAD_REG(r5, r10)
+ LOAD_REG(r6, r10)
+ LOAD_REG(r7, r10)
+ LOAD_REG(r8, r10)
+ LOAD_REG(r9, r10)
+ {
+ /* Pop the frame. */
+ addli sp, sp, CLOSURE_FRAME_SIZE
+ jrp lr
+ }
+
+ .cfi_endproc
+ .size ffi_closure_tile, . - ffi_closure_tile
+
+
+/* What follows are code template instructions that get copied to the
+ closure trampoline by ffi_prep_closure_loc. The zeroed operands
+ get replaced by their proper values at runtime. */
+
+ .section .text.ffi_template_tramp_tile, "ax", @progbits
+ .align 8
+ .globl ffi_template_tramp_tile
+ FFI_HIDDEN(ffi_template_tramp_tile)
+ffi_template_tramp_tile:
+#ifdef __tilegx__
+ {
+ moveli r11, 0 /* backpatched to address of containing closure. */
+ moveli r10, 0 /* backpatched to ffi_closure_tile. */
+ }
+ /* Note: the following bundle gets generated multiple times
+ depending on the pointer value (esp. useful for -m32 mode). */
+ { shl16insli r11, r11, 0 ; shl16insli r10, r10, 0 }
+ { info 2+8 /* for backtracer: -> pc in lr, frame size 0 */ ; jr r10 }
+#else
+ /* 'jal .' yields a PC-relative offset of zero so we can OR in the
+ right offset at runtime. */
+ { move r10, lr ; jal . /* ffi_closure_tile */ }
+#endif
+
+ .size ffi_template_tramp_tile, . - ffi_template_tramp_tile
diff --git a/libffi/src/x86/ffi.c b/libffi/src/x86/ffi.c
index f643b345cba..611e2219716 100644
--- a/libffi/src/x86/ffi.c
+++ b/libffi/src/x86/ffi.c
@@ -58,7 +58,8 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
argp = stack;
- if (ecif->cif->flags == FFI_TYPE_STRUCT
+ if ((ecif->cif->flags == FFI_TYPE_STRUCT
+ || ecif->cif->flags == FFI_TYPE_MS_STRUCT)
#ifdef X86_WIN64
&& (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2
&& ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8)
@@ -279,7 +280,12 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
else
#endif
{
- cif->flags = FFI_TYPE_STRUCT;
+#ifdef X86_WIN32
+ if (cif->abi == FFI_MS_CDECL)
+ cif->flags = FFI_TYPE_MS_STRUCT;
+ else
+#endif
+ cif->flags = FFI_TYPE_STRUCT;
/* allocate space for return value pointer */
cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG);
}
@@ -349,7 +355,8 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
}
#else
if (rvalue == NULL
- && cif->flags == FFI_TYPE_STRUCT)
+ && (cif->flags == FFI_TYPE_STRUCT
+ || cif->flags == FFI_TYPE_MS_STRUCT))
{
ecif.rvalue = alloca(cif->rtype->size);
}
@@ -368,6 +375,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
#elif defined(X86_WIN32)
case FFI_SYSV:
case FFI_STDCALL:
+ case FFI_MS_CDECL:
ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags,
ecif.rvalue, fn);
break;
@@ -513,7 +521,8 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
argp += sizeof(void *);
}
#else
- if ( cif->flags == FFI_TYPE_STRUCT ) {
+ if ( cif->flags == FFI_TYPE_STRUCT
+ || cif->flags == FFI_TYPE_MS_STRUCT ) {
*rvalue = *(void **) argp;
argp += sizeof(void *);
}
@@ -673,6 +682,12 @@ ffi_prep_closure_loc (ffi_closure* closure,
&ffi_closure_STDCALL,
(void*)codeloc, cif->bytes);
}
+ else if (cif->abi == FFI_MS_CDECL)
+ {
+ FFI_INIT_TRAMPOLINE (&closure->tramp[0],
+ &ffi_closure_SYSV,
+ (void*)codeloc);
+ }
#endif /* X86_WIN32 */
#endif /* !X86_WIN64 */
else
@@ -762,8 +777,9 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
/* If the return value is a struct and we don't have a return */
/* value address then we need to make one */
- if ((rvalue == NULL) &&
- (cif->rtype->type == FFI_TYPE_STRUCT))
+ if (rvalue == NULL
+ && (cif->flags == FFI_TYPE_STRUCT
+ || cif->flags == FFI_TYPE_MS_STRUCT))
{
ecif.rvalue = alloca(cif->rtype->size);
}
@@ -776,6 +792,7 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
#ifdef X86_WIN32
case FFI_SYSV:
case FFI_STDCALL:
+ case FFI_MS_CDECL:
ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags,
ecif.rvalue, fn);
break;
diff --git a/libffi/src/x86/ffi64.c b/libffi/src/x86/ffi64.c
index defd7744cce..1daa1c0b6fd 100644
--- a/libffi/src/x86/ffi64.c
+++ b/libffi/src/x86/ffi64.c
@@ -37,11 +37,17 @@
#define MAX_GPR_REGS 6
#define MAX_SSE_REGS 8
+#ifdef __INTEL_COMPILER
+#define UINT128 __m128
+#else
+#define UINT128 __int128_t
+#endif
+
struct register_args
{
/* Registers for argument passing. */
UINT64 gpr[MAX_GPR_REGS];
- __int128_t sse[MAX_SSE_REGS];
+ UINT128 sse[MAX_SSE_REGS];
};
extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
diff --git a/libffi/src/x86/ffitarget.h b/libffi/src/x86/ffitarget.h
index fc015410970..46f294cea72 100644
--- a/libffi/src/x86/ffitarget.h
+++ b/libffi/src/x86/ffitarget.h
@@ -81,9 +81,13 @@ typedef enum ffi_abi {
FFI_STDCALL,
FFI_THISCALL,
FFI_FASTCALL,
+ FFI_MS_CDECL,
FFI_LAST_ABI,
- /* TODO: Add fastcall support for the sake of completeness */
+#ifdef _MSC_VER
+ FFI_DEFAULT_ABI = FFI_MS_CDECL
+#else
FFI_DEFAULT_ABI = FFI_SYSV
+#endif
#elif defined(X86_WIN64)
FFI_WIN64,
@@ -110,6 +114,7 @@ typedef enum ffi_abi {
#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3)
+#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4)
#if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
#define FFI_TRAMPOLINE_SIZE 24
diff --git a/libffi/src/x86/win32.S b/libffi/src/x86/win32.S
index deb4a0394d8..24b7bbd0423 100644
--- a/libffi/src/x86/win32.S
+++ b/libffi/src/x86/win32.S
@@ -108,31 +108,37 @@ ca_jumpdata:
dd offset ca_retfloat ;; FFI_TYPE_FLOAT
dd offset ca_retdouble ;; FFI_TYPE_DOUBLE
dd offset ca_retlongdouble ;; FFI_TYPE_LONGDOUBLE
- dd offset ca_retint8 ;; FFI_TYPE_UINT8
- dd offset ca_retint8 ;; FFI_TYPE_SINT8
- dd offset ca_retint16 ;; FFI_TYPE_UINT16
- dd offset ca_retint16 ;; FFI_TYPE_SINT16
+ dd offset ca_retuint8 ;; FFI_TYPE_UINT8
+ dd offset ca_retsint8 ;; FFI_TYPE_SINT8
+ dd offset ca_retuint16 ;; FFI_TYPE_UINT16
+ dd offset ca_retsint16 ;; FFI_TYPE_SINT16
dd offset ca_retint ;; FFI_TYPE_UINT32
dd offset ca_retint ;; FFI_TYPE_SINT32
dd offset ca_retint64 ;; FFI_TYPE_UINT64
dd offset ca_retint64 ;; FFI_TYPE_SINT64
dd offset ca_epilogue ;; FFI_TYPE_STRUCT
dd offset ca_retint ;; FFI_TYPE_POINTER
- dd offset ca_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B
- dd offset ca_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B
+ dd offset ca_retstruct1b ;; FFI_TYPE_SMALL_STRUCT_1B
+ dd offset ca_retstruct2b ;; FFI_TYPE_SMALL_STRUCT_2B
dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B
+ dd offset ca_epilogue ;; FFI_TYPE_MS_STRUCT
-ca_retint8:
- ;; Load %ecx with the pointer to storage for the return value
- mov ecx, rvalue
- mov [ecx + 0], al
- jmp ca_epilogue
+ /* Sign/zero extend as appropriate. */
+ca_retuint8:
+ movzx eax, al
+ jmp ca_retint
-ca_retint16:
- ;; Load %ecx with the pointer to storage for the return value
- mov ecx, rvalue
- mov [ecx + 0], ax
- jmp ca_epilogue
+ca_retsint8:
+ movsx eax, al
+ jmp ca_retint
+
+ca_retuint16:
+ movzx eax, ax
+ jmp ca_retint
+
+ca_retsint16:
+ movsx eax, ax
+ jmp ca_retint
ca_retint:
;; Load %ecx with the pointer to storage for the return value
@@ -165,14 +171,24 @@ ca_retlongdouble:
fstp TBYTE PTR [ecx]
jmp ca_epilogue
+ca_retstruct1b:
+ ;; Load %ecx with the pointer to storage for the return value
+ mov ecx, rvalue
+ mov [ecx + 0], al
+ jmp ca_epilogue
+
+ca_retstruct2b:
+ ;; Load %ecx with the pointer to storage for the return value
+ mov ecx, rvalue
+ mov [ecx + 0], ax
+ jmp ca_epilogue
+
ca_epilogue:
;; Epilogue code is autogenerated.
ret
ffi_call_win32 ENDP
ffi_closure_THISCALL PROC NEAR FORCEFRAME
- push ebp
- mov ebp, esp
sub esp, 40
lea edx, [ebp -24]
mov [ebp - 12], edx /* resp */
@@ -187,7 +203,7 @@ ffi_closure_SYSV PROC NEAR FORCEFRAME
lea edx, [ebp - 24]
mov [ebp - 12], edx ;; resp
lea edx, [ebp + 8]
-stub:
+stub::
mov [esp + 8], edx ;; args
lea edx, [ebp - 12]
mov [esp + 4], edx ;; &resp
@@ -204,26 +220,35 @@ cs_jumpdata:
dd offset cs_retfloat ;; FFI_TYPE_FLOAT
dd offset cs_retdouble ;; FFI_TYPE_DOUBLE
dd offset cs_retlongdouble ;; FFI_TYPE_LONGDOUBLE
- dd offset cs_retint8 ;; FFI_TYPE_UINT8
- dd offset cs_retint8 ;; FFI_TYPE_SINT8
- dd offset cs_retint16 ;; FFI_TYPE_UINT16
- dd offset cs_retint16 ;; FFI_TYPE_SINT16
+ dd offset cs_retuint8 ;; FFI_TYPE_UINT8
+ dd offset cs_retsint8 ;; FFI_TYPE_SINT8
+ dd offset cs_retuint16 ;; FFI_TYPE_UINT16
+ dd offset cs_retsint16 ;; FFI_TYPE_SINT16
dd offset cs_retint ;; FFI_TYPE_UINT32
dd offset cs_retint ;; FFI_TYPE_SINT32
dd offset cs_retint64 ;; FFI_TYPE_UINT64
dd offset cs_retint64 ;; FFI_TYPE_SINT64
dd offset cs_retstruct ;; FFI_TYPE_STRUCT
dd offset cs_retint ;; FFI_TYPE_POINTER
- dd offset cs_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B
- dd offset cs_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B
+ dd offset cs_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B
+ dd offset cs_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B
dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B
+ dd offset cs_retmsstruct ;; FFI_TYPE_MS_STRUCT
+
+cs_retuint8:
+ movzx eax, BYTE PTR [ecx]
+ jmp cs_epilogue
+
+cs_retsint8:
+ movsx eax, BYTE PTR [ecx]
+ jmp cs_epilogue
-cs_retint8:
- mov al, [ecx]
+cs_retuint16:
+ movzx eax, WORD PTR [ecx]
jmp cs_epilogue
-cs_retint16:
- mov ax, [ecx]
+cs_retsint16:
+ movsx eax, WORD PTR [ecx]
jmp cs_epilogue
cs_retint:
@@ -252,6 +277,12 @@ cs_retstruct:
;; Epilogue code is autogenerated.
ret 4
+cs_retmsstruct:
+ ;; Caller expects us to return a pointer to the real return value.
+ mov eax, ecx
+ ;; Caller doesn't expects us to pop struct return value pointer hidden arg.
+ jmp cs_epilogue
+
cs_epilogue:
;; Epilogue code is autogenerated.
ret
@@ -264,19 +295,16 @@ ffi_closure_SYSV ENDP
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
#define CIF_FLAGS_OFFSET 20
-ffi_closure_raw_THISCALL PROC NEAR
- push ebp
- mov ebp, esp
- push esi
+ffi_closure_raw_THISCALL PROC NEAR USES esi FORCEFRAME
sub esp, 36
mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx
- lea edx, [ebp + 12], edx
+ lea edx, [ebp + 12]
jmp stubraw
-ffi_closure_raw_SYSV ENDP
+ffi_closure_raw_THISCALL ENDP
-ffi_closure_raw_SYSV PROC NEAR USES esi
+ffi_closure_raw_SYSV PROC NEAR USES esi FORCEFRAME
;; the ffi_closure ctx is passed in eax by the trampoline.
sub esp, 40
@@ -284,7 +312,7 @@ ffi_closure_raw_SYSV PROC NEAR USES esi
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx ;; user_data
lea edx, [ebp + 8]
-stubraw:
+stubraw::
mov [esp + 8], edx ;; raw_args
lea edx, [ebp - 24]
mov [esp + 4], edx ;; &res
@@ -302,26 +330,35 @@ cr_jumpdata:
dd offset cr_retfloat ;; FFI_TYPE_FLOAT
dd offset cr_retdouble ;; FFI_TYPE_DOUBLE
dd offset cr_retlongdouble ;; FFI_TYPE_LONGDOUBLE
- dd offset cr_retint8 ;; FFI_TYPE_UINT8
- dd offset cr_retint8 ;; FFI_TYPE_SINT8
- dd offset cr_retint16 ;; FFI_TYPE_UINT16
- dd offset cr_retint16 ;; FFI_TYPE_SINT16
+ dd offset cr_retuint8 ;; FFI_TYPE_UINT8
+ dd offset cr_retsint8 ;; FFI_TYPE_SINT8
+ dd offset cr_retuint16 ;; FFI_TYPE_UINT16
+ dd offset cr_retsint16 ;; FFI_TYPE_SINT16
dd offset cr_retint ;; FFI_TYPE_UINT32
dd offset cr_retint ;; FFI_TYPE_SINT32
dd offset cr_retint64 ;; FFI_TYPE_UINT64
dd offset cr_retint64 ;; FFI_TYPE_SINT64
dd offset cr_epilogue ;; FFI_TYPE_STRUCT
dd offset cr_retint ;; FFI_TYPE_POINTER
- dd offset cr_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B
- dd offset cr_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B
+ dd offset cr_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B
+ dd offset cr_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B
dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B
+ dd offset cr_epilogue ;; FFI_TYPE_MS_STRUCT
+
+cr_retuint8:
+ movzx eax, BYTE PTR [ecx]
+ jmp cr_epilogue
+
+cr_retsint8:
+ movsx eax, BYTE PTR [ecx]
+ jmp cr_epilogue
-cr_retint8:
- mov al, [ecx]
+cr_retuint16:
+ movzx eax, WORD PTR [ecx]
jmp cr_epilogue
-cr_retint16:
- mov ax, [ecx]
+cr_retsint16:
+ movsx eax, WORD PTR [ecx]
jmp cr_epilogue
cr_retint:
@@ -375,26 +412,34 @@ cd_jumpdata:
dd offset cd_retfloat ;; FFI_TYPE_FLOAT
dd offset cd_retdouble ;; FFI_TYPE_DOUBLE
dd offset cd_retlongdouble ;; FFI_TYPE_LONGDOUBLE
- dd offset cd_retint8 ;; FFI_TYPE_UINT8
- dd offset cd_retint8 ;; FFI_TYPE_SINT8
- dd offset cd_retint16 ;; FFI_TYPE_UINT16
- dd offset cd_retint16 ;; FFI_TYPE_SINT16
+ dd offset cd_retuint8 ;; FFI_TYPE_UINT8
+ dd offset cd_retsint8 ;; FFI_TYPE_SINT8
+ dd offset cd_retuint16 ;; FFI_TYPE_UINT16
+ dd offset cd_retsint16 ;; FFI_TYPE_SINT16
dd offset cd_retint ;; FFI_TYPE_UINT32
dd offset cd_retint ;; FFI_TYPE_SINT32
dd offset cd_retint64 ;; FFI_TYPE_UINT64
dd offset cd_retint64 ;; FFI_TYPE_SINT64
dd offset cd_epilogue ;; FFI_TYPE_STRUCT
dd offset cd_retint ;; FFI_TYPE_POINTER
- dd offset cd_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B
- dd offset cd_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B
+ dd offset cd_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B
+ dd offset cd_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B
dd offset cd_retint ;; FFI_TYPE_SMALL_STRUCT_4B
-cd_retint8:
- mov al, [ecx]
+cd_retuint8:
+ movzx eax, BYTE PTR [ecx]
+ jmp cd_epilogue
+
+cd_retsint8:
+ movsx eax, BYTE PTR [ecx]
jmp cd_epilogue
-cd_retint16:
- mov ax, [ecx]
+cd_retuint16:
+ movzx eax, WORD PTR [ecx]
+ jmp cd_epilogue
+
+cd_retsint16:
+ movsx eax, WORD PTR [ecx]
jmp cd_epilogue
cd_retint:
@@ -515,6 +560,7 @@ _ffi_call_win32:
.long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */
.long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */
.long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */
+ .long .Lretstruct /* FFI_TYPE_MS_STRUCT */
1:
add %ecx, %ecx
add %ecx, %ecx
@@ -657,6 +703,7 @@ _ffi_closure_SYSV:
.long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */
.long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */
.long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */
+ .long .Lcls_retmsstruct /* FFI_TYPE_MS_STRUCT */
1:
add %eax, %eax
@@ -721,6 +768,12 @@ _ffi_closure_SYSV:
popl %ebp
ret $0x4
+.Lcls_retmsstruct:
+ # Caller expects us to return a pointer to the real return value.
+ mov %ecx, %eax
+ # Caller doesn't expects us to pop struct return value pointer hidden arg.
+ jmp .Lcls_epilogue
+
.Lcls_noretval:
.Lcls_epilogue:
movl %ebp, %esp
@@ -798,6 +851,7 @@ _ffi_closure_raw_SYSV:
.long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */
.long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */
.long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */
+ .long .Lrcls_retstruct /* FFI_TYPE_MS_STRUCT */
1:
add %eax, %eax
add %eax, %eax
diff --git a/libffi/testsuite/Makefile.am b/libffi/testsuite/Makefile.am
index f94ca00bc62..146fdf9ed4a 100644
--- a/libffi/testsuite/Makefile.am
+++ b/libffi/testsuite/Makefile.am
@@ -14,3 +14,72 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
AM_RUNTESTFLAGS =
CLEANFILES = *.exe core* *.log *.sum
+
+EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
+libffi.call/cls_align_longdouble_split.c libffi.call/closure_loc_fn0.c \
+libffi.call/cls_schar.c libffi.call/closure_fn1.c \
+libffi.call/many2_win32.c libffi.call/return_ul.c \
+libffi.call/cls_align_double.c libffi.call/return_fl2.c \
+libffi.call/cls_1_1byte.c libffi.call/cls_64byte.c \
+libffi.call/nested_struct7.c libffi.call/cls_align_sint32.c \
+libffi.call/nested_struct2.c libffi.call/ffitest.h \
+libffi.call/nested_struct4.c libffi.call/cls_multi_ushort.c \
+libffi.call/struct3.c libffi.call/cls_3byte1.c \
+libffi.call/cls_16byte.c libffi.call/struct8.c \
+libffi.call/nested_struct8.c libffi.call/cls_multi_sshort.c \
+libffi.call/cls_3byte2.c libffi.call/fastthis2_win32.c \
+libffi.call/cls_pointer.c libffi.call/err_bad_typedef.c \
+libffi.call/cls_4_1byte.c libffi.call/cls_9byte2.c \
+libffi.call/cls_multi_schar.c libffi.call/stret_medium2.c \
+libffi.call/cls_5_1_byte.c libffi.call/call.exp \
+libffi.call/cls_double.c libffi.call/cls_align_sint16.c \
+libffi.call/cls_uint.c libffi.call/return_ll1.c \
+libffi.call/nested_struct3.c libffi.call/cls_20byte1.c \
+libffi.call/closure_fn4.c libffi.call/cls_uchar.c \
+libffi.call/struct2.c libffi.call/cls_7byte.c libffi.call/strlen.c \
+libffi.call/many.c libffi.call/testclosure.c libffi.call/return_fl.c \
+libffi.call/struct5.c libffi.call/cls_12byte.c \
+libffi.call/cls_multi_sshortchar.c \
+libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
+libffi.call/return_fl3.c libffi.call/stret_medium.c \
+libffi.call/nested_struct6.c libffi.call/a.out \
+libffi.call/closure_fn3.c libffi.call/float3.c libffi.call/many2.c \
+libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \
+libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
+libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
+libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
+libffi.call/cls_sshort.c libffi.call/many_win32.c \
+libffi.call/nested_struct.c libffi.call/cls_20byte.c \
+libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
+libffi.call/return_uc.c libffi.call/closure_thiscall.c \
+libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
+libffi.call/promotion.c libffi.call/struct1_win32.c \
+libffi.call/return_dbl.c libffi.call/cls_24byte.c \
+libffi.call/struct4.c libffi.call/cls_6byte.c \
+libffi.call/cls_align_uint32.c libffi.call/float.c \
+libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
+libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
+libffi.call/cls_align_float.c libffi.call/return_fl1.c \
+libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
+libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \
+libffi.call/stret_large2.c libffi.call/return_sl.c \
+libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
+libffi.call/cls_2byte.c libffi.call/float2.c \
+libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
+libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
+libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
+libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
+libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
+libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
+libffi.call/struct1.c libffi.call/nested_struct9.c \
+libffi.call/huge_struct.c libffi.call/problem1.c libffi.call/float4.c \
+libffi.call/fastthis3_win32.c libffi.call/return_ldl.c \
+libffi.call/strlen2_win32.c libffi.call/closure_fn5.c \
+libffi.call/struct2_win32.c libffi.call/struct6.c \
+libffi.call/return_ll.c libffi.call/struct9.c libffi.call/return_sc.c \
+libffi.call/struct7.c libffi.call/cls_align_uint64.c \
+libffi.call/cls_4byte.c libffi.call/strlen_win32.c \
+libffi.call/cls_6_1_byte.c libffi.call/cls_7_1_byte.c \
+libffi.special/unwindtest.cc libffi.special/special.exp \
+libffi.special/unwindtest_ffi_call.cc libffi.special/ffitestcxx.h \
+lib/wrapper.exp lib/target-libpath.exp lib/libffi.exp
diff --git a/libffi/testsuite/Makefile.in b/libffi/testsuite/Makefile.in
index fae969b85ff..b0322dad3c2 100644
--- a/libffi/testsuite/Makefile.in
+++ b/libffi/testsuite/Makefile.in
@@ -37,7 +37,9 @@ target_triplet = @target@
subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/asmcfi.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -84,6 +86,7 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@
FGREP = @FGREP@
GREP = @GREP@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
@@ -195,6 +198,75 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
else echo runtest; fi`
CLEANFILES = *.exe core* *.log *.sum
+EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
+libffi.call/cls_align_longdouble_split.c libffi.call/closure_loc_fn0.c \
+libffi.call/cls_schar.c libffi.call/closure_fn1.c \
+libffi.call/many2_win32.c libffi.call/return_ul.c \
+libffi.call/cls_align_double.c libffi.call/return_fl2.c \
+libffi.call/cls_1_1byte.c libffi.call/cls_64byte.c \
+libffi.call/nested_struct7.c libffi.call/cls_align_sint32.c \
+libffi.call/nested_struct2.c libffi.call/ffitest.h \
+libffi.call/nested_struct4.c libffi.call/cls_multi_ushort.c \
+libffi.call/struct3.c libffi.call/cls_3byte1.c \
+libffi.call/cls_16byte.c libffi.call/struct8.c \
+libffi.call/nested_struct8.c libffi.call/cls_multi_sshort.c \
+libffi.call/cls_3byte2.c libffi.call/fastthis2_win32.c \
+libffi.call/cls_pointer.c libffi.call/err_bad_typedef.c \
+libffi.call/cls_4_1byte.c libffi.call/cls_9byte2.c \
+libffi.call/cls_multi_schar.c libffi.call/stret_medium2.c \
+libffi.call/cls_5_1_byte.c libffi.call/call.exp \
+libffi.call/cls_double.c libffi.call/cls_align_sint16.c \
+libffi.call/cls_uint.c libffi.call/return_ll1.c \
+libffi.call/nested_struct3.c libffi.call/cls_20byte1.c \
+libffi.call/closure_fn4.c libffi.call/cls_uchar.c \
+libffi.call/struct2.c libffi.call/cls_7byte.c libffi.call/strlen.c \
+libffi.call/many.c libffi.call/testclosure.c libffi.call/return_fl.c \
+libffi.call/struct5.c libffi.call/cls_12byte.c \
+libffi.call/cls_multi_sshortchar.c \
+libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
+libffi.call/return_fl3.c libffi.call/stret_medium.c \
+libffi.call/nested_struct6.c libffi.call/a.out \
+libffi.call/closure_fn3.c libffi.call/float3.c libffi.call/many2.c \
+libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \
+libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
+libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
+libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
+libffi.call/cls_sshort.c libffi.call/many_win32.c \
+libffi.call/nested_struct.c libffi.call/cls_20byte.c \
+libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
+libffi.call/return_uc.c libffi.call/closure_thiscall.c \
+libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
+libffi.call/promotion.c libffi.call/struct1_win32.c \
+libffi.call/return_dbl.c libffi.call/cls_24byte.c \
+libffi.call/struct4.c libffi.call/cls_6byte.c \
+libffi.call/cls_align_uint32.c libffi.call/float.c \
+libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
+libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
+libffi.call/cls_align_float.c libffi.call/return_fl1.c \
+libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
+libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \
+libffi.call/stret_large2.c libffi.call/return_sl.c \
+libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
+libffi.call/cls_2byte.c libffi.call/float2.c \
+libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
+libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
+libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
+libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
+libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
+libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
+libffi.call/struct1.c libffi.call/nested_struct9.c \
+libffi.call/huge_struct.c libffi.call/problem1.c libffi.call/float4.c \
+libffi.call/fastthis3_win32.c libffi.call/return_ldl.c \
+libffi.call/strlen2_win32.c libffi.call/closure_fn5.c \
+libffi.call/struct2_win32.c libffi.call/struct6.c \
+libffi.call/return_ll.c libffi.call/struct9.c libffi.call/return_sc.c \
+libffi.call/struct7.c libffi.call/cls_align_uint64.c \
+libffi.call/cls_4byte.c libffi.call/strlen_win32.c \
+libffi.call/cls_6_1_byte.c libffi.call/cls_7_1_byte.c \
+libffi.special/unwindtest.cc libffi.special/special.exp \
+libffi.special/unwindtest_ffi_call.cc libffi.special/ffitestcxx.h \
+lib/wrapper.exp lib/target-libpath.exp lib/libffi.exp
+
all: all-am
.SUFFIXES:
diff --git a/libffi/testsuite/lib/libffi.exp b/libffi/testsuite/lib/libffi.exp
index 82d6652c183..3c61baa1dff 100644
--- a/libffi/testsuite/lib/libffi.exp
+++ b/libffi/testsuite/lib/libffi.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2005, 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -209,6 +209,10 @@ proc libffi_target_compile { source dest type options } {
lappend options "libs= -lffi"
+ if { [string match "aarch64*-*-linux*" $target_triplet] } {
+ lappend options "libs= -lpthread"
+ }
+
verbose "options: $options"
return [target_compile $source $dest $type $options]
}
diff --git a/libffi/testsuite/libffi.call/closure_stdcall.c b/libffi/testsuite/libffi.call/closure_stdcall.c
index 6bfcc1fbb5b..1407f024c17 100644
--- a/libffi/testsuite/libffi.call/closure_stdcall.c
+++ b/libffi/testsuite/libffi.call/closure_stdcall.c
@@ -49,9 +49,17 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall,
(void *) 3 /* userdata */, code) == FFI_OK);
+#ifdef _MSC_VER
+ __asm { mov sp_pre, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
+#endif
res = (*(closure_test_type0)code)(0, 1, 2, 3);
+#ifdef _MSC_VER
+ __asm { mov sp_post, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_post));
+#endif
/* { dg-output "0 1 2 3: 9" } */
printf("res: %d\n",res);
diff --git a/libffi/testsuite/libffi.call/closure_thiscall.c b/libffi/testsuite/libffi.call/closure_thiscall.c
index 6c46f353728..0f93649ff75 100644
--- a/libffi/testsuite/libffi.call/closure_thiscall.c
+++ b/libffi/testsuite/libffi.call/closure_thiscall.c
@@ -49,9 +49,17 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_thiscall,
(void *) 3 /* userdata */, code) == FFI_OK);
+#ifdef _MSC_VER
+ __asm { mov sp_pre, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
+#endif
res = (*(closure_test_type0)code)(0, 1, 2, 3);
+#ifdef _MSC_VER
+ __asm { mov sp_post, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_post));
+#endif
/* { dg-output "0 1 2 3: 9" } */
printf("res: %d\n",res);
diff --git a/libffi/testsuite/libffi.call/cls_12byte.c b/libffi/testsuite/libffi.call/cls_12byte.c
index f0a334fa797..ea0825d175a 100644
--- a/libffi/testsuite/libffi.call/cls_12byte.c
+++ b/libffi/testsuite/libffi.call/cls_12byte.c
@@ -49,15 +49,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_12byte h_dbl = { 7, 4, 9 };
+ struct cls_struct_12byte j_dbl = { 1, 5, 3 };
+ struct cls_struct_12byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_12byte h_dbl = { 7, 4, 9 };
- struct cls_struct_12byte j_dbl = { 1, 5, 3 };
- struct cls_struct_12byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_sint;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/libffi/testsuite/libffi.call/cls_16byte.c b/libffi/testsuite/libffi.call/cls_16byte.c
index 9b9292ab056..89a08a2d97b 100644
--- a/libffi/testsuite/libffi.call/cls_16byte.c
+++ b/libffi/testsuite/libffi.call/cls_16byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_16byte h_dbl = { 7, 8.0, 9 };
+ struct cls_struct_16byte j_dbl = { 1, 9.0, 3 };
+ struct cls_struct_16byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_16byte h_dbl = { 7, 8.0, 9 };
- struct cls_struct_16byte j_dbl = { 1, 9.0, 3 };
- struct cls_struct_16byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/libffi/testsuite/libffi.call/cls_18byte.c b/libffi/testsuite/libffi.call/cls_18byte.c
index 40c8c6d96a1..9f75da80aa0 100644
--- a/libffi/testsuite/libffi.call/cls_18byte.c
+++ b/libffi/testsuite/libffi.call/cls_18byte.c
@@ -54,15 +54,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 };
+ struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 };
+ struct cls_struct_18byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 };
- struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 };
- struct cls_struct_18byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_19byte.c b/libffi/testsuite/libffi.call/cls_19byte.c
index aa6424818f7..278794b5b87 100644
--- a/libffi/testsuite/libffi.call/cls_19byte.c
+++ b/libffi/testsuite/libffi.call/cls_19byte.c
@@ -57,15 +57,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 };
+ struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 };
+ struct cls_struct_19byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 };
- struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 };
- struct cls_struct_19byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_1_1byte.c b/libffi/testsuite/libffi.call/cls_1_1byte.c
index b9402d678ad..82492c020e2 100644
--- a/libffi/testsuite/libffi.call/cls_1_1byte.c
+++ b/libffi/testsuite/libffi.call/cls_1_1byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_1_1byte g_dbl = { 12 };
+ struct cls_struct_1_1byte f_dbl = { 178 };
+ struct cls_struct_1_1byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_1_1byte g_dbl = { 12 };
- struct cls_struct_1_1byte f_dbl = { 178 };
- struct cls_struct_1_1byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_20byte.c b/libffi/testsuite/libffi.call/cls_20byte.c
index 80dd7ac931b..3f8bb28ad29 100644
--- a/libffi/testsuite/libffi.call/cls_20byte.c
+++ b/libffi/testsuite/libffi.call/cls_20byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 };
+ struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 };
+ struct cls_struct_20byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 };
- struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 };
- struct cls_struct_20byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/libffi/testsuite/libffi.call/cls_20byte1.c b/libffi/testsuite/libffi.call/cls_20byte1.c
index 50bcbbf831a..65627273c84 100644
--- a/libffi/testsuite/libffi.call/cls_20byte1.c
+++ b/libffi/testsuite/libffi.call/cls_20byte1.c
@@ -52,15 +52,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 };
+ struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 };
+ struct cls_struct_20byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 };
- struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 };
- struct cls_struct_20byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/libffi/testsuite/libffi.call/cls_24byte.c b/libffi/testsuite/libffi.call/cls_24byte.c
index 46a6eb4d31c..1d82f6e4a45 100644
--- a/libffi/testsuite/libffi.call/cls_24byte.c
+++ b/libffi/testsuite/libffi.call/cls_24byte.c
@@ -61,17 +61,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 };
struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 };
struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 };
struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 };
struct cls_struct_24byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/libffi/testsuite/libffi.call/cls_2byte.c b/libffi/testsuite/libffi.call/cls_2byte.c
index 101e130a1fc..81bb0a64a3e 100644
--- a/libffi/testsuite/libffi.call/cls_2byte.c
+++ b/libffi/testsuite/libffi.call/cls_2byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_2byte g_dbl = { 12, 127 };
+ struct cls_struct_2byte f_dbl = { 1, 13 };
+ struct cls_struct_2byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_2byte g_dbl = { 12, 127 };
- struct cls_struct_2byte f_dbl = { 1, 13 };
- struct cls_struct_2byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_3_1byte.c b/libffi/testsuite/libffi.call/cls_3_1byte.c
index fc780c30d6c..b7827466f6e 100644
--- a/libffi/testsuite/libffi.call/cls_3_1byte.c
+++ b/libffi/testsuite/libffi.call/cls_3_1byte.c
@@ -54,15 +54,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_3_1byte g_dbl = { 12, 13, 14 };
+ struct cls_struct_3_1byte f_dbl = { 178, 179, 180 };
+ struct cls_struct_3_1byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_3_1byte g_dbl = { 12, 13, 14 };
- struct cls_struct_3_1byte f_dbl = { 178, 179, 180 };
- struct cls_struct_3_1byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_3byte1.c b/libffi/testsuite/libffi.call/cls_3byte1.c
index 5705ce38798..a02c463af9f 100644
--- a/libffi/testsuite/libffi.call/cls_3byte1.c
+++ b/libffi/testsuite/libffi.call/cls_3byte1.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_3byte g_dbl = { 12, 119 };
+ struct cls_struct_3byte f_dbl = { 1, 15 };
+ struct cls_struct_3byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_3byte g_dbl = { 12, 119 };
- struct cls_struct_3byte f_dbl = { 1, 15 };
- struct cls_struct_3byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_3byte2.c b/libffi/testsuite/libffi.call/cls_3byte2.c
index 01770a0750b..c7251cead60 100644
--- a/libffi/testsuite/libffi.call/cls_3byte2.c
+++ b/libffi/testsuite/libffi.call/cls_3byte2.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_3byte_1 g_dbl = { 15, 125 };
+ struct cls_struct_3byte_1 f_dbl = { 9, 19 };
+ struct cls_struct_3byte_1 res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_3byte_1 g_dbl = { 15, 125 };
- struct cls_struct_3byte_1 f_dbl = { 9, 19 };
- struct cls_struct_3byte_1 res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_4_1byte.c b/libffi/testsuite/libffi.call/cls_4_1byte.c
index f3806d7ba1c..2d6d8b622c3 100644
--- a/libffi/testsuite/libffi.call/cls_4_1byte.c
+++ b/libffi/testsuite/libffi.call/cls_4_1byte.c
@@ -56,15 +56,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 };
+ struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 };
+ struct cls_struct_4_1byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 };
- struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 };
- struct cls_struct_4_1byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_4byte.c b/libffi/testsuite/libffi.call/cls_4byte.c
index a1aba3c09d5..4ac378776b5 100644
--- a/libffi/testsuite/libffi.call/cls_4byte.c
+++ b/libffi/testsuite/libffi.call/cls_4byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_4byte g_dbl = { 127, 120 };
+ struct cls_struct_4byte f_dbl = { 12, 128 };
+ struct cls_struct_4byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_4byte g_dbl = { 127, 120 };
- struct cls_struct_4byte f_dbl = { 12, 128 };
- struct cls_struct_4byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_5_1_byte.c b/libffi/testsuite/libffi.call/cls_5_1_byte.c
index 2ceba3ddb2d..ad9d51c248c 100644
--- a/libffi/testsuite/libffi.call/cls_5_1_byte.c
+++ b/libffi/testsuite/libffi.call/cls_5_1_byte.c
@@ -58,15 +58,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 };
+ struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 };
+ struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 };
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 };
- struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 };
- struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 };
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_5byte.c b/libffi/testsuite/libffi.call/cls_5byte.c
index 61d595c2bf0..4e0c0003c0a 100644
--- a/libffi/testsuite/libffi.call/cls_5byte.c
+++ b/libffi/testsuite/libffi.call/cls_5byte.c
@@ -53,15 +53,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_5byte g_dbl = { 127, 120, 1 };
+ struct cls_struct_5byte f_dbl = { 12, 128, 9 };
+ struct cls_struct_5byte res_dbl = { 0, 0, 0 };
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_5byte g_dbl = { 127, 120, 1 };
- struct cls_struct_5byte f_dbl = { 12, 128, 9 };
- struct cls_struct_5byte res_dbl = { 0, 0, 0 };
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_64byte.c b/libffi/testsuite/libffi.call/cls_64byte.c
index 576ebe0cc2a..a55edc2c7b9 100644
--- a/libffi/testsuite/libffi.call/cls_64byte.c
+++ b/libffi/testsuite/libffi.call/cls_64byte.c
@@ -66,17 +66,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 };
struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 };
struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 };
struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 };
struct cls_struct_64byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/libffi/testsuite/libffi.call/cls_6_1_byte.c b/libffi/testsuite/libffi.call/cls_6_1_byte.c
index 9f2eff68c1f..b4dcdba4728 100644
--- a/libffi/testsuite/libffi.call/cls_6_1_byte.c
+++ b/libffi/testsuite/libffi.call/cls_6_1_byte.c
@@ -60,15 +60,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 };
+ struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 };
+ struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 };
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 };
- struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 };
- struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 };
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_6byte.c b/libffi/testsuite/libffi.call/cls_6byte.c
index 73257b0989b..740678017b3 100644
--- a/libffi/testsuite/libffi.call/cls_6byte.c
+++ b/libffi/testsuite/libffi.call/cls_6byte.c
@@ -56,15 +56,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 };
+ struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 };
+ struct cls_struct_6byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 };
- struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 };
- struct cls_struct_6byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_7_1_byte.c b/libffi/testsuite/libffi.call/cls_7_1_byte.c
index 50d09c9da72..14a7e96f9d6 100644
--- a/libffi/testsuite/libffi.call/cls_7_1_byte.c
+++ b/libffi/testsuite/libffi.call/cls_7_1_byte.c
@@ -62,15 +62,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 };
+ struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 };
+ struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 };
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 };
- struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 };
- struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 };
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_7byte.c b/libffi/testsuite/libffi.call/cls_7byte.c
index f5c00003153..1645cc635f9 100644
--- a/libffi/testsuite/libffi.call/cls_7byte.c
+++ b/libffi/testsuite/libffi.call/cls_7byte.c
@@ -55,15 +55,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 };
+ struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 };
+ struct cls_struct_7byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 };
- struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 };
- struct cls_struct_7byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_8byte.c b/libffi/testsuite/libffi.call/cls_8byte.c
index 4aa99d12e41..f6c1ea570ac 100644
--- a/libffi/testsuite/libffi.call/cls_8byte.c
+++ b/libffi/testsuite/libffi.call/cls_8byte.c
@@ -49,15 +49,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_8byte g_dbl = { 1, 2.0 };
+ struct cls_struct_8byte f_dbl = { 4, 5.0 };
+ struct cls_struct_8byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_8byte g_dbl = { 1, 2.0 };
- struct cls_struct_8byte f_dbl = { 4, 5.0 };
- struct cls_struct_8byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_9byte1.c b/libffi/testsuite/libffi.call/cls_9byte1.c
index cc5e9d6c4e9..0b8572223c9 100644
--- a/libffi/testsuite/libffi.call/cls_9byte1.c
+++ b/libffi/testsuite/libffi.call/cls_9byte1.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_9byte h_dbl = { 7, 8.0};
+ struct cls_struct_9byte j_dbl = { 1, 9.0};
+ struct cls_struct_9byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_9byte h_dbl = { 7, 8.0};
- struct cls_struct_9byte j_dbl = { 1, 9.0};
- struct cls_struct_9byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_9byte2.c b/libffi/testsuite/libffi.call/cls_9byte2.c
index 5c0ba0d4b8d..edf991de73e 100644
--- a/libffi/testsuite/libffi.call/cls_9byte2.c
+++ b/libffi/testsuite/libffi.call/cls_9byte2.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_9byte h_dbl = { 7.0, 8};
+ struct cls_struct_9byte j_dbl = { 1.0, 9};
+ struct cls_struct_9byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_9byte h_dbl = { 7.0, 8};
- struct cls_struct_9byte j_dbl = { 1.0, 9};
- struct cls_struct_9byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_sint;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_align_double.c b/libffi/testsuite/libffi.call/cls_align_double.c
index 22b94d5a09d..aad5f3ced6a 100644
--- a/libffi/testsuite/libffi.call/cls_align_double.c
+++ b/libffi/testsuite/libffi.call/cls_align_double.c
@@ -52,15 +52,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_float.c b/libffi/testsuite/libffi.call/cls_align_float.c
index 62637f21d18..37e085529e7 100644
--- a/libffi/testsuite/libffi.call/cls_align_float.c
+++ b/libffi/testsuite/libffi.call/cls_align_float.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_longdouble.c b/libffi/testsuite/libffi.call/cls_align_longdouble.c
index af380603c99..b3322d86151 100644
--- a/libffi/testsuite/libffi.call/cls_align_longdouble.c
+++ b/libffi/testsuite/libffi.call/cls_align_longdouble.c
@@ -51,15 +51,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_longdouble;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_longdouble_split.c b/libffi/testsuite/libffi.call/cls_align_longdouble_split.c
index a3732bd0f3b..15f93654652 100644
--- a/libffi/testsuite/libffi.call/cls_align_longdouble_split.c
+++ b/libffi/testsuite/libffi.call/cls_align_longdouble_split.c
@@ -87,15 +87,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 };
+ struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 };
- struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_longdouble;
cls_struct_fields[1] = &ffi_type_longdouble;
cls_struct_fields[2] = &ffi_type_longdouble;
diff --git a/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c b/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c
index 63a0f763368..ca1c356cbe7 100644
--- a/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c
+++ b/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c
@@ -67,15 +67,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 };
+ struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 };
- struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_longdouble;
cls_struct_fields[1] = &ffi_type_longdouble;
cls_struct_fields[2] = &ffi_type_longdouble;
diff --git a/libffi/testsuite/libffi.call/cls_align_pointer.c b/libffi/testsuite/libffi.call/cls_align_pointer.c
index cbc4f953ff6..8fbf36a5c11 100644
--- a/libffi/testsuite/libffi.call/cls_align_pointer.c
+++ b/libffi/testsuite/libffi.call/cls_align_pointer.c
@@ -54,15 +54,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, (void *)4951, 127 };
+ struct cls_struct_align f_dbl = { 1, (void *)9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, (void *)4951, 127 };
- struct cls_struct_align f_dbl = { 1, (void *)9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_pointer;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_sint16.c b/libffi/testsuite/libffi.call/cls_align_sint16.c
index 383ea41d5a6..039b8747320 100644
--- a/libffi/testsuite/libffi.call/cls_align_sint16.c
+++ b/libffi/testsuite/libffi.call/cls_align_sint16.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_sshort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_sint32.c b/libffi/testsuite/libffi.call/cls_align_sint32.c
index 705d78cfa84..c96c6d136df 100644
--- a/libffi/testsuite/libffi.call/cls_align_sint32.c
+++ b/libffi/testsuite/libffi.call/cls_align_sint32.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_sint;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_sint64.c b/libffi/testsuite/libffi.call/cls_align_sint64.c
index 31d53aff05a..9aa7bdddff7 100644
--- a/libffi/testsuite/libffi.call/cls_align_sint64.c
+++ b/libffi/testsuite/libffi.call/cls_align_sint64.c
@@ -51,15 +51,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_sint64;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_uint16.c b/libffi/testsuite/libffi.call/cls_align_uint16.c
index cb6b74821ea..97620b79d1f 100644
--- a/libffi/testsuite/libffi.call/cls_align_uint16.c
+++ b/libffi/testsuite/libffi.call/cls_align_uint16.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_uint32.c b/libffi/testsuite/libffi.call/cls_align_uint32.c
index e453d3e5d9e..5766fadf0dc 100644
--- a/libffi/testsuite/libffi.call/cls_align_uint32.c
+++ b/libffi/testsuite/libffi.call/cls_align_uint32.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uint;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_align_uint64.c b/libffi/testsuite/libffi.call/cls_align_uint64.c
index 495c79f4ea7..a52cb8939c4 100644
--- a/libffi/testsuite/libffi.call/cls_align_uint64.c
+++ b/libffi/testsuite/libffi.call/cls_align_uint64.c
@@ -52,15 +52,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uint64;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/libffi/testsuite/libffi.call/cls_dbls_struct.c b/libffi/testsuite/libffi.call/cls_dbls_struct.c
index 660dabb883b..d6637911e58 100644
--- a/libffi/testsuite/libffi.call/cls_dbls_struct.c
+++ b/libffi/testsuite/libffi.call/cls_dbls_struct.c
@@ -37,6 +37,8 @@ int main(int argc __UNUSED__, char** argv __UNUSED__)
ffi_type ts1_type;
ffi_type* ts1_type_elements[4];
+ Dbls arg = { 1.0, 2.0 };
+
ts1_type.size = 0;
ts1_type.alignment = 0;
ts1_type.type = FFI_TYPE_STRUCT;
@@ -48,8 +50,6 @@ int main(int argc __UNUSED__, char** argv __UNUSED__)
cl_arg_types[0] = &ts1_type;
- Dbls arg = { 1.0, 2.0 };
-
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_void, cl_arg_types) == FFI_OK);
diff --git a/libffi/testsuite/libffi.call/cls_double_va.c b/libffi/testsuite/libffi.call/cls_double_va.c
index 67e44a4ed3d..dbf20002dfc 100644
--- a/libffi/testsuite/libffi.call/cls_double_va.c
+++ b/libffi/testsuite/libffi.call/cls_double_va.c
@@ -7,7 +7,6 @@
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-output "" { xfail avr32*-*-* } } */
/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */
-/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */
#include "ffitest.h"
diff --git a/libffi/testsuite/libffi.call/cls_longdouble_va.c b/libffi/testsuite/libffi.call/cls_longdouble_va.c
index 6b8484a8595..4fa1ea28ace 100644
--- a/libffi/testsuite/libffi.call/cls_longdouble_va.c
+++ b/libffi/testsuite/libffi.call/cls_longdouble_va.c
@@ -7,7 +7,6 @@
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */
/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */
-/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */
#include "ffitest.h"
diff --git a/libffi/testsuite/libffi.call/cls_pointer_stack.c b/libffi/testsuite/libffi.call/cls_pointer_stack.c
index d631cf848ee..e31139e428f 100644
--- a/libffi/testsuite/libffi.call/cls_pointer_stack.c
+++ b/libffi/testsuite/libffi.call/cls_pointer_stack.c
@@ -28,11 +28,12 @@ void* cls_pointer_fn2(void* a1, void* a2)
char trample6 = trample4 + ((char*)&a2)[1];
long double trample7 = (intptr_t)trample5 + (intptr_t)trample1;
char trample8 = trample6 + trample2;
+ void* result;
dummyVar = dummy_func(trample1, trample2, trample3, trample4,
trample5, trample6, trample7, trample8);
- void* result = (void*)((intptr_t)a1 + (intptr_t)a2);
+ result = (void*)((intptr_t)a1 + (intptr_t)a2);
printf("0x%08x 0x%08x: 0x%08x\n",
(unsigned int)(uintptr_t) a1,
@@ -52,11 +53,12 @@ void* cls_pointer_fn1(void* a1, void* a2)
char trample6 = trample4 + ((char*)&a2)[1];
long double trample7 = (intptr_t)trample5 + (intptr_t)trample1;
char trample8 = trample6 + trample2;
+ void* result;
dummyVar = dummy_func(trample1, trample2, trample3, trample4,
trample5, trample6, trample7, trample8);
- void* result = (void*)((intptr_t)a1 + (intptr_t)a2);
+ result = (void*)((intptr_t)a1 + (intptr_t)a2);
printf("0x%08x 0x%08x: 0x%08x\n",
(unsigned int)(intptr_t) a1,
diff --git a/libffi/testsuite/libffi.call/cls_struct_va1.c b/libffi/testsuite/libffi.call/cls_struct_va1.c
new file mode 100644
index 00000000000..91772bd4068
--- /dev/null
+++ b/libffi/testsuite/libffi.call/cls_struct_va1.c
@@ -0,0 +1,114 @@
+/* Area: ffi_call, closure_call
+ Purpose: Test doubles passed in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: Blake Chaffin 6/6/2007 */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+#include "ffitest.h"
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static void
+test_fn (ffi_cif* cif __UNUSED__, void* resp,
+ void** args, void* userdata __UNUSED__)
+{
+ int n = *(int*)args[0];
+ struct small_tag s1 = * (struct small_tag *) args[1];
+ struct large_tag l1 = * (struct large_tag *) args[2];
+ struct small_tag s2 = * (struct small_tag *) args[3];
+
+ printf ("%d %d %d %d %d %d %d %d %d %d\n", n, s1.a, s1.b,
+ l1.a, l1.b, l1.c, l1.d, l1.e,
+ s2.a, s2.b);
+ * (int*) resp = 42;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc (sizeof (ffi_closure), &code);
+ ffi_type* arg_types[5];
+
+ ffi_arg res = 0;
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int si;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint,
+ arg_types) == FFI_OK);
+
+ si = 4;
+ s1.a = 5;
+ s1.b = 6;
+
+ s2.a = 20;
+ s2.b = 21;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK);
+
+ res = ((int (*)(int, ...))(code))(si, s1, l1, s2);
+ // { dg-output "4 5 6 10 11 12 13 14 20 21" }
+ printf("res: %d\n", (int) res);
+ // { dg-output "\nres: 42" }
+
+ exit(0);
+}
diff --git a/libffi/testsuite/libffi.call/cls_uchar_va.c b/libffi/testsuite/libffi.call/cls_uchar_va.c
new file mode 100644
index 00000000000..19cd4f375e6
--- /dev/null
+++ b/libffi/testsuite/libffi.call/cls_uchar_va.c
@@ -0,0 +1,44 @@
+/* Area: closure_call
+ Purpose: Test anonymous unsigned char argument.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef unsigned char T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+ void* userdata __UNUSED__)
+ {
+ *(T *)resp = *(T *)args[0];
+
+ printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+ ffi_type * cl_arg_types[3];
+ T res;
+
+ cl_arg_types[0] = &ffi_type_uchar;
+ cl_arg_types[1] = &ffi_type_uchar;
+ cl_arg_types[2] = NULL;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+ &ffi_type_uchar, cl_arg_types) == FFI_OK);
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_T)code)(67, 4)));
+ /* { dg-output "67: 67 4" } */
+ printf("res: %d\n", res);
+ /* { dg-output "\nres: 67" } */
+ exit(0);
+}
diff --git a/libffi/testsuite/libffi.call/cls_uint_va.c b/libffi/testsuite/libffi.call/cls_uint_va.c
new file mode 100644
index 00000000000..150fddd515d
--- /dev/null
+++ b/libffi/testsuite/libffi.call/cls_uint_va.c
@@ -0,0 +1,45 @@
+/* Area: closure_call
+ Purpose: Test anonymous unsigned int argument.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+
+#include "ffitest.h"
+
+typedef unsigned int T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+ void* userdata __UNUSED__)
+ {
+ *(T *)resp = *(T *)args[0];
+
+ printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+ ffi_type * cl_arg_types[3];
+ T res;
+
+ cl_arg_types[0] = &ffi_type_uint;
+ cl_arg_types[1] = &ffi_type_uint;
+ cl_arg_types[2] = NULL;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+ &ffi_type_uint, cl_arg_types) == FFI_OK);
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_T)code)(67, 4)));
+ /* { dg-output "67: 67 4" } */
+ printf("res: %d\n", res);
+ /* { dg-output "\nres: 67" } */
+ exit(0);
+}
diff --git a/libffi/testsuite/libffi.call/cls_ulong_va.c b/libffi/testsuite/libffi.call/cls_ulong_va.c
new file mode 100644
index 00000000000..0315082e093
--- /dev/null
+++ b/libffi/testsuite/libffi.call/cls_ulong_va.c
@@ -0,0 +1,45 @@
+/* Area: closure_call
+ Purpose: Test anonymous unsigned long argument.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+
+#include "ffitest.h"
+
+typedef unsigned long T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+ void* userdata __UNUSED__)
+ {
+ *(T *)resp = *(T *)args[0];
+
+ printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+ ffi_type * cl_arg_types[3];
+ T res;
+
+ cl_arg_types[0] = &ffi_type_ulong;
+ cl_arg_types[1] = &ffi_type_ulong;
+ cl_arg_types[2] = NULL;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+ &ffi_type_ulong, cl_arg_types) == FFI_OK);
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_T)code)(67, 4)));
+ /* { dg-output "67: 67 4" } */
+ printf("res: %ld\n", res);
+ /* { dg-output "\nres: 67" } */
+ exit(0);
+}
diff --git a/libffi/testsuite/libffi.call/cls_ushort_va.c b/libffi/testsuite/libffi.call/cls_ushort_va.c
new file mode 100644
index 00000000000..b2b5a3b4627
--- /dev/null
+++ b/libffi/testsuite/libffi.call/cls_ushort_va.c
@@ -0,0 +1,44 @@
+/* Area: closure_call
+ Purpose: Test anonymous unsigned short argument.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef unsigned short T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+ void* userdata __UNUSED__)
+ {
+ *(T *)resp = *(T *)args[0];
+
+ printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+ ffi_type * cl_arg_types[3];
+ T res;
+
+ cl_arg_types[0] = &ffi_type_ushort;
+ cl_arg_types[1] = &ffi_type_ushort;
+ cl_arg_types[2] = NULL;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+ &ffi_type_ushort, cl_arg_types) == FFI_OK);
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_T)code)(67, 4)));
+ /* { dg-output "67: 67 4" } */
+ printf("res: %d\n", res);
+ /* { dg-output "\nres: 67" } */
+ exit(0);
+}
diff --git a/libffi/testsuite/libffi.call/err_bad_typedef.c b/libffi/testsuite/libffi.call/err_bad_typedef.c
index 253927392d3..bf601618617 100644
--- a/libffi/testsuite/libffi.call/err_bad_typedef.c
+++ b/libffi/testsuite/libffi.call/err_bad_typedef.c
@@ -13,10 +13,10 @@ int main (void)
ffi_cif cif;
ffi_type* arg_types[1];
- arg_types[0] = NULL;
-
ffi_type badType = ffi_type_void;
+ arg_types[0] = NULL;
+
badType.size = 0;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType,
diff --git a/libffi/testsuite/libffi.call/fastthis1_win32.c b/libffi/testsuite/libffi.call/fastthis1_win32.c
index b3c4c733b62..cbc4724ef8c 100644
--- a/libffi/testsuite/libffi.call/fastthis1_win32.c
+++ b/libffi/testsuite/libffi.call/fastthis1_win32.c
@@ -8,7 +8,7 @@
#include "ffitest.h"
-static size_t __attribute__((fastcall)) my_fastcall_f(char *s, float a)
+static size_t __FASTCALL__ my_fastcall_f(char *s, float a)
{
return (size_t) ((int) strlen(s) + (int) a);
}
diff --git a/libffi/testsuite/libffi.call/fastthis2_win32.c b/libffi/testsuite/libffi.call/fastthis2_win32.c
index f148a12fa66..7bdd0e17584 100644
--- a/libffi/testsuite/libffi.call/fastthis2_win32.c
+++ b/libffi/testsuite/libffi.call/fastthis2_win32.c
@@ -8,7 +8,7 @@
#include "ffitest.h"
-static size_t __attribute__((fastcall)) my_fastcall_f(float a, char *s)
+static size_t __FASTCALL__ my_fastcall_f(float a, char *s)
{
return (size_t) ((int) strlen(s) + (int) a);
}
diff --git a/libffi/testsuite/libffi.call/fastthis3_win32.c b/libffi/testsuite/libffi.call/fastthis3_win32.c
index 5cf82bbfa99..b5d606d9a15 100644
--- a/libffi/testsuite/libffi.call/fastthis3_win32.c
+++ b/libffi/testsuite/libffi.call/fastthis3_win32.c
@@ -8,7 +8,7 @@
#include "ffitest.h"
-static size_t __attribute__((fastcall)) my_fastcall_f(float a, char *s, int i)
+static size_t __FASTCALL__ my_fastcall_f(float a, char *s, int i)
{
return (size_t) ((int) strlen(s) + (int) a + i);
}
diff --git a/libffi/testsuite/libffi.call/ffitest.h b/libffi/testsuite/libffi.call/ffitest.h
index 0e95e164f6e..d81d4dabade 100644
--- a/libffi/testsuite/libffi.call/ffitest.h
+++ b/libffi/testsuite/libffi.call/ffitest.h
@@ -25,6 +25,14 @@
#define __UNUSED__
#endif
+/* Define __FASTCALL__ so that other compilers than gcc can run the tests. */
+#undef __FASTCALL__
+#if defined _MSC_VER
+#define __FASTCALL__ __fastcall
+#else
+#define __FASTCALL__ __attribute__((fastcall))
+#endif
+
/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a
file open. */
#ifdef HAVE_MMAP_ANON
@@ -110,6 +118,15 @@
#endif
#endif
+/* MSVC kludge. */
+#if defined _MSC_VER
+#define PRIuPTR "lu"
+#define PRIu8 "u"
+#define PRId8 "d"
+#define PRIu64 "I64u"
+#define PRId64 "I64d"
+#endif
+
#ifdef USING_MMAP
static inline void *
allocate_mmap (size_t size)
diff --git a/libffi/testsuite/libffi.call/float_va.c b/libffi/testsuite/libffi.call/float_va.c
index 2039ae54791..aae158edcc1 100644
--- a/libffi/testsuite/libffi.call/float_va.c
+++ b/libffi/testsuite/libffi.call/float_va.c
@@ -25,18 +25,18 @@ double float_va_fn(unsigned int x, double y,...)
total+=(double)x;
total+=y;
- printf("%u: %.1lf :", x, y);
+ printf("%u: %.1f :", x, y);
va_start(ap, y);
for(i=0;i<x;i++)
{
double arg=va_arg(ap, double);
total+=arg;
- printf(" %d:%.1lf ", i, arg);
+ printf(" %d:%.1f ", i, arg);
}
va_end(ap);
- printf(" total: %.1lf\n", total);
+ printf(" total: %.1f\n", total);
return total;
}
@@ -57,7 +57,7 @@ int main (void)
/* Call it statically and then via ffi */
resfp=float_va_fn(0,2.0);
// { dg-output "0: 2.0 : total: 2.0" }
- printf("compiled: %.1lf\n", resfp);
+ printf("compiled: %.1f\n", resfp);
// { dg-output "\ncompiled: 2.0" }
arg_types[0] = &ffi_type_uint;
@@ -72,14 +72,14 @@ int main (void)
values[1] = &doubles[0];
ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
// { dg-output "\n0: 2.0 : total: 2.0" }
- printf("ffi: %.1lf\n", resfp);
+ printf("ffi: %.1f\n", resfp);
// { dg-output "\nffi: 2.0" }
/* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */
/* Call it statically and then via ffi */
resfp=float_va_fn(2,2.0,3.0,4.0);
// { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" }
- printf("compiled: %.1lf\n", resfp);
+ printf("compiled: %.1f\n", resfp);
// { dg-output "\ncompiled: 11.0" }
arg_types[0] = &ffi_type_uint;
@@ -100,7 +100,7 @@ int main (void)
values[3] = &doubles[2];
ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
// { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" }
- printf("ffi: %.1lf\n", resfp);
+ printf("ffi: %.1f\n", resfp);
// { dg-output "\nffi: 11.0" }
exit(0);
diff --git a/libffi/testsuite/libffi.call/huge_struct.c b/libffi/testsuite/libffi.call/huge_struct.c
index e04e1d58a40..380fedf4858 100644
--- a/libffi/testsuite/libffi.call/huge_struct.c
+++ b/libffi/testsuite/libffi.call/huge_struct.c
@@ -229,6 +229,19 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
ffi_type* st_fields[51];
BigStruct retVal;
+ uint8_t ui8 = 1;
+ int8_t si8 = 2;
+ uint16_t ui16 = 3;
+ int16_t si16 = 4;
+ uint32_t ui32 = 5;
+ int32_t si32 = 6;
+ uint64_t ui64 = 7;
+ int64_t si64 = 8;
+ float f = 9;
+ double d = 10;
+ long double ld = 11;
+ char* p = (char*)0x12345678;
+
memset (&retVal, 0, sizeof(retVal));
ret_struct_type.size = 0;
@@ -251,19 +264,6 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
st_fields[50] = NULL;
- uint8_t ui8 = 1;
- int8_t si8 = 2;
- uint16_t ui16 = 3;
- int16_t si16 = 4;
- uint32_t ui32 = 5;
- int32_t si32 = 6;
- uint64_t ui64 = 7;
- int64_t si64 = 8;
- float f = 9;
- double d = 10;
- long double ld = 11;
- char* p = (char*)0x12345678;
-
argTypes[0] = argTypes[12] = argTypes[24] = argTypes[36] = argTypes[48] = &ffi_type_uint8;
argValues[0] = argValues[12] = argValues[24] = argValues[36] = argValues[48] = &ui8;
argTypes[1] = argTypes[13] = argTypes[25] = argTypes[37] = argTypes[49] = &ffi_type_sint8;
diff --git a/libffi/testsuite/libffi.call/nested_struct.c b/libffi/testsuite/libffi.call/nested_struct.c
index 8aa527ede4e..c15e3a03382 100644
--- a/libffi/testsuite/libffi.call/nested_struct.c
+++ b/libffi/testsuite/libffi.call/nested_struct.c
@@ -77,6 +77,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6};
+ struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0};
+ struct cls_struct_combined g_dbl = {{4.0, 5.0, 6},
+ {3, 1.0, 8.0}};
+ struct cls_struct_combined res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -92,12 +98,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6};
- struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0};
- struct cls_struct_combined g_dbl = {{4.0, 5.0, 6},
- {3, 1.0, 8.0}};
- struct cls_struct_combined res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/libffi/testsuite/libffi.call/nested_struct1.c b/libffi/testsuite/libffi.call/nested_struct1.c
index 2a9f515cded..1087f7b1cfd 100644
--- a/libffi/testsuite/libffi.call/nested_struct1.c
+++ b/libffi/testsuite/libffi.call/nested_struct1.c
@@ -81,6 +81,13 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6};
+ struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0};
+ struct cls_struct_combined g_dbl = {{4.0, 5.0, 6},
+ {3, 1.0, 8.0}};
+ struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4};
+ struct cls_struct_combined res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -96,13 +103,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6};
- struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0};
- struct cls_struct_combined g_dbl = {{4.0, 5.0, 6},
- {3, 1.0, 8.0}};
- struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4};
- struct cls_struct_combined res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/libffi/testsuite/libffi.call/nested_struct10.c b/libffi/testsuite/libffi.call/nested_struct10.c
index d6a718bdd01..34a74e71874 100644
--- a/libffi/testsuite/libffi.call/nested_struct10.c
+++ b/libffi/testsuite/libffi.call/nested_struct10.c
@@ -67,6 +67,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
+ struct A e_dbl = { 1LL, 7};
+ struct B f_dbl = { 99, {12LL , 127}, 255};
+ struct C g_dbl = { 2LL, 9};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -82,12 +88,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct A e_dbl = { 1LL, 7};
- struct B f_dbl = { 99, {12LL , 127}, 255};
- struct C g_dbl = { 2LL, 9};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct11.c b/libffi/testsuite/libffi.call/nested_struct11.c
new file mode 100644
index 00000000000..fce69481888
--- /dev/null
+++ b/libffi/testsuite/libffi.call/nested_struct11.c
@@ -0,0 +1,121 @@
+/* Area: ffi_call, closure_call
+ Purpose: Check parameter passing with nested structs
+ of a single type. This tests the special cases
+ for homogenous floating-point aggregates in the
+ AArch64 PCS.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef struct A {
+ float a_x;
+ float a_y;
+} A;
+
+typedef struct B {
+ float b_x;
+ float b_y;
+} B;
+
+typedef struct C {
+ A a;
+ B b;
+} C;
+
+static C C_fn (int x, int y, int z, C source, int i, int j, int k)
+{
+ C result;
+ result.a.a_x = source.a.a_x;
+ result.a.a_y = source.a.a_y;
+ result.b.b_x = source.b.b_x;
+ result.b.b_y = source.b.b_y;
+
+ printf ("%d, %d, %d, %d, %d, %d\n", x, y, z, i, j, k);
+
+ printf ("%.1f, %.1f, %.1f, %.1f, "
+ "%.1f, %.1f, %.1f, %.1f\n",
+ source.a.a_x, source.a.a_y,
+ source.b.b_x, source.b.b_y,
+ result.a.a_x, result.a.a_y,
+ result.b.b_x, result.b.b_y);
+
+ return result;
+}
+
+int main (void)
+{
+ ffi_cif cif;
+
+ ffi_type* struct_fields_source_a[3];
+ ffi_type* struct_fields_source_b[3];
+ ffi_type* struct_fields_source_c[3];
+ ffi_type* arg_types[8];
+
+ ffi_type struct_type_a, struct_type_b, struct_type_c;
+
+ struct A source_fld_a = {1.0, 2.0};
+ struct B source_fld_b = {4.0, 8.0};
+ int k = 1;
+
+ struct C result;
+ struct C source = {source_fld_a, source_fld_b};
+
+ struct_type_a.size = 0;
+ struct_type_a.alignment = 0;
+ struct_type_a.type = FFI_TYPE_STRUCT;
+ struct_type_a.elements = struct_fields_source_a;
+
+ struct_type_b.size = 0;
+ struct_type_b.alignment = 0;
+ struct_type_b.type = FFI_TYPE_STRUCT;
+ struct_type_b.elements = struct_fields_source_b;
+
+ struct_type_c.size = 0;
+ struct_type_c.alignment = 0;
+ struct_type_c.type = FFI_TYPE_STRUCT;
+ struct_type_c.elements = struct_fields_source_c;
+
+ struct_fields_source_a[0] = &ffi_type_float;
+ struct_fields_source_a[1] = &ffi_type_float;
+ struct_fields_source_a[2] = NULL;
+
+ struct_fields_source_b[0] = &ffi_type_float;
+ struct_fields_source_b[1] = &ffi_type_float;
+ struct_fields_source_b[2] = NULL;
+
+ struct_fields_source_c[0] = &struct_type_a;
+ struct_fields_source_c[1] = &struct_type_b;
+ struct_fields_source_c[2] = NULL;
+
+ arg_types[0] = &ffi_type_sint32;
+ arg_types[1] = &ffi_type_sint32;
+ arg_types[2] = &ffi_type_sint32;
+ arg_types[3] = &struct_type_c;
+ arg_types[4] = &ffi_type_sint32;
+ arg_types[5] = &ffi_type_sint32;
+ arg_types[6] = &ffi_type_sint32;
+ arg_types[7] = NULL;
+
+ void *args[7];
+ args[0] = &k;
+ args[1] = &k;
+ args[2] = &k;
+ args[3] = &source;
+ args[4] = &k;
+ args[5] = &k;
+ args[6] = &k;
+ CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 7, &struct_type_c,
+ arg_types) == FFI_OK);
+
+ ffi_call (&cif, FFI_FN (C_fn), &result, args);
+ /* { dg-output "1, 1, 1, 1, 1, 1\n" } */
+ /* { dg-output "1.0, 2.0, 4.0, 8.0, 1.0, 2.0, 4.0, 8.0" } */
+ CHECK (result.a.a_x == source.a.a_x);
+ CHECK (result.a.a_y == source.a.a_y);
+ CHECK (result.b.b_x == source.b.b_x);
+ CHECK (result.b.b_y == source.b.b_y);
+ exit (0);
+}
diff --git a/libffi/testsuite/libffi.call/nested_struct2.c b/libffi/testsuite/libffi.call/nested_struct2.c
index de1584c18a1..69268cdb8af 100644
--- a/libffi/testsuite/libffi.call/nested_struct2.c
+++ b/libffi/testsuite/libffi.call/nested_struct2.c
@@ -57,6 +57,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1, 7};
+ struct B f_dbl = {{12 , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -67,11 +72,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1, 7};
- struct B f_dbl = {{12 , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_ulong;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct3.c b/libffi/testsuite/libffi.call/nested_struct3.c
index 58aa85362e8..ab18cad7335 100644
--- a/libffi/testsuite/libffi.call/nested_struct3.c
+++ b/libffi/testsuite/libffi.call/nested_struct3.c
@@ -58,6 +58,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1LL, 7};
+ struct B f_dbl = {{12LL , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -68,11 +73,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1LL, 7};
- struct B f_dbl = {{12LL , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct4.c b/libffi/testsuite/libffi.call/nested_struct4.c
index 98e491e65cf..2ffb4d65a06 100644
--- a/libffi/testsuite/libffi.call/nested_struct4.c
+++ b/libffi/testsuite/libffi.call/nested_struct4.c
@@ -58,6 +58,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1.0, 7};
+ struct B f_dbl = {{12.0 , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -68,11 +73,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1.0, 7};
- struct B f_dbl = {{12.0 , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct5.c b/libffi/testsuite/libffi.call/nested_struct5.c
index d8e3537d5a0..6c79845d984 100644
--- a/libffi/testsuite/libffi.call/nested_struct5.c
+++ b/libffi/testsuite/libffi.call/nested_struct5.c
@@ -58,6 +58,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1.0, 7};
+ struct B f_dbl = {{12.0 , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -68,11 +73,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1.0, 7};
- struct B f_dbl = {{12.0 , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_longdouble;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct6.c b/libffi/testsuite/libffi.call/nested_struct6.c
index 2f2b25a15db..59d35796f8d 100644
--- a/libffi/testsuite/libffi.call/nested_struct6.c
+++ b/libffi/testsuite/libffi.call/nested_struct6.c
@@ -66,6 +66,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
+ struct A e_dbl = { 1.0, 7};
+ struct B f_dbl = {{12.0 , 127}, 99};
+ struct C g_dbl = { 2, 9};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -81,12 +87,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct A e_dbl = { 1.0, 7};
- struct B f_dbl = {{12.0 , 127}, 99};
- struct C g_dbl = { 2, 9};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct7.c b/libffi/testsuite/libffi.call/nested_struct7.c
index 14c70239eb2..27595e6f5c3 100644
--- a/libffi/testsuite/libffi.call/nested_struct7.c
+++ b/libffi/testsuite/libffi.call/nested_struct7.c
@@ -58,6 +58,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1LL, 7};
+ struct B f_dbl = {{12.0 , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -68,11 +73,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1LL, 7};
- struct B f_dbl = {{12.0 , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct8.c b/libffi/testsuite/libffi.call/nested_struct8.c
index bb77ead8d32..0e6c68281e1 100644
--- a/libffi/testsuite/libffi.call/nested_struct8.c
+++ b/libffi/testsuite/libffi.call/nested_struct8.c
@@ -66,6 +66,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
+ struct A e_dbl = { 1LL, 7};
+ struct B f_dbl = {{12LL , 127}, 99};
+ struct C g_dbl = { 2LL, 9};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -81,12 +87,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct A e_dbl = { 1LL, 7};
- struct B f_dbl = {{12LL , 127}, 99};
- struct C g_dbl = { 2LL, 9};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct9.c b/libffi/testsuite/libffi.call/nested_struct9.c
index e9f541c83a8..5f7ac67752c 100644
--- a/libffi/testsuite/libffi.call/nested_struct9.c
+++ b/libffi/testsuite/libffi.call/nested_struct9.c
@@ -66,6 +66,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
+ struct A e_dbl = { 1, 7LL};
+ struct B f_dbl = {{12.0 , 127}, 99};
+ struct C g_dbl = { 2, 9};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -81,12 +87,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct A e_dbl = { 1, 7LL};
- struct B f_dbl = {{12.0 , 127}, 99};
- struct C g_dbl = { 2, 9};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uint64;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/stret_large.c b/libffi/testsuite/libffi.call/stret_large.c
index 23a93b900d9..f32938c009c 100644
--- a/libffi/testsuite/libffi.call/stret_large.c
+++ b/libffi/testsuite/libffi.call/stret_large.c
@@ -82,17 +82,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 };
struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 };
struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 };
struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 };
struct_108byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/libffi/testsuite/libffi.call/stret_large2.c b/libffi/testsuite/libffi.call/stret_large2.c
index e2599d26737..3b0ef9ac4a0 100644
--- a/libffi/testsuite/libffi.call/stret_large2.c
+++ b/libffi/testsuite/libffi.call/stret_large2.c
@@ -84,17 +84,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 };
struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 };
struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 };
struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 };
struct_116byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/libffi/testsuite/libffi.call/stret_medium.c b/libffi/testsuite/libffi.call/stret_medium.c
index 1fc6a9edd33..973ee02ede8 100644
--- a/libffi/testsuite/libffi.call/stret_medium.c
+++ b/libffi/testsuite/libffi.call/stret_medium.c
@@ -68,17 +68,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 };
struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 };
struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 };
struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 };
struct_72byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/libffi/testsuite/libffi.call/stret_medium2.c b/libffi/testsuite/libffi.call/stret_medium2.c
index cb2f2fba331..84323d16a91 100644
--- a/libffi/testsuite/libffi.call/stret_medium2.c
+++ b/libffi/testsuite/libffi.call/stret_medium2.c
@@ -69,17 +69,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 };
struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 };
struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 };
struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 };
struct_72byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/libffi/testsuite/libffi.call/strlen2_win32.c b/libffi/testsuite/libffi.call/strlen2_win32.c
index b348e434097..0d81061e758 100644
--- a/libffi/testsuite/libffi.call/strlen2_win32.c
+++ b/libffi/testsuite/libffi.call/strlen2_win32.c
@@ -8,12 +8,11 @@
#include "ffitest.h"
-static size_t __attribute__((fastcall)) my_fastcall_strlen(char *s)
+static size_t __FASTCALL__ my_fastcall_strlen(char *s)
{
return (strlen(s));
}
-int d
int main (void)
{
ffi_cif cif;
diff --git a/libffi/testsuite/libffi.call/struct1.c b/libffi/testsuite/libffi.call/struct1.c
index ea76c854490..bfc23f642cc 100644
--- a/libffi/testsuite/libffi.call/struct1.c
+++ b/libffi/testsuite/libffi.call/struct1.c
@@ -30,6 +30,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts1_type;
ffi_type *ts1_type_elements[4];
+
+ test_structure_1 ts1_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_1 *ts1_result =
+ (test_structure_1 *) malloc (sizeof(test_structure_1));
+
ts1_type.size = 0;
ts1_type.alignment = 0;
ts1_type.type = FFI_TYPE_STRUCT;
@@ -39,11 +46,6 @@ int main (void)
ts1_type_elements[2] = &ffi_type_uint;
ts1_type_elements[3] = NULL;
- test_structure_1 ts1_arg;
- /* This is a hack to get a properly aligned result buffer */
- test_structure_1 *ts1_result =
- (test_structure_1 *) malloc (sizeof(test_structure_1));
-
args[0] = &ts1_type;
values[0] = &ts1_arg;
diff --git a/libffi/testsuite/libffi.call/struct1_win32.c b/libffi/testsuite/libffi.call/struct1_win32.c
index 4a7eb9444bd..b756f5ad8b5 100644
--- a/libffi/testsuite/libffi.call/struct1_win32.c
+++ b/libffi/testsuite/libffi.call/struct1_win32.c
@@ -14,7 +14,7 @@ typedef struct
unsigned int ui;
} test_structure_1;
-static __attribute__ ((fastcall)) test_structure_1 struct1(test_structure_1 ts)
+static test_structure_1 __FASTCALL__ struct1(test_structure_1 ts)
{
ts.uc++;
ts.d--;
@@ -30,6 +30,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts1_type;
ffi_type *ts1_type_elements[4];
+
+ test_structure_1 ts1_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_1 *ts1_result =
+ (test_structure_1 *) malloc (sizeof(test_structure_1));
+
ts1_type.size = 0;
ts1_type.alignment = 0;
ts1_type.type = FFI_TYPE_STRUCT;
@@ -39,11 +46,6 @@ int main (void)
ts1_type_elements[2] = &ffi_type_uint;
ts1_type_elements[3] = NULL;
- test_structure_1 ts1_arg;
- /* This is a hack to get a properly aligned result buffer */
- test_structure_1 *ts1_result =
- (test_structure_1 *) malloc (sizeof(test_structure_1));
-
args[0] = &ts1_type;
values[0] = &ts1_arg;
diff --git a/libffi/testsuite/libffi.call/struct2.c b/libffi/testsuite/libffi.call/struct2.c
index 14bc9fdc6f2..d85385e7d3f 100644
--- a/libffi/testsuite/libffi.call/struct2.c
+++ b/libffi/testsuite/libffi.call/struct2.c
@@ -29,6 +29,11 @@ int main (void)
test_structure_2 ts2_arg;
ffi_type ts2_type;
ffi_type *ts2_type_elements[3];
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_2 *ts2_result =
+ (test_structure_2 *) malloc (sizeof(test_structure_2));
+
ts2_type.size = 0;
ts2_type.alignment = 0;
ts2_type.type = FFI_TYPE_STRUCT;
@@ -37,11 +42,6 @@ int main (void)
ts2_type_elements[1] = &ffi_type_double;
ts2_type_elements[2] = NULL;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_2 *ts2_result =
- (test_structure_2 *) malloc (sizeof(test_structure_2));
-
args[0] = &ts2_type;
values[0] = &ts2_arg;
diff --git a/libffi/testsuite/libffi.call/struct2_win32.c b/libffi/testsuite/libffi.call/struct2_win32.c
index 2bfbdc5ff81..5d022855c57 100644
--- a/libffi/testsuite/libffi.call/struct2_win32.c
+++ b/libffi/testsuite/libffi.call/struct2_win32.c
@@ -13,7 +13,7 @@ typedef struct
double d2;
} test_structure_2;
-static test_structure_2 __attribute__ ((fastcall)) struct2(test_structure_2 ts)
+static test_structure_2 __FASTCALL__ struct2(test_structure_2 ts)
{
ts.d1--;
ts.d2--;
@@ -29,6 +29,11 @@ int main (void)
test_structure_2 ts2_arg;
ffi_type ts2_type;
ffi_type *ts2_type_elements[3];
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_2 *ts2_result =
+ (test_structure_2 *) malloc (sizeof(test_structure_2));
+
ts2_type.size = 0;
ts2_type.alignment = 0;
ts2_type.type = FFI_TYPE_STRUCT;
@@ -37,11 +42,6 @@ int main (void)
ts2_type_elements[1] = &ffi_type_double;
ts2_type_elements[2] = NULL;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_2 *ts2_result =
- (test_structure_2 *) malloc (sizeof(test_structure_2));
-
args[0] = &ts2_type;
values[0] = &ts2_arg;
diff --git a/libffi/testsuite/libffi.call/struct3.c b/libffi/testsuite/libffi.call/struct3.c
index e0bb09b0788..de883c2638e 100644
--- a/libffi/testsuite/libffi.call/struct3.c
+++ b/libffi/testsuite/libffi.call/struct3.c
@@ -27,6 +27,11 @@ int main (void)
int compare_value;
ffi_type ts3_type;
ffi_type *ts3_type_elements[2];
+
+ test_structure_3 ts3_arg;
+ test_structure_3 *ts3_result =
+ (test_structure_3 *) malloc (sizeof(test_structure_3));
+
ts3_type.size = 0;
ts3_type.alignment = 0;
ts3_type.type = FFI_TYPE_STRUCT;
@@ -34,10 +39,6 @@ int main (void)
ts3_type_elements[0] = &ffi_type_sint;
ts3_type_elements[1] = NULL;
- test_structure_3 ts3_arg;
- test_structure_3 *ts3_result =
- (test_structure_3 *) malloc (sizeof(test_structure_3));
-
args[0] = &ts3_type;
values[0] = &ts3_arg;
diff --git a/libffi/testsuite/libffi.call/struct4.c b/libffi/testsuite/libffi.call/struct4.c
index 0ad0a83ba12..48e03495441 100644
--- a/libffi/testsuite/libffi.call/struct4.c
+++ b/libffi/testsuite/libffi.call/struct4.c
@@ -28,21 +28,22 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts4_type;
ffi_type *ts4_type_elements[4];
+
+ test_structure_4 ts4_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_4 *ts4_result =
+ (test_structure_4 *) malloc (sizeof(test_structure_4));
+
ts4_type.size = 0;
ts4_type.alignment = 0;
ts4_type.type = FFI_TYPE_STRUCT;
- test_structure_4 ts4_arg;
ts4_type.elements = ts4_type_elements;
ts4_type_elements[0] = &ffi_type_uint;
ts4_type_elements[1] = &ffi_type_uint;
ts4_type_elements[2] = &ffi_type_uint;
ts4_type_elements[3] = NULL;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_4 *ts4_result =
- (test_structure_4 *) malloc (sizeof(test_structure_4));
-
args[0] = &ts4_type;
values[0] = &ts4_arg;
diff --git a/libffi/testsuite/libffi.call/struct5.c b/libffi/testsuite/libffi.call/struct5.c
index c03cc97ac99..28b1f0c4265 100644
--- a/libffi/testsuite/libffi.call/struct5.c
+++ b/libffi/testsuite/libffi.call/struct5.c
@@ -27,6 +27,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts5_type;
ffi_type *ts5_type_elements[3];
+
+ test_structure_5 ts5_arg1, ts5_arg2;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_5 *ts5_result =
+ (test_structure_5 *) malloc (sizeof(test_structure_5));
+
ts5_type.size = 0;
ts5_type.alignment = 0;
ts5_type.type = FFI_TYPE_STRUCT;
@@ -35,12 +42,6 @@ int main (void)
ts5_type_elements[1] = &ffi_type_schar;
ts5_type_elements[2] = NULL;
- test_structure_5 ts5_arg1, ts5_arg2;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_5 *ts5_result =
- (test_structure_5 *) malloc (sizeof(test_structure_5));
-
args[0] = &ts5_type;
args[1] = &ts5_type;
values[0] = &ts5_arg1;
diff --git a/libffi/testsuite/libffi.call/struct6.c b/libffi/testsuite/libffi.call/struct6.c
index 83db9afbbee..0e267467a7b 100644
--- a/libffi/testsuite/libffi.call/struct6.c
+++ b/libffi/testsuite/libffi.call/struct6.c
@@ -27,6 +27,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts6_type;
ffi_type *ts6_type_elements[3];
+
+ test_structure_6 ts6_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_6 *ts6_result =
+ (test_structure_6 *) malloc (sizeof(test_structure_6));
+
ts6_type.size = 0;
ts6_type.alignment = 0;
ts6_type.type = FFI_TYPE_STRUCT;
@@ -35,13 +42,6 @@ int main (void)
ts6_type_elements[1] = &ffi_type_double;
ts6_type_elements[2] = NULL;
-
- test_structure_6 ts6_arg;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_6 *ts6_result =
- (test_structure_6 *) malloc (sizeof(test_structure_6));
-
args[0] = &ts6_type;
values[0] = &ts6_arg;
diff --git a/libffi/testsuite/libffi.call/struct7.c b/libffi/testsuite/libffi.call/struct7.c
index 58aac4c9922..8f2bbfd949c 100644
--- a/libffi/testsuite/libffi.call/struct7.c
+++ b/libffi/testsuite/libffi.call/struct7.c
@@ -29,6 +29,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts7_type;
ffi_type *ts7_type_elements[4];
+
+ test_structure_7 ts7_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_7 *ts7_result =
+ (test_structure_7 *) malloc (sizeof(test_structure_7));
+
ts7_type.size = 0;
ts7_type.alignment = 0;
ts7_type.type = FFI_TYPE_STRUCT;
@@ -38,13 +45,6 @@ int main (void)
ts7_type_elements[2] = &ffi_type_double;
ts7_type_elements[3] = NULL;
-
- test_structure_7 ts7_arg;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_7 *ts7_result =
- (test_structure_7 *) malloc (sizeof(test_structure_7));
-
args[0] = &ts7_type;
values[0] = &ts7_arg;
diff --git a/libffi/testsuite/libffi.call/struct8.c b/libffi/testsuite/libffi.call/struct8.c
index c773ac7b5ac..266e1f0ad60 100644
--- a/libffi/testsuite/libffi.call/struct8.c
+++ b/libffi/testsuite/libffi.call/struct8.c
@@ -31,6 +31,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts8_type;
ffi_type *ts8_type_elements[5];
+
+ test_structure_8 ts8_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_8 *ts8_result =
+ (test_structure_8 *) malloc (sizeof(test_structure_8));
+
ts8_type.size = 0;
ts8_type.alignment = 0;
ts8_type.type = FFI_TYPE_STRUCT;
@@ -41,12 +48,6 @@ int main (void)
ts8_type_elements[3] = &ffi_type_float;
ts8_type_elements[4] = NULL;
- test_structure_8 ts8_arg;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_8 *ts8_result =
- (test_structure_8 *) malloc (sizeof(test_structure_8));
-
args[0] = &ts8_type;
values[0] = &ts8_arg;
diff --git a/libffi/testsuite/libffi.call/struct9.c b/libffi/testsuite/libffi.call/struct9.c
index f30091f54f1..efeb7161b84 100644
--- a/libffi/testsuite/libffi.call/struct9.c
+++ b/libffi/testsuite/libffi.call/struct9.c
@@ -28,6 +28,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts9_type;
ffi_type *ts9_type_elements[3];
+
+ test_structure_9 ts9_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_9 *ts9_result =
+ (test_structure_9 *) malloc (sizeof(test_structure_9));
+
ts9_type.size = 0;
ts9_type.alignment = 0;
ts9_type.type = FFI_TYPE_STRUCT;
@@ -36,12 +43,6 @@ int main (void)
ts9_type_elements[1] = &ffi_type_sint;
ts9_type_elements[2] = NULL;
- test_structure_9 ts9_arg;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_9 *ts9_result =
- (test_structure_9 *) malloc (sizeof(test_structure_9));
-
args[0] = &ts9_type;
values[0] = &ts9_arg;
diff --git a/libffi/testsuite/libffi.call/testclosure.c b/libffi/testsuite/libffi.call/testclosure.c
index 161cc891798..ca31056d8c8 100644
--- a/libffi/testsuite/libffi.call/testclosure.c
+++ b/libffi/testsuite/libffi.call/testclosure.c
@@ -43,13 +43,13 @@ int main (void)
ffi_type cls_struct_type0;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0};
+
cls_struct_type0.size = 0;
cls_struct_type0.alignment = 0;
cls_struct_type0.type = FFI_TYPE_STRUCT;
cls_struct_type0.elements = cls_struct_fields0;
- struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0};
-
cls_struct_fields0[0] = &ffi_type_float;
cls_struct_fields0[1] = &ffi_type_float;
cls_struct_fields0[2] = &ffi_type_float;
diff --git a/libffi/testsuite/libffi.call/uninitialized.c b/libffi/testsuite/libffi.call/uninitialized.c
new file mode 100644
index 00000000000..f00d8302349
--- /dev/null
+++ b/libffi/testsuite/libffi.call/uninitialized.c
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef struct
+{
+ unsigned char uc;
+ double d;
+ unsigned int ui;
+} test_structure_1;
+
+static test_structure_1 struct1(test_structure_1 ts)
+{
+ ts.uc++;
+ ts.d--;
+ ts.ui++;
+
+ return ts;
+}
+
+int main (void)
+{
+ ffi_cif cif;
+ ffi_type *args[MAX_ARGS];
+ void *values[MAX_ARGS];
+ ffi_type ts1_type;
+ ffi_type *ts1_type_elements[4];
+
+ memset(&cif, 1, sizeof(cif));
+ ts1_type.size = 0;
+ ts1_type.alignment = 0;
+ ts1_type.type = FFI_TYPE_STRUCT;
+ ts1_type.elements = ts1_type_elements;
+ ts1_type_elements[0] = &ffi_type_uchar;
+ ts1_type_elements[1] = &ffi_type_double;
+ ts1_type_elements[2] = &ffi_type_uint;
+ ts1_type_elements[3] = NULL;
+
+ test_structure_1 ts1_arg;
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_1 *ts1_result =
+ (test_structure_1 *) malloc (sizeof(test_structure_1));
+
+ args[0] = &ts1_type;
+ values[0] = &ts1_arg;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
+ &ts1_type, args) == FFI_OK);
+
+ ts1_arg.uc = '\x01';
+ ts1_arg.d = 3.14159;
+ ts1_arg.ui = 555;
+
+ ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
+
+ CHECK(ts1_result->ui == 556);
+ CHECK(ts1_result->d == 3.14159 - 1);
+
+ free (ts1_result);
+ exit(0);
+}
diff --git a/libffi/testsuite/libffi.call/va_1.c b/libffi/testsuite/libffi.call/va_1.c
new file mode 100644
index 00000000000..5c7cce9f7f1
--- /dev/null
+++ b/libffi/testsuite/libffi.call/va_1.c
@@ -0,0 +1,196 @@
+/* Area: ffi_call
+ Purpose: Test passing struct in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* x86_64-*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static int
+test_fn (int n, ...)
+{
+ va_list ap;
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l;
+ unsigned char uc;
+ signed char sc;
+ unsigned short us;
+ signed short ss;
+ unsigned int ui;
+ signed int si;
+ unsigned long ul;
+ signed long sl;
+ float f;
+ double d;
+
+ va_start (ap, n);
+ s1 = va_arg (ap, struct small_tag);
+ l = va_arg (ap, struct large_tag);
+ s2 = va_arg (ap, struct small_tag);
+
+ uc = va_arg (ap, unsigned);
+ sc = va_arg (ap, signed);
+
+ us = va_arg (ap, unsigned);
+ ss = va_arg (ap, signed);
+
+ ui = va_arg (ap, unsigned int);
+ si = va_arg (ap, signed int);
+
+ ul = va_arg (ap, unsigned long);
+ sl = va_arg (ap, signed long);
+
+ f = va_arg (ap, double); /* C standard promotes float->double
+ when anonymous */
+ d = va_arg (ap, double);
+
+ printf ("%u %u %u %u %u %u %u %u %u uc=%u sc=%d %u %d %u %d %lu %ld %f %f\n",
+ s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+ s2.a, s2.b,
+ uc, sc,
+ us, ss,
+ ui, si,
+ ul, sl,
+ f, d);
+ va_end (ap);
+ return n + 1;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void* args[15];
+ ffi_type* arg_types[15];
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int n;
+ int res;
+
+ unsigned char uc;
+ signed char sc;
+ unsigned short us;
+ signed short ss;
+ unsigned int ui;
+ signed int si;
+ unsigned long ul;
+ signed long sl;
+ double d1;
+ double f1;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = &ffi_type_uint;
+ arg_types[5] = &ffi_type_sint;
+ arg_types[6] = &ffi_type_uint;
+ arg_types[7] = &ffi_type_sint;
+ arg_types[8] = &ffi_type_uint;
+ arg_types[9] = &ffi_type_sint;
+ arg_types[10] = &ffi_type_ulong;
+ arg_types[11] = &ffi_type_slong;
+ arg_types[12] = &ffi_type_double;
+ arg_types[13] = &ffi_type_double;
+ arg_types[14] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 14, &ffi_type_sint, arg_types) == FFI_OK);
+
+ s1.a = 5;
+ s1.b = 6;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ s2.a = 7;
+ s2.b = 8;
+
+ n = 41;
+
+ uc = 9;
+ sc = 10;
+ us = 11;
+ ss = 12;
+ ui = 13;
+ si = 14;
+ ul = 15;
+ sl = 16;
+ f1 = 2.12;
+ d1 = 3.13;
+
+ args[0] = &n;
+ args[1] = &s1;
+ args[2] = &l1;
+ args[3] = &s2;
+ args[4] = &uc;
+ args[5] = &sc;
+ args[6] = &us;
+ args[7] = &ss;
+ args[8] = &ui;
+ args[9] = &si;
+ args[10] = &ul;
+ args[11] = &sl;
+ args[12] = &f1;
+ args[13] = &d1;
+ args[14] = NULL;
+
+ ffi_call(&cif, FFI_FN(test_fn), &res, args);
+ /* { dg-output "5 6 10 11 12 13 14 7 8 uc=9 sc=10 11 12 13 14 15 16 2.120000 3.130000" } */
+ printf("res: %d\n", (int) res);
+ /* { dg-output "\nres: 42" } */
+
+ return 0;
+}
diff --git a/libffi/testsuite/libffi.call/va_struct1.c b/libffi/testsuite/libffi.call/va_struct1.c
new file mode 100644
index 00000000000..11d1f10e5c6
--- /dev/null
+++ b/libffi/testsuite/libffi.call/va_struct1.c
@@ -0,0 +1,121 @@
+/* Area: ffi_call
+ Purpose: Test passing struct in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static int
+test_fn (int n, ...)
+{
+ va_list ap;
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l;
+
+ va_start (ap, n);
+ s1 = va_arg (ap, struct small_tag);
+ l = va_arg (ap, struct large_tag);
+ s2 = va_arg (ap, struct small_tag);
+ printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+ s2.a, s2.b);
+ va_end (ap);
+ return n + 1;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void* args[5];
+ ffi_type* arg_types[5];
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int n;
+ int res;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, arg_types) == FFI_OK);
+
+ s1.a = 5;
+ s1.b = 6;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ s2.a = 7;
+ s2.b = 8;
+
+ n = 41;
+
+ args[0] = &n;
+ args[1] = &s1;
+ args[2] = &l1;
+ args[3] = &s2;
+ args[4] = NULL;
+
+ ffi_call(&cif, FFI_FN(test_fn), &res, args);
+ /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+ printf("res: %d\n", (int) res);
+ /* { dg-output "\nres: 42" } */
+
+ return 0;
+}
diff --git a/libffi/testsuite/libffi.call/va_struct2.c b/libffi/testsuite/libffi.call/va_struct2.c
new file mode 100644
index 00000000000..56f5b9c75fa
--- /dev/null
+++ b/libffi/testsuite/libffi.call/va_struct2.c
@@ -0,0 +1,123 @@
+/* Area: ffi_call
+ Purpose: Test passing struct in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static struct small_tag
+test_fn (int n, ...)
+{
+ va_list ap;
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l;
+
+ va_start (ap, n);
+ s1 = va_arg (ap, struct small_tag);
+ l = va_arg (ap, struct large_tag);
+ s2 = va_arg (ap, struct small_tag);
+ printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+ s2.a, s2.b);
+ va_end (ap);
+ s1.a += s2.a;
+ s1.b += s2.b;
+ return s1;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void* args[5];
+ ffi_type* arg_types[5];
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int n;
+ struct small_tag res;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &s_type, arg_types) == FFI_OK);
+
+ s1.a = 5;
+ s1.b = 6;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ s2.a = 7;
+ s2.b = 8;
+
+ n = 41;
+
+ args[0] = &n;
+ args[1] = &s1;
+ args[2] = &l1;
+ args[3] = &s2;
+ args[4] = NULL;
+
+ ffi_call(&cif, FFI_FN(test_fn), &res, args);
+ /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+ printf("res: %d %d\n", res.a, res.b);
+ /* { dg-output "\nres: 12 14" } */
+
+ return 0;
+}
diff --git a/libffi/testsuite/libffi.call/va_struct3.c b/libffi/testsuite/libffi.call/va_struct3.c
new file mode 100644
index 00000000000..9a27e7fd4a3
--- /dev/null
+++ b/libffi/testsuite/libffi.call/va_struct3.c
@@ -0,0 +1,125 @@
+/* Area: ffi_call
+ Purpose: Test passing struct in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static struct large_tag
+test_fn (int n, ...)
+{
+ va_list ap;
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l;
+
+ va_start (ap, n);
+ s1 = va_arg (ap, struct small_tag);
+ l = va_arg (ap, struct large_tag);
+ s2 = va_arg (ap, struct small_tag);
+ printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+ s2.a, s2.b);
+ va_end (ap);
+ l.a += s1.a;
+ l.b += s1.b;
+ l.c += s2.a;
+ l.d += s2.b;
+ return l;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void* args[5];
+ ffi_type* arg_types[5];
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int n;
+ struct large_tag res;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &l_type, arg_types) == FFI_OK);
+
+ s1.a = 5;
+ s1.b = 6;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ s2.a = 7;
+ s2.b = 8;
+
+ n = 41;
+
+ args[0] = &n;
+ args[1] = &s1;
+ args[2] = &l1;
+ args[3] = &s2;
+ args[4] = NULL;
+
+ ffi_call(&cif, FFI_FN(test_fn), &res, args);
+ /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+ printf("res: %d %d %d %d %d\n", res.a, res.b, res.c, res.d, res.e);
+ /* { dg-output "\nres: 15 17 19 21 14" } */
+
+ return 0;
+}
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 32f9bbe7fd9..2c4dcbb7e46 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,40 @@
+2013-01-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/55818
+ * io/list_read.c (read_real): Do not call hit_eof when EOF can be
+ treated as a value separator.
+ (parse_real): Likewise.
+ (read_logical): Likewise.
+ (read_character): Likewise.
+ (read_complex): Likewise.
+
+2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/48976
+ * io/inquire.c (inquire_via_unit): Set user stream inquiry variable to
+ appropriate value based on unit access method. (inquire_via_filename):
+ Since filename is not associated with an open unit, set stream inquiry
+ to UNKNOWN.
+ * io/io.h: Define inquire stream parameters.
+
+2012-12-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/48960
+ * io/open.c (st_parameter_open): Assign newunit number to user
+ variable only if the the associated open statement is successful.
+
+2012-12-26 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR fortran/55539
+ * io/write_float.def (output_float): Take into account decimal
+ dot.
+
+2012-12-21 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/30162
+ * io/unix.c (raw_tell): If the lseek is done on a
+ non-seekable file, return 0.
+
2012-12-20 Janus Weil <janus@gcc.gnu.org>
PR fortran/36044
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index a5423346db9..6dd003c01aa 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -414,6 +414,27 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
*iqp->size = ssize (u->s);
}
}
+
+ if ((cf2 & IOPARM_INQUIRE_HAS_IQSTREAM) != 0)
+ {
+ if (u == NULL)
+ p = "UNKNOWN";
+ else
+ switch (u->flags.access)
+ {
+ case ACCESS_SEQUENTIAL:
+ case ACCESS_DIRECT:
+ p = "NO";
+ break;
+ case ACCESS_STREAM:
+ p = "YES";
+ break;
+ default:
+ internal_error (&iqp->common, "inquire_via_unit(): Bad pad");
+ }
+
+ cf_strcpy (iqp->iqstream, iqp->iqstream_len, p);
+ }
}
if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0)
@@ -659,6 +680,9 @@ inquire_via_filename (st_parameter_inquire *iqp)
if ((cf2 & IOPARM_INQUIRE_HAS_SIZE) != 0)
*iqp->size = file_size (iqp->file, iqp->file_len);
+
+ if ((cf2 & IOPARM_INQUIRE_HAS_IQSTREAM) != 0)
+ cf_strcpy (iqp->iqstream, iqp->iqstream_len, "UNKNOWN");
}
if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0)
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index 3b4b34a16f8..43aeafd2e63 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -293,6 +293,7 @@ st_parameter_filepos;
#define IOPARM_INQUIRE_HAS_PENDING (1 << 5)
#define IOPARM_INQUIRE_HAS_SIZE (1 << 6)
#define IOPARM_INQUIRE_HAS_ID (1 << 7)
+#define IOPARM_INQUIRE_HAS_IQSTREAM (1 << 8)
typedef struct
{
@@ -326,6 +327,7 @@ typedef struct
GFC_INTEGER_4 *pending;
GFC_IO_INT *size;
GFC_INTEGER_4 *id;
+ CHARACTER1 (iqstream);
}
st_parameter_inquire;
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 403e7190a12..acc27e449b1 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
+ 2013
Free Software Foundation, Inc.
Contributed by Andy Vaught
Namelist input contributed by Paul Thomas
@@ -697,6 +698,7 @@ read_logical (st_parameter_dt *dtp, int length)
break;
CASE_SEPARATORS:
+ case EOF:
unget_char (dtp, c);
eat_separator (dtp);
return; /* Null value. */
@@ -951,6 +953,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused)))
break;
CASE_SEPARATORS:
+ case EOF:
unget_char (dtp, c); /* NULL value. */
eat_separator (dtp);
return;
@@ -975,8 +978,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused)))
for (;;)
{
- if ((c = next_char (dtp)) == EOF)
- goto eof;
+ c = next_char (dtp);
switch (c)
{
CASE_DIGITS:
@@ -984,6 +986,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused)))
break;
CASE_SEPARATORS:
+ case EOF:
unget_char (dtp, c);
goto done; /* String was only digits! */
@@ -1041,7 +1044,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused)))
the string. */
if ((c = next_char (dtp)) == EOF)
- goto eof;
+ goto done_eof;
if (c == quote)
{
push_char (dtp, quote);
@@ -1167,6 +1170,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
goto exp2;
CASE_SEPARATORS:
+ case EOF:
goto done;
default:
@@ -1202,6 +1206,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
break;
CASE_SEPARATORS:
+ case EOF:
unget_char (dtp, c);
goto done;
@@ -1243,7 +1248,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
&& ((c = next_char (dtp)) == 'y' || c == 'Y')
&& (c = next_char (dtp))))
{
- if (is_separator (c))
+ if (is_separator (c) || (c == EOF))
unget_char (dtp, c);
push_char (dtp, 'i');
push_char (dtp, 'n');
@@ -1255,7 +1260,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
&& ((c = next_char (dtp)) == 'n' || c == 'N')
&& (c = next_char (dtp)))
{
- if (is_separator (c))
+ if (is_separator (c) || (c == EOF))
unget_char (dtp, c);
push_char (dtp, 'n');
push_char (dtp, 'a');
@@ -1269,7 +1274,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
goto bad;
c = next_char (dtp);
- if (is_separator (c))
+ if (is_separator (c) || (c == EOF))
unget_char (dtp, c);
}
goto done_infnan;
@@ -1315,6 +1320,7 @@ read_complex (st_parameter_dt *dtp, void * dest, int kind, size_t size)
break;
CASE_SEPARATORS:
+ case EOF:
unget_char (dtp, c);
eat_separator (dtp);
return;
@@ -1369,7 +1375,7 @@ eol_4:
goto bad_complex;
c = next_char (dtp);
- if (!is_separator (c))
+ if (!is_separator (c) && (c != EOF))
goto bad_complex;
unget_char (dtp, c);
@@ -1429,6 +1435,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
goto got_sign;
CASE_SEPARATORS:
+ case EOF:
unget_char (dtp, c); /* Single null. */
eat_separator (dtp);
return;
@@ -1484,6 +1491,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
goto got_repeat;
CASE_SEPARATORS:
+ case EOF:
if (c != '\n' && c != ',' && c != '\r' && c != ';')
unget_char (dtp, c);
goto done;
@@ -1612,6 +1620,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
break;
CASE_SEPARATORS:
+ case EOF:
goto done;
default:
@@ -1647,7 +1656,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
goto unwind;
c = next_char (dtp);
l_push_char (dtp, c);
- if (!is_separator (c))
+ if (!is_separator (c) && (c != EOF))
{
if (c != 'i' && c != 'I')
goto unwind;
@@ -1700,7 +1709,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
}
}
- if (!is_separator (c))
+ if (!is_separator (c) && (c != EOF))
goto unwind;
if (dtp->u.p.namelist_mode)
@@ -2537,16 +2546,16 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
switch (nl->type)
{
case BT_INTEGER:
- read_integer (dtp, len);
- break;
+ read_integer (dtp, len);
+ break;
case BT_LOGICAL:
- read_logical (dtp, len);
- break;
+ read_logical (dtp, len);
+ break;
case BT_CHARACTER:
- read_character (dtp, len);
- break;
+ read_character (dtp, len);
+ break;
case BT_REAL:
/* Need to copy data back from the real location to the temp in order
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index d086d2edfef..c6b73033e86 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -844,10 +844,7 @@ st_open (st_parameter_open *opp)
if ((opp->common.flags & IOPARM_LIBRETURN_MASK) == IOPARM_LIBRETURN_OK)
{
if ((opp->common.flags & IOPARM_OPEN_HAS_NEWUNIT))
- {
- *opp->newunit = get_unique_unit_number(opp);
- opp->common.unit = *opp->newunit;
- }
+ opp->common.unit = get_unique_unit_number(opp);
u = find_or_create_unit (opp->common.unit);
if (u->s == NULL)
@@ -859,6 +856,10 @@ st_open (st_parameter_open *opp)
else
already_open (opp, u, &flags);
}
-
+
+ if ((opp->common.flags & IOPARM_OPEN_HAS_NEWUNIT)
+ && (opp->common.flags & IOPARM_LIBRETURN_MASK) == IOPARM_LIBRETURN_OK)
+ *opp->newunit = opp->common.unit;
+
library_end ();
}
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 9d2e9d85087..e690aec77a5 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -344,7 +344,15 @@ raw_seek (unix_stream * s, gfc_offset offset, int whence)
static gfc_offset
raw_tell (unix_stream * s)
{
- return lseek (s->fd, 0, SEEK_CUR);
+ gfc_offset x;
+ x = lseek (s->fd, 0, SEEK_CUR);
+
+ /* Non-seekable files should always be assumed to be at
+ current position. */
+ if (x == -1 && errno == ESPIPE)
+ x = 0;
+
+ return x;
}
static gfc_offset
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 6521f3c0623..1e30dde29ce 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -483,16 +483,19 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
/* Scan the digits string and count the number of zeros. If we make it
all the way through the loop, we know the value is zero after the
rounding completed above. */
- for (i = 0; i < ndigits; i++)
+ int hasdot = 0;
+ for (i = 0; i < ndigits + hasdot; i++)
{
- if (digits[i] != '0' && digits[i] != '.')
+ if (digits[i] == '.')
+ hasdot = 1;
+ else if (digits[i] != '0')
break;
}
/* To format properly, we need to know if the rounded result is zero and if
so, we set the zero_flag which may have been already set for
actual zero. */
- if (i == ndigits)
+ if (i == ndigits + hasdot)
{
zero_flag = true;
/* The output is zero, so set the sign according to the sign bit unless
diff --git a/libgo/MERGE b/libgo/MERGE
index deeb596317d..52537f98bfb 100644
--- a/libgo/MERGE
+++ b/libgo/MERGE
@@ -1,4 +1,4 @@
-c031aa767edf
+6fdc1974457c
The first line of this file holds the Mercurial revision number of the
last merge done from the master library sources.
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 3da2cb4fae2..b97a82e549f 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -502,6 +502,7 @@ runtime_files = \
runtime/go-unwind.c \
runtime/chan.c \
runtime/cpuprof.c \
+ runtime/env_posix.c \
runtime/lfstack.c \
$(runtime_lock_files) \
runtime/mcache.c \
@@ -1657,6 +1658,13 @@ else
syscall_lsf_file =
endif
+# GNU/Linux specific utimesnano support.
+if LIBGO_IS_LINUX
+syscall_utimesnano_file = go/syscall/libcall_linux_utimesnano.go
+else
+syscall_utimesnano_file = go/syscall/libcall_posix_utimesnano.go
+endif
+
go_base_syscall_files = \
go/syscall/env_unix.go \
go/syscall/syscall_errno.go \
@@ -1679,6 +1687,7 @@ go_base_syscall_files = \
$(syscall_uname_file) \
$(syscall_netlink_file) \
$(syscall_lsf_file) \
+ $(syscall_utimesnano_file) \
$(GO_LIBCALL_OS_FILE) \
$(GO_LIBCALL_OS_ARCH_FILE) \
$(GO_SYSCALL_OS_FILE) \
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 5fd311046d9..7ad74ff4296 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -236,12 +236,13 @@ am__objects_5 = go-append.lo go-assert.lo go-assert-interface.lo \
go-type-float.lo go-type-identity.lo go-type-interface.lo \
go-type-string.lo go-typedesc-equal.lo go-typestring.lo \
go-unsafe-new.lo go-unsafe-newarray.lo go-unsafe-pointer.lo \
- go-unwind.lo chan.lo cpuprof.lo lfstack.lo $(am__objects_1) \
- mcache.lo mcentral.lo $(am__objects_2) mfinal.lo mfixalloc.lo \
- mgc0.lo mheap.lo msize.lo panic.lo parfor.lo print.lo proc.lo \
- runtime.lo signal_unix.lo thread.lo yield.lo $(am__objects_3) \
- iface.lo malloc.lo map.lo mprof.lo reflect.lo runtime1.lo \
- sema.lo sigqueue.lo string.lo time.lo $(am__objects_4)
+ go-unwind.lo chan.lo cpuprof.lo env_posix.lo lfstack.lo \
+ $(am__objects_1) mcache.lo mcentral.lo $(am__objects_2) \
+ mfinal.lo mfixalloc.lo mgc0.lo mheap.lo msize.lo panic.lo \
+ parfor.lo print.lo proc.lo runtime.lo signal_unix.lo thread.lo \
+ yield.lo $(am__objects_3) iface.lo malloc.lo map.lo mprof.lo \
+ reflect.lo runtime1.lo sema.lo sigqueue.lo string.lo time.lo \
+ $(am__objects_4)
am_libgo_la_OBJECTS = $(am__objects_5)
libgo_la_OBJECTS = $(am_libgo_la_OBJECTS)
libgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -863,6 +864,7 @@ runtime_files = \
runtime/go-unwind.c \
runtime/chan.c \
runtime/cpuprof.c \
+ runtime/env_posix.c \
runtime/lfstack.c \
$(runtime_lock_files) \
runtime/mcache.c \
@@ -1868,6 +1870,10 @@ go_unicode_utf8_files = \
# GNU/Linux specific socket filters.
@LIBGO_IS_LINUX_TRUE@syscall_lsf_file = go/syscall/lsf_linux.go
+@LIBGO_IS_LINUX_FALSE@syscall_utimesnano_file = go/syscall/libcall_posix_utimesnano.go
+
+# GNU/Linux specific utimesnano support.
+@LIBGO_IS_LINUX_TRUE@syscall_utimesnano_file = go/syscall/libcall_linux_utimesnano.go
go_base_syscall_files = \
go/syscall/env_unix.go \
go/syscall/syscall_errno.go \
@@ -1890,6 +1896,7 @@ go_base_syscall_files = \
$(syscall_uname_file) \
$(syscall_netlink_file) \
$(syscall_lsf_file) \
+ $(syscall_utimesnano_file) \
$(GO_LIBCALL_OS_FILE) \
$(GO_LIBCALL_OS_ARCH_FILE) \
$(GO_SYSCALL_OS_FILE) \
@@ -2444,6 +2451,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chan.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpuprof.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env_posix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-bsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-irix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-linux.Plo@am__quote@
@@ -3053,6 +3061,13 @@ cpuprof.lo: runtime/cpuprof.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpuprof.lo `test -f 'runtime/cpuprof.c' || echo '$(srcdir)/'`runtime/cpuprof.c
+env_posix.lo: runtime/env_posix.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT env_posix.lo -MD -MP -MF $(DEPDIR)/env_posix.Tpo -c -o env_posix.lo `test -f 'runtime/env_posix.c' || echo '$(srcdir)/'`runtime/env_posix.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/env_posix.Tpo $(DEPDIR)/env_posix.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/env_posix.c' object='env_posix.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o env_posix.lo `test -f 'runtime/env_posix.c' || echo '$(srcdir)/'`runtime/env_posix.c
+
lfstack.lo: runtime/lfstack.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lfstack.lo -MD -MP -MF $(DEPDIR)/lfstack.Tpo -c -o lfstack.lo `test -f 'runtime/lfstack.c' || echo '$(srcdir)/'`runtime/lfstack.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lfstack.Tpo $(DEPDIR)/lfstack.Plo
diff --git a/libgo/go/builtin/builtin.go b/libgo/go/builtin/builtin.go
index a30943b894f..91d263a6234 100644
--- a/libgo/go/builtin/builtin.go
+++ b/libgo/go/builtin/builtin.go
@@ -124,8 +124,8 @@ func append(slice []Type, elems ...Type) []Type
func copy(dst, src []Type) int
// The delete built-in function deletes the element with the specified key
-// (m[key]) from the map. If there is no such element, delete is a no-op.
-// If m is nil, delete panics.
+// (m[key]) from the map. If m is nil or there is no such element, delete
+// is a no-op.
func delete(m map[Type]Type1, key Type)
// The len built-in function returns the length of v, according to its type:
diff --git a/libgo/go/compress/flate/deflate.go b/libgo/go/compress/flate/deflate.go
index e511b50fd1b..d357fe361a5 100644
--- a/libgo/go/compress/flate/deflate.go
+++ b/libgo/go/compress/flate/deflate.go
@@ -22,7 +22,7 @@ const (
logMaxOffsetSize = 15 // Standard DEFLATE
minMatchLength = 3 // The smallest match that the compressor looks for
maxMatchLength = 258 // The longest match for the compressor
- minOffsetSize = 1 // The shortest offset that makes any sence
+ minOffsetSize = 1 // The shortest offset that makes any sense
// The maximum number of tokens we put into a single flat block, just too
// stop things from getting too large.
diff --git a/libgo/go/crypto/cipher/example_test.go b/libgo/go/crypto/cipher/example_test.go
index c888eb2c6a2..e0027cac23b 100644
--- a/libgo/go/crypto/cipher/example_test.go
+++ b/libgo/go/crypto/cipher/example_test.go
@@ -241,7 +241,7 @@ func ExampleStreamReader() {
// Note that this example is simplistic in that it omits any
// authentication of the encrypted data. It you were actually to use
- // StreamReader in this manner, an attacker could flip arbitary bits in
+ // StreamReader in this manner, an attacker could flip arbitrary bits in
// the output.
}
@@ -278,6 +278,6 @@ func ExampleStreamWriter() {
// Note that this example is simplistic in that it omits any
// authentication of the encrypted data. It you were actually to use
- // StreamReader in this manner, an attacker could flip arbitary bits in
+ // StreamReader in this manner, an attacker could flip arbitrary bits in
// the decrypted result.
}
diff --git a/libgo/go/crypto/x509/x509_test.go b/libgo/go/crypto/x509/x509_test.go
index a13f4598d58..b2d6fe3d552 100644
--- a/libgo/go/crypto/x509/x509_test.go
+++ b/libgo/go/crypto/x509/x509_test.go
@@ -439,7 +439,7 @@ func TestECDSA(t *testing.T) {
t.Errorf("%d: public key algorithm is %v, want ECDSA", i, pka)
}
if err = cert.CheckSignatureFrom(cert); err != nil {
- t.Errorf("%d: certificate verfication failed: %s", i, err)
+ t.Errorf("%d: certificate verification failed: %s", i, err)
}
}
}
@@ -519,7 +519,7 @@ func TestVerifyCertificateWithDSASignature(t *testing.T) {
}
// test cert is self-signed
if err = cert.CheckSignatureFrom(cert); err != nil {
- t.Fatalf("DSA Certificate verfication failed: %s", err)
+ t.Fatalf("DSA Certificate verification failed: %s", err)
}
}
diff --git a/libgo/go/database/sql/fakedb_test.go b/libgo/go/database/sql/fakedb_test.go
index aec572760fe..c38ba7c8492 100644
--- a/libgo/go/database/sql/fakedb_test.go
+++ b/libgo/go/database/sql/fakedb_test.go
@@ -42,9 +42,10 @@ type fakeDriver struct {
type fakeDB struct {
name string
- mu sync.Mutex
- free []*fakeConn
- tables map[string]*table
+ mu sync.Mutex
+ free []*fakeConn
+ tables map[string]*table
+ badConn bool
}
type table struct {
@@ -83,6 +84,7 @@ type fakeConn struct {
stmtsMade int
stmtsClosed int
numPrepare int
+ bad bool
}
func (c *fakeConn) incrStat(v *int) {
@@ -122,7 +124,9 @@ func init() {
// Supports dsn forms:
// <dbname>
-// <dbname>;<opts> (no currently supported options)
+// <dbname>;<opts> (only currently supported option is `badConn`,
+// which causes driver.ErrBadConn to be returned on
+// every other conn.Begin())
func (d *fakeDriver) Open(dsn string) (driver.Conn, error) {
parts := strings.Split(dsn, ";")
if len(parts) < 1 {
@@ -135,7 +139,12 @@ func (d *fakeDriver) Open(dsn string) (driver.Conn, error) {
d.mu.Lock()
d.openCount++
d.mu.Unlock()
- return &fakeConn{db: db}, nil
+ conn := &fakeConn{db: db}
+
+ if len(parts) >= 2 && parts[1] == "badConn" {
+ conn.bad = true
+ }
+ return conn, nil
}
func (d *fakeDriver) getDB(name string) *fakeDB {
@@ -199,7 +208,20 @@ func (db *fakeDB) columnType(table, column string) (typ string, ok bool) {
return "", false
}
+func (c *fakeConn) isBad() bool {
+ // if not simulating bad conn, do nothing
+ if !c.bad {
+ return false
+ }
+ // alternate between bad conn and not bad conn
+ c.db.badConn = !c.db.badConn
+ return c.db.badConn
+}
+
func (c *fakeConn) Begin() (driver.Tx, error) {
+ if c.isBad() {
+ return nil, driver.ErrBadConn
+ }
if c.currTx != nil {
return nil, errors.New("already in a transaction")
}
diff --git a/libgo/go/database/sql/sql.go b/libgo/go/database/sql/sql.go
index b0cba949c6b..e7c7780ef2e 100644
--- a/libgo/go/database/sql/sql.go
+++ b/libgo/go/database/sql/sql.go
@@ -266,7 +266,7 @@ func (db *DB) connIfFree(wanted driver.Conn) (conn driver.Conn, ok bool) {
var putConnHook func(*DB, driver.Conn)
// putConn adds a connection to the db's free pool.
-// err is optionally the last error that occured on this connection.
+// err is optionally the last error that occurred on this connection.
func (db *DB) putConn(c driver.Conn, err error) {
if err == driver.ErrBadConn {
// Don't reuse bad connections.
@@ -426,7 +426,7 @@ func (db *DB) begin() (tx *Tx, err error) {
txi, err := ci.Begin()
if err != nil {
db.putConn(ci, err)
- return nil, fmt.Errorf("sql: failed to Begin transaction: %v", err)
+ return nil, err
}
return &Tx{
db: db,
diff --git a/libgo/go/database/sql/sql_test.go b/libgo/go/database/sql/sql_test.go
index 1bfb59020b4..b702b850ec2 100644
--- a/libgo/go/database/sql/sql_test.go
+++ b/libgo/go/database/sql/sql_test.go
@@ -402,6 +402,39 @@ func TestTxQueryInvalid(t *testing.T) {
}
}
+// Tests fix for issue 4433, that retries in Begin happen when
+// conn.Begin() returns ErrBadConn
+func TestTxErrBadConn(t *testing.T) {
+ db, err := Open("test", fakeDBName+";badConn")
+ if err != nil {
+ t.Fatalf("Open: %v", err)
+ }
+ if _, err := db.Exec("WIPE"); err != nil {
+ t.Fatalf("exec wipe: %v", err)
+ }
+ defer closeDB(t, db)
+ exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool")
+ stmt, err := db.Prepare("INSERT|t1|name=?,age=?")
+ if err != nil {
+ t.Fatalf("Stmt, err = %v, %v", stmt, err)
+ }
+ defer stmt.Close()
+ tx, err := db.Begin()
+ if err != nil {
+ t.Fatalf("Begin = %v", err)
+ }
+ txs := tx.Stmt(stmt)
+ defer txs.Close()
+ _, err = txs.Exec("Bobby", 7)
+ if err != nil {
+ t.Fatalf("Exec = %v", err)
+ }
+ err = tx.Commit()
+ if err != nil {
+ t.Fatalf("Commit = %v", err)
+ }
+}
+
// Tests fix for issue 2542, that we release a lock when querying on
// a closed connection.
func TestIssue2542Deadlock(t *testing.T) {
diff --git a/libgo/go/debug/elf/file.go b/libgo/go/debug/elf/file.go
index f462375dc64..eb3d72f7126 100644
--- a/libgo/go/debug/elf/file.go
+++ b/libgo/go/debug/elf/file.go
@@ -272,7 +272,8 @@ func NewFile(r io.ReaderAt) (*File, error) {
shnum = int(hdr.Shnum)
shstrndx = int(hdr.Shstrndx)
}
- if shstrndx < 0 || shstrndx >= shnum {
+
+ if shnum > 0 && shoff > 0 && (shstrndx < 0 || shstrndx >= shnum) {
return nil, &FormatError{0, "invalid ELF shstrndx", shstrndx}
}
@@ -367,6 +368,10 @@ func NewFile(r io.ReaderAt) (*File, error) {
f.Sections[i] = s
}
+ if len(f.Sections) == 0 {
+ return f, nil
+ }
+
// Load section header string table.
shstrtab, err := f.Sections[shstrndx].Data()
if err != nil {
diff --git a/libgo/go/debug/elf/file_test.go b/libgo/go/debug/elf/file_test.go
index 810a2f9b9a3..f9aa7265af0 100644
--- a/libgo/go/debug/elf/file_test.go
+++ b/libgo/go/debug/elf/file_test.go
@@ -5,10 +5,14 @@
package elf
import (
+ "bytes"
+ "compress/gzip"
"debug/dwarf"
"encoding/binary"
+ "io"
"net"
"os"
+ "path"
"reflect"
"runtime"
"testing"
@@ -121,15 +125,49 @@ var fileTests = []fileTest{
},
[]string{"libc.so.6"},
},
+ {
+ "testdata/hello-world-core.gz",
+ FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0x0, binary.LittleEndian, ET_CORE, EM_X86_64, 0x0},
+ []SectionHeader{},
+ []ProgHeader{
+ {Type: PT_NOTE, Flags: 0x0, Off: 0x3f8, Vaddr: 0x0, Paddr: 0x0, Filesz: 0x8ac, Memsz: 0x0, Align: 0x0},
+ {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x1000, Vaddr: 0x400000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_R, Off: 0x1000, Vaddr: 0x401000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x2000, Vaddr: 0x402000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3000, Vaddr: 0x7f54078b8000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1b5000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: 0x0, Off: 0x3000, Vaddr: 0x7f5407a6d000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1ff000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_R, Off: 0x3000, Vaddr: 0x7f5407c6c000, Paddr: 0x0, Filesz: 0x4000, Memsz: 0x4000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x7000, Vaddr: 0x7f5407c70000, Paddr: 0x0, Filesz: 0x2000, Memsz: 0x2000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x9000, Vaddr: 0x7f5407c72000, Paddr: 0x0, Filesz: 0x5000, Memsz: 0x5000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0xe000, Vaddr: 0x7f5407c77000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x22000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0xe000, Vaddr: 0x7f5407e81000, Paddr: 0x0, Filesz: 0x3000, Memsz: 0x3000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x11000, Vaddr: 0x7f5407e96000, Paddr: 0x0, Filesz: 0x3000, Memsz: 0x3000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_R, Off: 0x14000, Vaddr: 0x7f5407e99000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x15000, Vaddr: 0x7f5407e9a000, Paddr: 0x0, Filesz: 0x2000, Memsz: 0x2000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x17000, Vaddr: 0x7fff79972000, Paddr: 0x0, Filesz: 0x23000, Memsz: 0x23000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3a000, Vaddr: 0x7fff799f8000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000},
+ {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3b000, Vaddr: 0xffffffffff600000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000},
+ },
+ nil,
+ },
}
func TestOpen(t *testing.T) {
for i := range fileTests {
tt := &fileTests[i]
- f, err := Open(tt.file)
+ var f *File
+ var err error
+ if path.Ext(tt.file) == ".gz" {
+ var r io.ReaderAt
+ if r, err = decompress(tt.file); err == nil {
+ f, err = NewFile(r)
+ }
+ } else {
+ f, err = Open(tt.file)
+ }
if err != nil {
- t.Error(err)
+ t.Errorf("cannot open file %s: %v", tt.file, err)
continue
}
if !reflect.DeepEqual(f.FileHeader, tt.hdr) {
@@ -175,6 +213,23 @@ func TestOpen(t *testing.T) {
}
}
+// elf.NewFile requires io.ReaderAt, which compress/gzip cannot
+// provide. Decompress the file to a bytes.Reader.
+func decompress(gz string) (io.ReaderAt, error) {
+ in, err := os.Open(gz)
+ if err != nil {
+ return nil, err
+ }
+ defer in.Close()
+ r, err := gzip.NewReader(in)
+ if err != nil {
+ return nil, err
+ }
+ var out bytes.Buffer
+ _, err = io.Copy(&out, r)
+ return bytes.NewReader(out.Bytes()), err
+}
+
type relocationTestEntry struct {
entryNumber int
entry *dwarf.Entry
diff --git a/libgo/go/debug/elf/testdata/hello-world-core.gz b/libgo/go/debug/elf/testdata/hello-world-core.gz
new file mode 100644
index 00000000000..806af6edbc2
--- /dev/null
+++ b/libgo/go/debug/elf/testdata/hello-world-core.gz
Binary files differ
diff --git a/libgo/go/encoding/csv/writer.go b/libgo/go/encoding/csv/writer.go
index 17e485083e9..1faecb66480 100644
--- a/libgo/go/encoding/csv/writer.go
+++ b/libgo/go/encoding/csv/writer.go
@@ -92,10 +92,17 @@ func (w *Writer) Write(record []string) (err error) {
}
// Flush writes any buffered data to the underlying io.Writer.
+// To check if an error occurred during the Flush, call Error.
func (w *Writer) Flush() {
w.w.Flush()
}
+// Error reports any error that has occurred during a previous Write or Flush.
+func (w *Writer) Error() error {
+ _, err := w.w.Write(nil)
+ return err
+}
+
// WriteAll writes multiple CSV records to w using Write and then calls Flush.
func (w *Writer) WriteAll(records [][]string) (err error) {
for _, record := range records {
diff --git a/libgo/go/encoding/csv/writer_test.go b/libgo/go/encoding/csv/writer_test.go
index 578959007fd..03ca6b093c0 100644
--- a/libgo/go/encoding/csv/writer_test.go
+++ b/libgo/go/encoding/csv/writer_test.go
@@ -6,6 +6,7 @@ package csv
import (
"bytes"
+ "errors"
"testing"
)
@@ -42,3 +43,30 @@ func TestWrite(t *testing.T) {
}
}
}
+
+type errorWriter struct{}
+
+func (e errorWriter) Write(b []byte) (int, error) {
+ return 0, errors.New("Test")
+}
+
+func TestError(t *testing.T) {
+ b := &bytes.Buffer{}
+ f := NewWriter(b)
+ f.Write([]string{"abc"})
+ f.Flush()
+ err := f.Error()
+
+ if err != nil {
+ t.Errorf("Unexpected error: %s\n", err)
+ }
+
+ f = NewWriter(errorWriter{})
+ f.Write([]string{"abc"})
+ f.Flush()
+ err = f.Error()
+
+ if err == nil {
+ t.Error("Error should not be nil")
+ }
+}
diff --git a/libgo/go/encoding/gob/decode.go b/libgo/go/encoding/gob/decode.go
index 900c69ddb47..a80d9f9195f 100644
--- a/libgo/go/encoding/gob/decode.go
+++ b/libgo/go/encoding/gob/decode.go
@@ -62,15 +62,15 @@ func overflow(name string) error {
// Used only by the Decoder to read the message length.
func decodeUintReader(r io.Reader, buf []byte) (x uint64, width int, err error) {
width = 1
- _, err = r.Read(buf[0:width])
- if err != nil {
+ n, err := io.ReadFull(r, buf[0:width])
+ if n == 0 {
return
}
b := buf[0]
if b <= 0x7f {
return uint64(b), width, nil
}
- n := -int(int8(b))
+ n = -int(int8(b))
if n > uint64Size {
err = errBadUint
return
diff --git a/libgo/go/encoding/json/decode.go b/libgo/go/encoding/json/decode.go
index 1e0c8d4b6e6..b46dac96f5d 100644
--- a/libgo/go/encoding/json/decode.go
+++ b/libgo/go/encoding/json/decode.go
@@ -125,13 +125,12 @@ func (d *decodeState) unmarshal(v interface{}) (err error) {
}()
rv := reflect.ValueOf(v)
- pv := rv
- if pv.Kind() != reflect.Ptr || pv.IsNil() {
+ if rv.Kind() != reflect.Ptr || rv.IsNil() {
return &InvalidUnmarshalError{reflect.TypeOf(v)}
}
d.scan.reset()
- // We decode rv not pv.Elem because the Unmarshaler interface
+ // We decode rv not rv.Elem because the Unmarshaler interface
// test must be applied at the top level of the value.
d.value(rv)
return d.savedError
@@ -423,17 +422,12 @@ func (d *decodeState) object(v reflect.Value) {
v = pv
// Decoding into nil interface? Switch to non-reflect code.
- iv := v
- if iv.Kind() == reflect.Interface {
- iv.Set(reflect.ValueOf(d.objectInterface()))
+ if v.Kind() == reflect.Interface {
+ v.Set(reflect.ValueOf(d.objectInterface()))
return
}
// Check type of target: struct or map[string]T
- var (
- mv reflect.Value
- sv reflect.Value
- )
switch v.Kind() {
case reflect.Map:
// map must have string type
@@ -442,17 +436,15 @@ func (d *decodeState) object(v reflect.Value) {
d.saveError(&UnmarshalTypeError{"object", v.Type()})
break
}
- mv = v
- if mv.IsNil() {
- mv.Set(reflect.MakeMap(t))
+ if v.IsNil() {
+ v.Set(reflect.MakeMap(t))
}
case reflect.Struct:
- sv = v
default:
d.saveError(&UnmarshalTypeError{"object", v.Type()})
}
- if !mv.IsValid() && !sv.IsValid() {
+ if !v.IsValid() {
d.off--
d.next() // skip over { } in input
return
@@ -484,8 +476,8 @@ func (d *decodeState) object(v reflect.Value) {
var subv reflect.Value
destring := false // whether the value is wrapped in a string to be decoded first
- if mv.IsValid() {
- elemType := mv.Type().Elem()
+ if v.Kind() == reflect.Map {
+ elemType := v.Type().Elem()
if !mapElem.IsValid() {
mapElem = reflect.New(elemType).Elem()
} else {
@@ -494,7 +486,7 @@ func (d *decodeState) object(v reflect.Value) {
subv = mapElem
} else {
var f *field
- fields := cachedTypeFields(sv.Type())
+ fields := cachedTypeFields(v.Type())
for i := range fields {
ff := &fields[i]
if ff.name == key {
@@ -506,7 +498,7 @@ func (d *decodeState) object(v reflect.Value) {
}
}
if f != nil {
- subv = sv
+ subv = v
destring = f.quoted
for _, i := range f.index {
if subv.Kind() == reflect.Ptr {
@@ -519,7 +511,7 @@ func (d *decodeState) object(v reflect.Value) {
}
} else {
// To give a good error, a quick scan for unexported fields in top level.
- st := sv.Type()
+ st := v.Type()
for i := 0; i < st.NumField(); i++ {
f := st.Field(i)
if f.PkgPath != "" && strings.EqualFold(f.Name, key) {
@@ -546,8 +538,8 @@ func (d *decodeState) object(v reflect.Value) {
}
// Write value back to map;
// if using struct, subv points into struct already.
- if mv.IsValid() {
- mv.SetMapIndex(reflect.ValueOf(key), subv)
+ if v.Kind() == reflect.Map {
+ v.SetMapIndex(reflect.ValueOf(key), subv)
}
// Next token must be , or }.
diff --git a/libgo/go/exp/gotype/gotype_test.go b/libgo/go/exp/gotype/gotype_test.go
index 2d58f328839..c0c2e329bfe 100644
--- a/libgo/go/exp/gotype/gotype_test.go
+++ b/libgo/go/exp/gotype/gotype_test.go
@@ -25,7 +25,9 @@ func runTest(t *testing.T, path string) {
} else {
// package directory
// TODO(gri) gotype should use the build package instead
- pkg, err := build.Import(path, "", 0)
+ ctxt := build.Default
+ ctxt.CgoEnabled = false
+ pkg, err := ctxt.Import(path, "", 0)
if err != nil {
t.Errorf("build.Import error for path = %s: %s", path, err)
return
@@ -50,7 +52,7 @@ var tests = []string{
// directories
// Note: packages that don't typecheck yet are commented out
- // "archive/tar", // investigate
+ "archive/tar",
"archive/zip",
"bufio",
@@ -77,13 +79,13 @@ var tests = []string{
"crypto/md5",
"crypto/rand",
"crypto/rc4",
- // "crypto/rsa", // investigate (GOARCH=386)
+ // "crypto/rsa", // intermittent failure: /home/gri/go2/src/pkg/crypto/rsa/pkcs1v15.go:21:27: undeclared name: io
"crypto/sha1",
"crypto/sha256",
"crypto/sha512",
"crypto/subtle",
"crypto/tls",
- // "crypto/x509", // investigate
+ "crypto/x509",
"crypto/x509/pkix",
"database/sql",
@@ -99,9 +101,9 @@ var tests = []string{
"encoding/asn1",
"encoding/base32",
"encoding/base64",
- // "encoding/binary", // complex() doesn't work yet
+ "encoding/binary",
"encoding/csv",
- // "encoding/gob", // complex() doesn't work yet
+ "encoding/gob",
"encoding/hex",
"encoding/json",
"encoding/pem",
@@ -117,7 +119,7 @@ var tests = []string{
"go/ast",
"go/build",
- // "go/doc", // variadic parameters don't work yet fully
+ "go/doc",
"go/format",
"go/parser",
"go/printer",
@@ -125,7 +127,7 @@ var tests = []string{
"go/token",
"hash/adler32",
- // "hash/crc32", // investigate
+ "hash/crc32",
"hash/crc64",
"hash/fnv",
@@ -139,54 +141,54 @@ var tests = []string{
"index/suffixarray",
"io",
- // "io/ioutil", // investigate
+ "io/ioutil",
"log",
"log/syslog",
"math",
- // "math/big", // investigate
- // "math/cmplx", // complex doesn't work yet
+ "math/big",
+ "math/cmplx",
"math/rand",
"mime",
"mime/multipart",
- // "net", // depends on C files
+ // "net", // c:\go\root\src\pkg\net\interface_windows.go:54:13: invalid operation: division by zero
"net/http",
"net/http/cgi",
- // "net/http/fcgi", // investigate
+ "net/http/fcgi",
"net/http/httptest",
"net/http/httputil",
- // "net/http/pprof", // investigate
+ "net/http/pprof",
"net/mail",
- // "net/rpc", // investigate
+ "net/rpc",
"net/rpc/jsonrpc",
"net/smtp",
"net/textproto",
"net/url",
- // "path", // variadic parameters don't work yet fully
- // "path/filepath", // investigate
+ "path",
+ "path/filepath",
- // "reflect", // investigate
+ // "reflect", // unsafe.Sizeof must return size > 0 for pointer types
"regexp",
"regexp/syntax",
"runtime",
- // "runtime/cgo", // import "C"
+ "runtime/cgo",
"runtime/debug",
"runtime/pprof",
"sort",
- // "strconv", // investigate
+ // "strconv", // bug in switch case duplicate detection
"strings",
- // "sync", // platform-specific files
- // "sync/atomic", // platform-specific files
+ "sync",
+ "sync/atomic",
- // "syscall", // platform-specific files
+ // "syscall", c:\go\root\src\pkg\syscall\syscall_windows.go:35:16: cannot convert EINVAL (constant 536870951) to error
"testing",
"testing/iotest",
@@ -194,10 +196,10 @@ var tests = []string{
"text/scanner",
"text/tabwriter",
- // "text/template", // variadic parameters don't work yet fully
- // "text/template/parse", // variadic parameters don't work yet fully
+ "text/template",
+ "text/template/parse",
- // "time", // platform-specific files
+ // "time", // local const decls without initialization expressions
"unicode",
"unicode/utf16",
"unicode/utf8",
diff --git a/libgo/go/exp/locale/collate/build/trie.go b/libgo/go/exp/locale/collate/build/trie.go
index f5214279e28..9404a3465bf 100644
--- a/libgo/go/exp/locale/collate/build/trie.go
+++ b/libgo/go/exp/locale/collate/build/trie.go
@@ -20,7 +20,7 @@ import (
const (
blockSize = 64
- blockOffset = 2 // Substract 2 blocks to compensate for the 0x80 added to continuation bytes.
+ blockOffset = 2 // Subtract 2 blocks to compensate for the 0x80 added to continuation bytes.
)
type trieHandle struct {
diff --git a/libgo/go/exp/norm/iter.go b/libgo/go/exp/norm/iter.go
index c0ab25e5658..def822d8e1c 100644
--- a/libgo/go/exp/norm/iter.go
+++ b/libgo/go/exp/norm/iter.go
@@ -179,7 +179,7 @@ doNorm:
i.rb.src.copySlice(out[outCopyStart:], inCopyStart, i.p)
if !i.rb.insertDecomposed(out[i.outStart:outp]) {
// Start over to prevent decompositions from crossing segment boundaries.
- // This is a rare occurance.
+ // This is a rare occurrence.
i.p = i.inStart
i.info = i.rb.f.info(i.rb.src, i.p)
}
diff --git a/libgo/go/exp/norm/normalize_test.go b/libgo/go/exp/norm/normalize_test.go
index 8b970598b4d..1a118f2d14d 100644
--- a/libgo/go/exp/norm/normalize_test.go
+++ b/libgo/go/exp/norm/normalize_test.go
@@ -31,7 +31,7 @@ func runPosTests(t *testing.T, name string, f Form, fn positionFunc, tests []Pos
}
runes := []rune(test.buffer)
if rb.nrune != len(runes) {
- t.Errorf("%s:%d: reorder buffer lenght is %d; want %d", name, i, rb.nrune, len(runes))
+ t.Errorf("%s:%d: reorder buffer length is %d; want %d", name, i, rb.nrune, len(runes))
continue
}
for j, want := range runes {
diff --git a/libgo/go/exp/norm/triegen.go b/libgo/go/exp/norm/triegen.go
index 1780ac7129d..52c88b039a2 100644
--- a/libgo/go/exp/norm/triegen.go
+++ b/libgo/go/exp/norm/triegen.go
@@ -21,7 +21,7 @@ import (
const (
blockSize = 64
- blockOffset = 2 // Substract two blocks to compensate for the 0x80 added to continuation bytes.
+ blockOffset = 2 // Subtract two blocks to compensate for the 0x80 added to continuation bytes.
maxSparseEntries = 16
)
diff --git a/libgo/go/exp/types/builtins.go b/libgo/go/exp/types/builtins.go
index 88267042e4b..ed636ee2a4f 100644
--- a/libgo/go/exp/types/builtins.go
+++ b/libgo/go/exp/types/builtins.go
@@ -128,13 +128,51 @@ func (check *checker) builtin(x *operand, call *ast.CallExpr, bin *builtin, iota
x.mode = novalue
case _Complex:
+ if !check.complexArg(x) {
+ goto Error
+ }
+
var y operand
check.expr(&y, args[1], nil, iota)
if y.mode == invalid {
goto Error
}
- // TODO(gri) handle complex(a, b) like (a + toImag(b))
- unimplemented()
+ if !check.complexArg(&y) {
+ goto Error
+ }
+
+ check.convertUntyped(x, y.typ)
+ if x.mode == invalid {
+ goto Error
+ }
+ check.convertUntyped(&y, x.typ)
+ if y.mode == invalid {
+ goto Error
+ }
+
+ if !isIdentical(x.typ, y.typ) {
+ check.invalidArg(x.pos(), "mismatched types %s and %s", x.typ, y.typ)
+ goto Error
+ }
+
+ typ := underlying(x.typ).(*Basic)
+ if x.mode == constant && y.mode == constant {
+ x.val = binaryOpConst(x.val, toImagConst(y.val), token.ADD, typ)
+ } else {
+ x.mode = value
+ }
+
+ switch typ.Kind {
+ case Float32:
+ x.typ = Typ[Complex64]
+ case Float64:
+ x.typ = Typ[Complex128]
+ case UntypedInt, UntypedRune, UntypedFloat:
+ x.typ = Typ[UntypedComplex]
+ default:
+ check.invalidArg(x.pos(), "float32 or float64 arguments expected")
+ goto Error
+ }
case _Copy:
// TODO(gri) implements checks
@@ -361,3 +399,12 @@ func unparen(x ast.Expr) ast.Expr {
}
return x
}
+
+func (check *checker) complexArg(x *operand) bool {
+ t, _ := underlying(x.typ).(*Basic)
+ if t != nil && (t.Info&IsFloat != 0 || t.Kind == UntypedInt || t.Kind == UntypedRune) {
+ return true
+ }
+ check.invalidArg(x.pos(), "%s must be a float32, float64, or an untyped non-complex numeric constant", x)
+ return false
+}
diff --git a/libgo/go/exp/types/const.go b/libgo/go/exp/types/const.go
index c678e4749b0..d44c8fb61d2 100644
--- a/libgo/go/exp/types/const.go
+++ b/libgo/go/exp/types/const.go
@@ -49,12 +49,17 @@ func (nilType) String() string {
return "nil"
}
-// Frequently used constants.
+// Implementation-specific constants.
+// TODO(gri) These need to go elsewhere.
+const (
+ intBits = 32
+ ptrBits = 64
+)
+
+// Frequently used values.
var (
- zeroConst = int64(0)
- oneConst = int64(1)
- minusOneConst = int64(-1)
- nilConst = nilType{}
+ nilConst = nilType{}
+ zeroConst = int64(0)
)
// int64 bounds
@@ -74,7 +79,7 @@ func normalizeIntConst(x *big.Int) interface{} {
}
// normalizeRatConst returns the smallest constant representation
-// for the specific value of x; either an int64, *big.Int value,
+// for the specific value of x; either an int64, *big.Int,
// or *big.Rat value.
//
func normalizeRatConst(x *big.Rat) interface{} {
@@ -84,15 +89,15 @@ func normalizeRatConst(x *big.Rat) interface{} {
return x
}
-// normalizeComplexConst returns the smallest constant representation
-// for the specific value of x; either an int64, *big.Int value, *big.Rat,
-// or complex value.
+// newComplex returns the smallest constant representation
+// for the specific value re + im*i; either an int64, *big.Int,
+// *big.Rat, or complex value.
//
-func normalizeComplexConst(x complex) interface{} {
- if x.im.Sign() == 0 {
- return normalizeRatConst(x.re)
+func newComplex(re, im *big.Rat) interface{} {
+ if im.Sign() == 0 {
+ return normalizeRatConst(re)
}
- return x
+ return complex{re, im}
}
// makeRuneConst returns the int64 code point for the rune literal
@@ -140,7 +145,7 @@ func makeComplexConst(lit string) interface{} {
n := len(lit)
if n > 0 && lit[n-1] == 'i' {
if im, ok := new(big.Rat).SetString(lit[0 : n-1]); ok {
- return normalizeComplexConst(complex{big.NewRat(0, 1), im})
+ return newComplex(big.NewRat(0, 1), im)
}
}
return nil
@@ -157,6 +162,22 @@ func makeStringConst(lit string) interface{} {
return nil
}
+// toImagConst returns the constant complex(0, x) for a non-complex x.
+func toImagConst(x interface{}) interface{} {
+ var im *big.Rat
+ switch x := x.(type) {
+ case int64:
+ im = big.NewRat(x, 1)
+ case *big.Int:
+ im = new(big.Rat).SetFrac(x, int1)
+ case *big.Rat:
+ im = x
+ default:
+ unreachable()
+ }
+ return complex{rat0, im}
+}
+
// isZeroConst reports whether the value of constant x is 0.
// x must be normalized.
//
@@ -186,9 +207,6 @@ func isNegConst(x interface{}) bool {
// of precision.
//
func isRepresentableConst(x interface{}, as BasicKind) bool {
- const intBits = 32 // TODO(gri) implementation-specific constant
- const ptrBits = 64 // TODO(gri) implementation-specific constant
-
switch x := x.(type) {
case bool:
return as == Bool || as == UntypedBool
@@ -370,13 +388,71 @@ func is63bit(x int64) bool {
return -1<<62 <= x && x <= 1<<62-1
}
+// unaryOpConst returns the result of the constant evaluation op x where x is of the given type.
+func unaryOpConst(x interface{}, op token.Token, typ *Basic) interface{} {
+ switch op {
+ case token.ADD:
+ return x // nothing to do
+ case token.SUB:
+ switch x := x.(type) {
+ case int64:
+ if z := -x; z != x {
+ return z // no overflow
+ }
+ // overflow - need to convert to big.Int
+ return normalizeIntConst(new(big.Int).Neg(big.NewInt(x)))
+ case *big.Int:
+ return normalizeIntConst(new(big.Int).Neg(x))
+ case *big.Rat:
+ return normalizeRatConst(new(big.Rat).Neg(x))
+ case complex:
+ return newComplex(new(big.Rat).Neg(x.re), new(big.Rat).Neg(x.im))
+ }
+ case token.XOR:
+ var z big.Int
+ switch x := x.(type) {
+ case int64:
+ z.Not(big.NewInt(x))
+ case *big.Int:
+ z.Not(x)
+ default:
+ unreachable()
+ }
+ // For unsigned types, the result will be negative and
+ // thus "too large": We must limit the result size to
+ // the type's size.
+ if typ.Info&IsUnsigned != 0 {
+ s := uint(typ.Size) * 8
+ if s == 0 {
+ // platform-specific type
+ // TODO(gri) this needs to be factored out
+ switch typ.Kind {
+ case Uint:
+ s = intBits
+ case Uintptr:
+ s = ptrBits
+ default:
+ unreachable()
+ }
+ }
+ // z &^= (-1)<<s
+ z.AndNot(&z, new(big.Int).Lsh(big.NewInt(-1), s))
+ }
+ return normalizeIntConst(&z)
+ case token.NOT:
+ return !x.(bool)
+ }
+ unreachable()
+ return nil
+}
+
// binaryOpConst returns the result of the constant evaluation x op y;
-// both operands must be of the same "kind" (boolean, numeric, or string).
-// If intDiv is true, division (op == token.QUO) is using integer division
+// both operands must be of the same constant "kind" (boolean, numeric, or string).
+// If typ is an integer type, division (op == token.QUO) is using integer division
// (and the result is guaranteed to be integer) rather than floating-point
// division. Division by zero leads to a run-time panic.
//
-func binaryOpConst(x, y interface{}, op token.Token, intDiv bool) interface{} {
+func binaryOpConst(x, y interface{}, op token.Token, typ *Basic) interface{} {
x, y = matchConst(x, y)
switch x := x.(type) {
@@ -387,8 +463,6 @@ func binaryOpConst(x, y interface{}, op token.Token, intDiv bool) interface{} {
return x && y
case token.LOR:
return x || y
- default:
- unreachable()
}
case int64:
@@ -415,7 +489,7 @@ func binaryOpConst(x, y interface{}, op token.Token, intDiv bool) interface{} {
case token.REM:
return x % y
case token.QUO:
- if intDiv {
+ if typ.Info&IsInteger != 0 {
return x / y
}
return normalizeRatConst(new(big.Rat).SetFrac(big.NewInt(x), big.NewInt(y)))
@@ -427,8 +501,6 @@ func binaryOpConst(x, y interface{}, op token.Token, intDiv bool) interface{} {
return x ^ y
case token.AND_NOT:
return x &^ y
- default:
- unreachable()
}
case *big.Int:
@@ -444,7 +516,7 @@ func binaryOpConst(x, y interface{}, op token.Token, intDiv bool) interface{} {
case token.REM:
z.Rem(x, y)
case token.QUO:
- if intDiv {
+ if typ.Info&IsInteger != 0 {
z.Quo(x, y)
} else {
return normalizeRatConst(new(big.Rat).SetFrac(x, y))
@@ -517,7 +589,7 @@ func binaryOpConst(x, y interface{}, op token.Token, intDiv bool) interface{} {
default:
unreachable()
}
- return normalizeComplexConst(complex{&re, &im})
+ return newComplex(&re, &im)
case string:
if op == token.ADD {
diff --git a/libgo/go/exp/types/errors.go b/libgo/go/exp/types/errors.go
index 1a1659538a5..b1b6436968a 100644
--- a/libgo/go/exp/types/errors.go
+++ b/libgo/go/exp/types/errors.go
@@ -266,15 +266,8 @@ func writeType(buf *bytes.Buffer, typ Type) {
buf.WriteByte('*')
writeType(buf, t.Base)
- case *tuple:
- buf.WriteByte('(')
- for i, typ := range t.list {
- if i > 0 {
- buf.WriteString("; ")
- }
- writeType(buf, typ)
- }
- buf.WriteByte(')')
+ case *Result:
+ writeParams(buf, t.Values, false)
case *Signature:
buf.WriteString("func")
diff --git a/libgo/go/exp/types/expr.go b/libgo/go/exp/types/expr.go
index e1f627b98f2..2f5f2b3f1ec 100644
--- a/libgo/go/exp/types/expr.go
+++ b/libgo/go/exp/types/expr.go
@@ -19,7 +19,6 @@ import (
// - at the moment, iota is passed around almost everywhere - in many places we know it cannot be used
// TODO(gri) API issues
-// - clients need access to result type information (tuples)
// - clients need access to constant values
// - clients need access to built-in type information
@@ -212,21 +211,11 @@ func (check *checker) unary(x *operand, op token.Token) {
}
if x.mode == constant {
- switch op {
- case token.ADD:
- // nothing to do
- case token.SUB:
- x.val = binaryOpConst(zeroConst, x.val, token.SUB, false)
- case token.XOR:
- x.val = binaryOpConst(minusOneConst, x.val, token.XOR, false)
- case token.NOT:
- x.val = !x.val.(bool)
- default:
- unreachable() // operators where checked by check.op
- }
+ typ := underlying(x.typ).(*Basic)
+ x.val = unaryOpConst(x.val, op, typ)
// Typed constants must be representable in
// their type after each constant operation.
- check.isRepresentable(x, underlying(x.typ).(*Basic))
+ check.isRepresentable(x, typ)
return
}
@@ -304,6 +293,8 @@ func (check *checker) convertUntyped(x *operand, target Type) {
if !x.isNil() {
goto Error
}
+ default:
+ unreachable()
}
x.typ = target
@@ -332,7 +323,7 @@ func (check *checker) comparison(x, y *operand, op token.Token) {
}
if !valid {
- check.invalidOp(x.pos(), "cannot compare %s and %s", x, y)
+ check.invalidOp(x.pos(), "cannot compare %s %s %s", x, op, y)
x.mode = invalid
return
}
@@ -465,10 +456,11 @@ func (check *checker) binary(x, y *operand, op token.Token, hint Type) {
}
if x.mode == constant && y.mode == constant {
- x.val = binaryOpConst(x.val, y.val, op, isInteger(x.typ))
+ typ := underlying(x.typ).(*Basic)
+ x.val = binaryOpConst(x.val, y.val, op, typ)
// Typed constants must be representable in
// their type after each constant operation.
- check.isRepresentable(x, underlying(x.typ).(*Basic))
+ check.isRepresentable(x, typ)
return
}
@@ -554,9 +546,15 @@ func (check *checker) indexedElts(elts []ast.Expr, typ Type, length int64, iota
return max
}
-func (check *checker) argument(sig *Signature, i int, arg ast.Expr) {
+// argument typechecks passing an argument arg (if arg != nil) or
+// x (if arg == nil) to the i'th parameter of the given signature.
+// If passSlice is set, the argument is followed by ... in the call.
+//
+func (check *checker) argument(sig *Signature, i int, arg ast.Expr, x *operand, passSlice bool) {
+ // determine parameter
var par *ast.Object
- if n := len(sig.Params); i < n {
+ n := len(sig.Params)
+ if i < n {
par = sig.Params[i]
} else if sig.IsVariadic {
par = sig.Params[n-1]
@@ -565,16 +563,32 @@ func (check *checker) argument(sig *Signature, i int, arg ast.Expr) {
return
}
- // TODO(gri) deal with ... last argument
- var z, x operand
+ // determine argument
+ var z operand
z.mode = variable
- z.expr = nil // TODO(gri) can we do better here?
- z.typ = par.Type.(Type) // TODO(gri) should become something like checkObj(&z, ...) eventually
- check.expr(&x, arg, z.typ, -1)
+ z.expr = nil // TODO(gri) can we do better here? (for good error messages)
+ z.typ = par.Type.(Type)
+
+ if arg != nil {
+ check.expr(x, arg, z.typ, -1)
+ }
if x.mode == invalid {
return // ignore this argument
}
- check.assignOperand(&z, &x)
+
+ // check last argument of the form x...
+ if passSlice {
+ if i+1 != n {
+ check.errorf(x.pos(), "can only use ... with matching parameter")
+ return // ignore this argument
+ }
+ // spec: "If the final argument is assignable to a slice type []T,
+ // it may be passed unchanged as the value for a ...T parameter if
+ // the argument is followed by ..."
+ z.typ = &Slice{Elt: z.typ} // change final parameter type to []T
+ }
+
+ check.assignOperand(&z, x)
}
func (check *checker) recordType(x *operand) {
@@ -584,7 +598,7 @@ func (check *checker) recordType(x *operand) {
}
// rawExpr typechecks expression e and initializes x with the expression
-// value or type. If an error occured, x.mode is set to invalid.
+// value or type. If an error occurred, x.mode is set to invalid.
// A hint != nil is used as operand type for untyped shifted operands;
// iota >= 0 indicates that the expression is part of a constant declaration.
// cycleOk indicates whether it is ok for a type expression to refer to itself.
@@ -653,7 +667,7 @@ func (check *checker) rawExpr(x *operand, e ast.Expr, hint Type, iota int, cycle
x.typ = obj.Type.(Type)
case *ast.Ellipsis:
- // ellipses are handled explictly where they are legal
+ // ellipses are handled explicitly where they are legal
// (array composite literals and parameter lists)
check.errorf(e.Pos(), "invalid use of '...'")
goto Error
@@ -1052,25 +1066,79 @@ func (check *checker) rawExpr(x *operand, e ast.Expr, hint Type, iota int, cycle
check.conversion(x, e, x.typ, iota)
} else if sig, ok := underlying(x.typ).(*Signature); ok {
// check parameters
- // TODO(gri)
- // - deal with single multi-valued function arguments: f(g())
- // - variadic functions only partially addressed
- for i, arg := range e.Args {
- check.argument(sig, i, arg)
+
+ // If we have a trailing ... at the end of the parameter
+ // list, the last argument must match the parameter type
+ // []T of a variadic function parameter x ...T.
+ passSlice := false
+ if e.Ellipsis.IsValid() {
+ if sig.IsVariadic {
+ passSlice = true
+ } else {
+ check.errorf(e.Ellipsis, "cannot use ... in call to %s", e.Fun)
+ // ok to continue
+ }
}
- // determine result
- x.mode = value
- if len(sig.Results) == 1 {
- x.typ = sig.Results[0].Type.(Type)
+ // If we have a single argument that is a function call
+ // we need to handle it separately. Determine if this
+ // is the case without checking the argument.
+ var call *ast.CallExpr
+ if len(e.Args) == 1 {
+ call, _ = unparen(e.Args[0]).(*ast.CallExpr)
+ }
+
+ n := 0 // parameter count
+ if call != nil {
+ // We have a single argument that is a function call.
+ check.expr(x, call, nil, -1)
+ if x.mode == invalid {
+ goto Error // TODO(gri): we can do better
+ }
+ if t, _ := x.typ.(*Result); t != nil {
+ // multiple result values
+ n = len(t.Values)
+ for i, obj := range t.Values {
+ x.mode = value
+ x.expr = nil // TODO(gri) can we do better here? (for good error messages)
+ x.typ = obj.Type.(Type)
+ check.argument(sig, i, nil, x, passSlice && i+1 == n)
+ }
+ } else {
+ // single result value
+ n = 1
+ check.argument(sig, 0, nil, x, passSlice)
+ }
+
} else {
- // TODO(gri) change Signature representation to use tuples,
- // then this conversion is not required
- list := make([]Type, len(sig.Results))
- for i, obj := range sig.Results {
- list[i] = obj.Type.(Type)
+ // We don't have a single argument or it is not a function call.
+ n = len(e.Args)
+ for i, arg := range e.Args {
+ check.argument(sig, i, arg, x, passSlice && i+1 == n)
}
- x.typ = &tuple{list: list}
+ }
+
+ // determine if we have enough arguments
+ if sig.IsVariadic {
+ // a variadic function accepts an "empty"
+ // last argument: count one extra
+ n++
+ }
+ if n < len(sig.Params) {
+ check.errorf(e.Fun.Pos(), "too few arguments in call to %s", e.Fun)
+ // ok to continue
+ }
+
+ // determine result
+ switch len(sig.Results) {
+ case 0:
+ x.mode = novalue
+ case 1:
+ x.mode = value
+ x.typ = sig.Results[0].Type.(Type)
+ default:
+ x.mode = value
+ x.typ = &Result{Values: sig.Results}
}
} else if bin, ok := x.typ.(*builtin); ok {
@@ -1216,14 +1284,14 @@ func (check *checker) rawTyp(e ast.Expr, cycleOk, nilOk bool) Type {
}
// typOrNil is like rawExpr but reports an error if e doesn't represents a type or the predeclared value nil.
-// It returns e's type, nil, or Typ[Invalid] if an error occured.
+// It returns e's type, nil, or Typ[Invalid] if an error occurred.
//
func (check *checker) typOrNil(e ast.Expr, cycleOk bool) Type {
return check.rawTyp(e, cycleOk, true)
}
// typ is like rawExpr but reports an error if e doesn't represents a type.
-// It returns e's type, or Typ[Invalid] if an error occured.
+// It returns e's type, or Typ[Invalid] if an error occurred.
//
func (check *checker) typ(e ast.Expr, cycleOk bool) Type {
return check.rawTyp(e, cycleOk, false)
diff --git a/libgo/go/exp/types/operand.go b/libgo/go/exp/types/operand.go
index 1a5e5172a8b..f8ddd84b542 100644
--- a/libgo/go/exp/types/operand.go
+++ b/libgo/go/exp/types/operand.go
@@ -182,7 +182,14 @@ func (x *operand) isAssignable(T Type) bool {
if isUntyped(Vu) {
switch t := Tu.(type) {
case *Basic:
- return x.mode == constant && isRepresentableConst(x.val, t.Kind)
+ if x.mode == constant {
+ return isRepresentableConst(x.val, t.Kind)
+ }
+ // The result of a comparison is an untyped boolean,
+ // but may not be a constant.
+ if Vb, _ := Vu.(*Basic); Vb != nil {
+ return Vb.Kind == UntypedBool && isBoolean(Tu)
+ }
case *Interface:
return x.isNil() || len(t.Methods) == 0
case *Pointer, *Signature, *Slice, *Map, *Chan:
diff --git a/libgo/go/exp/types/predicates.go b/libgo/go/exp/types/predicates.go
index 2c1a99192aa..ff6825ba3b4 100644
--- a/libgo/go/exp/types/predicates.go
+++ b/libgo/go/exp/types/predicates.go
@@ -225,25 +225,28 @@ func deref(typ Type) Type {
}
// defaultType returns the default "typed" type for an "untyped" type;
-// it returns the argument typ for all other types.
+// it returns the incoming type for all other types. If there is no
+// corresponding untyped type, the result is Typ[Invalid].
+//
func defaultType(typ Type) Type {
if t, ok := typ.(*Basic); ok {
- var k BasicKind
+ k := Invalid
switch t.Kind {
+ // case UntypedNil:
+ // There is no default type for nil. For a good error message,
+ // catch this case before calling this function.
case UntypedBool:
k = Bool
- case UntypedRune:
- k = Rune
case UntypedInt:
k = Int
+ case UntypedRune:
+ k = Rune
case UntypedFloat:
k = Float64
case UntypedComplex:
k = Complex128
case UntypedString:
k = String
- default:
- unreachable()
}
typ = Typ[k]
}
diff --git a/libgo/go/exp/types/stmt.go b/libgo/go/exp/types/stmt.go
index e2c6448deba..7f9d45eb987 100644
--- a/libgo/go/exp/types/stmt.go
+++ b/libgo/go/exp/types/stmt.go
@@ -12,9 +12,9 @@ import (
)
func (check *checker) assignOperand(z, x *operand) {
- if t, ok := x.typ.(*tuple); ok {
+ if t, ok := x.typ.(*Result); ok {
// TODO(gri) elsewhere we use "assignment count mismatch" (consolidate)
- check.errorf(x.pos(), "%d-valued expression %s used as single value", len(t.list), x)
+ check.errorf(x.pos(), "%d-valued expression %s used as single value", len(t.Values), x)
x.mode = invalid
return
}
@@ -95,7 +95,12 @@ func (check *checker) assign1to1(lhs, rhs ast.Expr, x *operand, decl bool, iota
if x.mode != invalid {
typ = x.typ
if obj.Kind == ast.Var && isUntyped(typ) {
- typ = defaultType(typ)
+ if x.isNil() {
+ check.errorf(x.pos(), "use of untyped nil")
+ x.mode = invalid
+ } else {
+ typ = defaultType(typ)
+ }
}
}
obj.Type = typ
@@ -177,12 +182,12 @@ func (check *checker) assignNtoM(lhs, rhs []ast.Expr, decl bool, iota int) {
return
}
- if t, ok := x.typ.(*tuple); ok && len(lhs) == len(t.list) {
+ if t, ok := x.typ.(*Result); ok && len(lhs) == len(t.Values) {
// function result
x.mode = value
- for i, typ := range t.list {
+ for i, obj := range t.Values {
x.expr = nil // TODO(gri) should do better here
- x.typ = typ
+ x.typ = obj.Type.(Type)
check.assign1to1(lhs[i], nil, &x, decl, iota)
}
return
@@ -427,25 +432,58 @@ func (check *checker) stmt(s ast.Stmt) {
case *ast.SwitchStmt:
check.optionalStmt(s.Init)
var x operand
- if s.Tag != nil {
- check.expr(&x, s.Tag, nil, -1)
- } else {
- // TODO(gri) should provide a position (see IncDec) for good error messages
- x.mode = constant
- x.typ = Typ[UntypedBool]
- x.val = true
+ tag := s.Tag
+ if tag == nil {
+ // use fake true tag value and position it at the opening { of the switch
+ tag = &ast.Ident{NamePos: s.Body.Lbrace, Name: "true", Obj: Universe.Lookup("true")}
}
+ check.expr(&x, tag, nil, -1)
check.multipleDefaults(s.Body.List)
+ seen := make(map[interface{}]token.Pos)
for _, s := range s.Body.List {
clause, _ := s.(*ast.CaseClause)
if clause == nil {
continue // error reported before
}
- for _, expr := range clause.List {
- var y operand
- check.expr(&y, expr, nil, -1)
- // TODO(gri) x and y must be comparable
+ if x.mode != invalid {
+ for _, expr := range clause.List {
+ x := x // copy of x (don't modify original)
+ var y operand
+ check.expr(&y, expr, nil, -1)
+ if y.mode == invalid {
+ continue // error reported before
+ }
+ // If we have a constant case value, it must appear only
+ // once in the switch statement. Determine if there is a
+ // duplicate entry, but only report an error if there are
+ // no other errors.
+ var dupl token.Pos
+ if y.mode == constant {
+ // TODO(gri) This code doesn't work correctly for
+ // large integer, floating point, or
+ // complex values - the respective struct
+ // comparisons are shallow. Need to use a
+ // hash function to index the map.
+ dupl = seen[y.val]
+ seen[y.val] = y.pos()
+ }
+ // TODO(gri) The convertUntyped call pair below appears in other places. Factor!
+ // Order matters: By comparing y against x, error positions are at the case values.
+ check.convertUntyped(&y, x.typ)
+ if y.mode == invalid {
+ continue // error reported before
+ }
+ check.convertUntyped(&x, y.typ)
+ if x.mode == invalid {
+ continue // error reported before
+ }
+ check.comparison(&y, &x, token.EQL)
+ if y.mode != invalid && dupl.IsValid() {
+ check.errorf(y.pos(), "%s is duplicate case (previous at %s)",
+ &y, check.fset.Position(dupl))
+ }
+ }
}
check.stmtList(clause.Body)
}
diff --git a/libgo/go/exp/types/testdata/builtins.src b/libgo/go/exp/types/testdata/builtins.src
index a07af89f414..a9518530dec 100644
--- a/libgo/go/exp/types/testdata/builtins.src
+++ b/libgo/go/exp/types/testdata/builtins.src
@@ -46,10 +46,33 @@ func _close() {
}
func _complex() {
- _0 := complex /* ERROR "argument" */ ()
- _1 := complex /* ERROR "argument" */ (1)
- _2 := complex(1, 2)
- // TODO(gri) add tests checking types
+ var i32 int32
+ var f32 float32
+ var f64 float64
+ var c64 complex64
+ _ = complex /* ERROR "argument" */ ()
+ _ = complex /* ERROR "argument" */ (1)
+ _ = complex(true /* ERROR "invalid argument" */ , 0)
+ _ = complex(i32 /* ERROR "invalid argument" */ , 0)
+ _ = complex("foo" /* ERROR "invalid argument" */ , 0)
+ _ = complex(c64 /* ERROR "invalid argument" */ , 0)
+ _ = complex(0, true /* ERROR "invalid argument" */ )
+ _ = complex(0, i32 /* ERROR "invalid argument" */ )
+ _ = complex(0, "foo" /* ERROR "invalid argument" */ )
+ _ = complex(0, c64 /* ERROR "invalid argument" */ )
+ _ = complex(f32, f32)
+ _ = complex(f32, 1)
+ _ = complex(f32, 1.0)
+ _ = complex(f32, 'a')
+ _ = complex(f64, f64)
+ _ = complex(f64, 1)
+ _ = complex(f64, 1.0)
+ _ = complex(f64, 'a')
+ _ = complex(f32 /* ERROR "mismatched types" */, f64)
+ _ = complex(f64 /* ERROR "mismatched types" */, f32)
+ _ = complex(1, 1)
+ _ = complex(1, 1.1)
+ _ = complex(1, 'a')
complex /* ERROR "not used" */ (1, 2)
}
diff --git a/libgo/go/exp/types/testdata/decls1.src b/libgo/go/exp/types/testdata/decls1.src
index be927091c1b..3baed67505c 100644
--- a/libgo/go/exp/types/testdata/decls1.src
+++ b/libgo/go/exp/types/testdata/decls1.src
@@ -46,7 +46,7 @@ var (
s14 = i << j /* ERROR "must be unsigned" */
s18 = math.Pi * 10.0
s19 = s1 /* ERROR "cannot call" */ ()
- s20 = f0 /* ERROR "used as single value" */ ()
+ s20 = f0 /* ERROR "no value" */ ()
s21 = f6(1, s1, i)
s22 = f6(1, s1, uu /* ERROR "cannot assign" */ )
@@ -68,7 +68,7 @@ var (
t17 math /* ERROR "not a type" */ .Pi
t18 float64 = math.Pi * 10.0
t19 int = t1 /* ERROR "cannot call" */ ()
- t20 int = f0 /* ERROR "used as single value" */ ()
+ t20 int = f0 /* ERROR "no value" */ ()
)
// Various more complex expressions
@@ -94,6 +94,7 @@ var (
v10 byte = 1024 /* ERROR "overflows" */
v11 = xx/yy*yy - xx
v12 = true && false
+ v13 = nil /* ERROR "use of untyped nil" */
)
// Multiple assignment expressions
diff --git a/libgo/go/exp/types/testdata/expr0.src b/libgo/go/exp/types/testdata/expr0.src
index 0ed314a95cf..8b2eb04f292 100644
--- a/libgo/go/exp/types/testdata/expr0.src
+++ b/libgo/go/exp/types/testdata/expr0.src
@@ -63,6 +63,7 @@ var (
u16 = &u0
u17 = *u16
u18 = <-u16 /* ERROR "cannot receive" */
+ u19 = ^uint(0)
// float64
f0 = float64(1)
@@ -131,5 +132,4 @@ var (
ch7 = <-ch
ch8 = <-rc
ch9 = <-sc /* ERROR "cannot receive" */
-
-) \ No newline at end of file
+)
diff --git a/libgo/go/exp/types/testdata/expr2.src b/libgo/go/exp/types/testdata/expr2.src
index 4bc2769651b..674be4005dd 100644
--- a/libgo/go/exp/types/testdata/expr2.src
+++ b/libgo/go/exp/types/testdata/expr2.src
@@ -6,6 +6,17 @@
package expr2
+func _bool() {
+ const t = true == true
+ const f = true == false
+ _ = t /* ERROR "cannot compare" */ < f
+ _ = 0 /* ERROR "cannot convert" */ == t
+ var b bool
+ var x, y float32
+ b = x < y
+ _ = struct{b bool}{x < y}
+}
+
// corner cases
var (
v0 = nil /* ERROR "cannot compare" */ == nil
diff --git a/libgo/go/exp/types/testdata/expr3.src b/libgo/go/exp/types/testdata/expr3.src
index a5ea4d2b82e..35905c49720 100644
--- a/libgo/go/exp/types/testdata/expr3.src
+++ b/libgo/go/exp/types/testdata/expr3.src
@@ -286,3 +286,64 @@ func type_asserts() {
_ = t.(T2 /* ERROR "wrong type for method m" */ )
_ = t.(I2 /* ERROR "wrong type for method m" */ )
}
+
+func f0() {}
+func f1(x int) {}
+func f2(u float32, s string) {}
+func fs(s []byte) {}
+func fv(x ...int) {}
+func fi(x ... interface{}) {}
+
+func g0() {}
+func g1() int { return 0}
+func g2() (u float32, s string) { return }
+func gs() []byte { return nil }
+
+func _calls() {
+ var x int
+ var y float32
+ var s []int
+
+ f0()
+ _ = f0 /* ERROR "used as value" */ ()
+ f0(g0 /* ERROR "too many arguments" */ )
+
+ f1(0)
+ f1(x)
+ f1(10.0)
+ f1 /* ERROR "too few arguments" */ ()
+ f1(x, y /* ERROR "too many arguments" */ )
+ f1(s /* ERROR "cannot assign" */ )
+ f1(x ... /* ERROR "cannot use ..." */ )
+ f1(g0 /* ERROR "used as value" */ ())
+ f1(g1())
+ // f1(g2()) // TODO(gri) missing position in error message
+
+ f2 /* ERROR "too few arguments" */ ()
+ f2 /* ERROR "too few arguments" */ (3.14)
+ f2(3.14, "foo")
+ f2(x /* ERROR "cannot assign" */ , "foo")
+ f2(g0 /* ERROR "used as value" */ ())
+ f2 /* ERROR "too few arguments" */ (g1 /* ERROR "cannot assign" */ ())
+ f2(g2())
+
+ fs /* ERROR "too few arguments" */ ()
+ fs(g0 /* ERROR "used as value" */ ())
+ fs(g1 /* ERROR "cannot assign" */ ())
+ // fs(g2()) // TODO(gri) missing position in error message
+ fs(gs())
+
+ fv()
+ fv(1, 2.0, x)
+ fv(s /* ERROR "cannot assign" */ )
+ fv(s...)
+ fv(1, s /* ERROR "can only use ... with matching parameter" */ ...)
+ fv(gs /* ERROR "cannot assign" */ ())
+ fv(gs /* ERROR "cannot assign" */ ()...)
+
+ fi()
+ fi(1, 2.0, x, 3.14, "foo")
+ fi(g2())
+ fi(0, g2)
+ fi(0, g2 /* ERROR "2-valued expression" */ ())
+} \ No newline at end of file
diff --git a/libgo/go/exp/types/testdata/stmt0.src b/libgo/go/exp/types/testdata/stmt0.src
index d3cc3acce4f..c0e023671bc 100644
--- a/libgo/go/exp/types/testdata/stmt0.src
+++ b/libgo/go/exp/types/testdata/stmt0.src
@@ -101,7 +101,31 @@ func _switches() {
default /* ERROR "multiple defaults" */ :
}
- // TODO(gri) more tests
+ switch {
+ case 1 /* ERROR "cannot convert" */ :
+ }
+
+ switch int32(x) {
+ case 1, 2:
+ case x /* ERROR "cannot compare" */ :
+ }
+
+ switch x {
+ case 1 /* ERROR "overflows int" */ << 100:
+ }
+
+ switch x {
+ case 1:
+ case 1 /* ERROR "duplicate case" */ :
+ case 2, 3, 4:
+ case 1 /* ERROR "duplicate case" */ :
+ }
+
+ // TODO(gri) duplicate 64bit values that don't fit into an int64 are not yet detected
+ switch uint64(x) {
+ case 1<<64-1:
+ case 1<<64-1:
+ }
}
type I interface {
diff --git a/libgo/go/exp/types/types.go b/libgo/go/exp/types/types.go
index 83a08266dd3..6e4a98783ee 100644
--- a/libgo/go/exp/types/types.go
+++ b/libgo/go/exp/types/types.go
@@ -141,15 +141,15 @@ type Pointer struct {
Base Type
}
-// A tuple represents a multi-value function return.
-// TODO(gri) use better name to avoid confusion (Go doesn't have tuples).
-type tuple struct {
+// A Result represents a (multi-value) function call result.
+// TODO(gri) consider using an empty Result (Values == nil)
+// as representation for the novalue operand mode.
+type Result struct {
implementsType
- list []Type
+ Values ObjList // Signature.Results of the function called
}
// A Signature represents a user-defined function type func(...) (...).
-// TODO(gri) consider using "tuples" to represent parameters and results (see comment on tuples).
type Signature struct {
implementsType
Recv *ast.Object // nil if not a method
diff --git a/libgo/go/exp/types/types_test.go b/libgo/go/exp/types/types_test.go
index 62ca19badca..361f63634e5 100644
--- a/libgo/go/exp/types/types_test.go
+++ b/libgo/go/exp/types/types_test.go
@@ -155,7 +155,7 @@ var testExprs = []testEntry{
dup("-f(10, 20)"),
dup("f(x + y, +3.1415)"),
{"func(a, b int) {}", "(func literal)"},
- {"func(a, b int) []int {}()[x]", "(func literal)()[x]"},
+ {"func(a, b int) []int {}(1, 2)[x]", "(func literal)(1, 2)[x]"},
{"[]int{1, 2, 3}", "(composite literal)"},
{"[]int{1, 2, 3}[x:]", "(composite literal)[x:]"},
{"i.([]string)", "i.(...)"},
diff --git a/libgo/go/fmt/fmt_test.go b/libgo/go/fmt/fmt_test.go
index 34061135a11..ab064658d7c 100644
--- a/libgo/go/fmt/fmt_test.go
+++ b/libgo/go/fmt/fmt_test.go
@@ -476,6 +476,11 @@ var fmttests = []struct {
// Used to crash because nByte didn't allow for a sign.
{"%b", int64(-1 << 63), "-1000000000000000000000000000000000000000000000000000000000000000"},
+
+ // Complex fmt used to leave the plus flag set for future entries in the array
+ // causing +2+0i and +3+0i instead of 2+0i and 3+0i.
+ {"%v", []complex64{1, 2, 3}, "[(1+0i) (2+0i) (3+0i)]"},
+ {"%v", []complex128{1, 2, 3}, "[(1+0i) (2+0i) (3+0i)]"},
}
func TestSprintf(t *testing.T) {
diff --git a/libgo/go/fmt/format.go b/libgo/go/fmt/format.go
index ce801162d6e..c3d7605fe8e 100644
--- a/libgo/go/fmt/format.go
+++ b/libgo/go/fmt/format.go
@@ -396,7 +396,7 @@ func (f *fmt) fmt_f64(v float64) { f.formatFloat(v, 'f', doPrec(f, 6), 64) }
// fmt_g64 formats a float64 in the 'f' or 'e' form according to size.
func (f *fmt) fmt_g64(v float64) { f.formatFloat(v, 'g', doPrec(f, -1), 64) }
-// fmt_g64 formats a float64 in the 'f' or 'E' form according to size.
+// fmt_G64 formats a float64 in the 'f' or 'E' form according to size.
func (f *fmt) fmt_G64(v float64) { f.formatFloat(v, 'G', doPrec(f, -1), 64) }
// fmt_fb64 formats a float64 in the form -123p3 (exponent is power of 2).
@@ -428,6 +428,7 @@ func (f *fmt) fmt_fb32(v float32) { f.formatFloat(float64(v), 'b', 0, 32) }
func (f *fmt) fmt_c64(v complex64, verb rune) {
f.buf.WriteByte('(')
r := real(v)
+ oldPlus := f.plus
for i := 0; ; i++ {
switch verb {
case 'e':
@@ -447,6 +448,7 @@ func (f *fmt) fmt_c64(v complex64, verb rune) {
f.plus = true
r = imag(v)
}
+ f.plus = oldPlus
f.buf.Write(irparenBytes)
}
@@ -454,6 +456,7 @@ func (f *fmt) fmt_c64(v complex64, verb rune) {
func (f *fmt) fmt_c128(v complex128, verb rune) {
f.buf.WriteByte('(')
r := real(v)
+ oldPlus := f.plus
for i := 0; ; i++ {
switch verb {
case 'e':
@@ -473,5 +476,6 @@ func (f *fmt) fmt_c128(v complex128, verb rune) {
f.plus = true
r = imag(v)
}
+ f.plus = oldPlus
f.buf.Write(irparenBytes)
}
diff --git a/libgo/go/fmt/scan.go b/libgo/go/fmt/scan.go
index 62de3a2efa6..6a282c81f1d 100644
--- a/libgo/go/fmt/scan.go
+++ b/libgo/go/fmt/scan.go
@@ -337,7 +337,10 @@ func (r *readRune) readByte() (b byte, err error) {
r.pending--
return
}
- _, err = r.reader.Read(r.pendBuf[0:1])
+ n, err := io.ReadFull(r.reader, r.pendBuf[0:1])
+ if n != 1 {
+ return 0, err
+ }
return r.pendBuf[0], err
}
diff --git a/libgo/go/go/ast/ast.go b/libgo/go/go/ast/ast.go
index e1582c30064..bf533d1d24f 100644
--- a/libgo/go/go/ast/ast.go
+++ b/libgo/go/go/ast/ast.go
@@ -555,7 +555,7 @@ type (
// A DeclStmt node represents a declaration in a statement list.
DeclStmt struct {
- Decl Decl
+ Decl Decl // *GenDecl with CONST, TYPE, or VAR token
}
// An EmptyStmt node represents an empty statement.
diff --git a/libgo/go/go/build/build.go b/libgo/go/go/build/build.go
index e65d8453bc9..a1644256819 100644
--- a/libgo/go/go/build/build.go
+++ b/libgo/go/go/build/build.go
@@ -222,6 +222,8 @@ var cgoEnabled = map[string]bool{
"linux/arm": true,
"netbsd/386": true,
"netbsd/amd64": true,
+ "openbsd/386": true,
+ "openbsd/amd64": true,
"windows/386": true,
"windows/amd64": true,
}
@@ -424,6 +426,13 @@ func (ctxt *Context) Import(path string, srcDir string, mode ImportMode) (*Packa
if strings.HasPrefix(path, "/") {
return p, fmt.Errorf("import %q: cannot import absolute path", path)
}
+
+ // tried records the location of unsucsessful package lookups
+ var tried struct {
+ goroot string
+ gopath []string
+ }
+
// Determine directory from import path.
if ctxt.GOROOT != "" {
dir := ctxt.joinPath(ctxt.GOROOT, "src", "pkg", path)
@@ -435,6 +444,7 @@ func (ctxt *Context) Import(path string, srcDir string, mode ImportMode) (*Packa
p.Root = ctxt.GOROOT
goto Found
}
+ tried.goroot = dir
}
for _, root := range ctxt.gopath() {
dir := ctxt.joinPath(root, "src", path)
@@ -445,8 +455,28 @@ func (ctxt *Context) Import(path string, srcDir string, mode ImportMode) (*Packa
p.Root = root
goto Found
}
+ tried.gopath = append(tried.gopath, dir)
+ }
+
+ // package was not found
+ var paths []string
+ if tried.goroot != "" {
+ paths = append(paths, fmt.Sprintf("\t%s (from $GOROOT)", tried.goroot))
+ } else {
+ paths = append(paths, "\t($GOROOT not set)")
+ }
+ var i int
+ var format = "\t%s (from $GOPATH)"
+ for ; i < len(tried.gopath); i++ {
+ if i > 0 {
+ format = "\t%s"
+ }
+ paths = append(paths, fmt.Sprintf(format, tried.gopath[i]))
+ }
+ if i == 0 {
+ paths = append(paths, "\t($GOPATH not set)")
}
- return p, fmt.Errorf("import %q: cannot find package", path)
+ return p, fmt.Errorf("cannot find package %q in any of:\n%s", path, strings.Join(paths, "\n"))
}
Found:
diff --git a/libgo/go/go/doc/comment.go b/libgo/go/go/doc/comment.go
index 51e2bf73243..c4b7e6ae6e1 100644
--- a/libgo/go/go/doc/comment.go
+++ b/libgo/go/go/doc/comment.go
@@ -229,7 +229,8 @@ type block struct {
var nonAlphaNumRx = regexp.MustCompile(`[^a-zA-Z0-9]`)
func anchorID(line string) string {
- return nonAlphaNumRx.ReplaceAllString(line, "_")
+ // Add a "hdr-" prefix to avoid conflicting with IDs used for package symbols.
+ return "hdr-" + nonAlphaNumRx.ReplaceAllString(line, "_")
}
// ToHTML converts comment text to formatted HTML.
diff --git a/libgo/go/go/doc/example.go b/libgo/go/go/doc/example.go
index e5752bb15a1..9fc0b415f0d 100644
--- a/libgo/go/go/doc/example.go
+++ b/libgo/go/go/doc/example.go
@@ -119,8 +119,29 @@ func playExample(file *ast.File, body *ast.BlockStmt) *ast.File {
return nil
}
- // Find unresolved identifiers
+ // Find top-level declarations in the file.
+ topDecls := make(map[*ast.Object]bool)
+ for _, decl := range file.Decls {
+ switch d := decl.(type) {
+ case *ast.FuncDecl:
+ topDecls[d.Name.Obj] = true
+ case *ast.GenDecl:
+ for _, spec := range d.Specs {
+ switch s := spec.(type) {
+ case *ast.TypeSpec:
+ topDecls[s.Name.Obj] = true
+ case *ast.ValueSpec:
+ for _, id := range s.Names {
+ topDecls[id.Obj] = true
+ }
+ }
+ }
+ }
+ }
+
+ // Find unresolved identifiers and uses of top-level declarations.
unresolved := make(map[string]bool)
+ usesTopDecl := false
ast.Inspect(body, func(n ast.Node) bool {
// For an expression like fmt.Println, only add "fmt" to the
// set of unresolved names.
@@ -130,11 +151,19 @@ func playExample(file *ast.File, body *ast.BlockStmt) *ast.File {
}
return false
}
- if id, ok := n.(*ast.Ident); ok && id.Obj == nil {
- unresolved[id.Name] = true
+ if id, ok := n.(*ast.Ident); ok {
+ if id.Obj == nil {
+ unresolved[id.Name] = true
+ } else if topDecls[id.Obj] {
+ usesTopDecl = true
+ }
}
return true
})
+ if usesTopDecl {
+ // We don't support examples that are not self-contained (yet).
+ return nil
+ }
// Remove predeclared identifiers from unresolved list.
for n := range unresolved {
diff --git a/libgo/go/go/format/format.go b/libgo/go/go/format/format.go
index 286296ebc6f..65b0e4e4b79 100644
--- a/libgo/go/go/format/format.go
+++ b/libgo/go/go/format/format.go
@@ -46,7 +46,7 @@ func Node(dst io.Writer, fset *token.FileSet, node interface{}) error {
// Sort imports if necessary.
if file != nil && hasUnsortedImports(file) {
// Make a copy of the AST because ast.SortImports is destructive.
- // TODO(gri) Do this more efficently.
+ // TODO(gri) Do this more efficiently.
var buf bytes.Buffer
err := config.Fprint(&buf, fset, file)
if err != nil {
diff --git a/libgo/go/go/printer/nodes.go b/libgo/go/go/printer/nodes.go
index cd5b67b82df..3bed0cc6572 100644
--- a/libgo/go/go/printer/nodes.go
+++ b/libgo/go/go/printer/nodes.go
@@ -83,7 +83,7 @@ func (p *printer) setComment(g *ast.CommentGroup) {
// don't overwrite any pending comment in the p.comment cache
// (there may be a pending comment when a line comment is
// immediately followed by a lead comment with no other
- // tokens inbetween)
+ // tokens between)
if p.commentOffset == infinity {
p.nextComment() // get comment ready for use
}
diff --git a/libgo/go/go/token/position.go b/libgo/go/go/token/position.go
index fc45c1e7693..f5d99956186 100644
--- a/libgo/go/go/token/position.go
+++ b/libgo/go/go/token/position.go
@@ -295,9 +295,9 @@ type FileSet struct {
// NewFileSet creates a new file set.
func NewFileSet() *FileSet {
- s := new(FileSet)
- s.base = 1 // 0 == NoPos
- return s
+ return &FileSet{
+ base: 1, // 0 == NoPos
+ }
}
// Base returns the minimum base offset that must be provided to
@@ -367,8 +367,10 @@ func searchFiles(a []*File, x int) int {
}
func (s *FileSet) file(p Pos) *File {
+ s.mutex.RLock()
// common case: p is in last file
if f := s.last; f != nil && f.base <= int(p) && int(p) <= f.base+f.size {
+ s.mutex.RUnlock()
return f
}
// p is not in last file - search all files
@@ -376,10 +378,14 @@ func (s *FileSet) file(p Pos) *File {
f := s.files[i]
// f.base <= int(p) by definition of searchFiles
if int(p) <= f.base+f.size {
- s.last = f
+ s.mutex.RUnlock()
+ s.mutex.Lock()
+ s.last = f // race is ok - s.last is only a cache
+ s.mutex.Unlock()
return f
}
}
+ s.mutex.RUnlock()
return nil
}
@@ -389,9 +395,7 @@ func (s *FileSet) file(p Pos) *File {
//
func (s *FileSet) File(p Pos) (f *File) {
if p != NoPos {
- s.mutex.RLock()
f = s.file(p)
- s.mutex.RUnlock()
}
return
}
@@ -399,11 +403,9 @@ func (s *FileSet) File(p Pos) (f *File) {
// Position converts a Pos in the fileset into a general Position.
func (s *FileSet) Position(p Pos) (pos Position) {
if p != NoPos {
- s.mutex.RLock()
if f := s.file(p); f != nil {
pos = f.position(p)
}
- s.mutex.RUnlock()
}
return
}
diff --git a/libgo/go/go/token/position_test.go b/libgo/go/go/token/position_test.go
index 160107df407..1d36c22268d 100644
--- a/libgo/go/go/token/position_test.go
+++ b/libgo/go/go/token/position_test.go
@@ -6,6 +6,8 @@ package token
import (
"fmt"
+ "math/rand"
+ "sync"
"testing"
)
@@ -179,3 +181,52 @@ func TestFiles(t *testing.T) {
}
}
}
+
+// FileSet.File should return nil if Pos is past the end of the FileSet.
+func TestFileSetPastEnd(t *testing.T) {
+ fset := NewFileSet()
+ for _, test := range tests {
+ fset.AddFile(test.filename, fset.Base(), test.size)
+ }
+ if f := fset.File(Pos(fset.Base())); f != nil {
+ t.Errorf("expected nil, got %v", f)
+ }
+}
+
+func TestFileSetCacheUnlikely(t *testing.T) {
+ fset := NewFileSet()
+ offsets := make(map[string]int)
+ for _, test := range tests {
+ offsets[test.filename] = fset.Base()
+ fset.AddFile(test.filename, fset.Base(), test.size)
+ }
+ for file, pos := range offsets {
+ f := fset.File(Pos(pos))
+ if f.Name() != file {
+ t.Errorf("expecting %q at position %d, got %q", file, pos, f.Name())
+ }
+ }
+}
+
+// issue 4345. Test concurrent use of FileSet.Pos does not trigger a
+// race in the FileSet position cache.
+func TestFileSetRace(t *testing.T) {
+ fset := NewFileSet()
+ for i := 0; i < 100; i++ {
+ fset.AddFile(fmt.Sprintf("file-%d", i), fset.Base(), 1031)
+ }
+ max := int32(fset.Base())
+ var stop sync.WaitGroup
+ r := rand.New(rand.NewSource(7))
+ for i := 0; i < 2; i++ {
+ r := rand.New(rand.NewSource(r.Int63()))
+ stop.Add(1)
+ go func() {
+ for i := 0; i < 1000; i++ {
+ fset.Position(Pos(r.Int31n(max)))
+ }
+ stop.Done()
+ }()
+ }
+ stop.Wait()
+}
diff --git a/libgo/go/image/image_test.go b/libgo/go/image/image_test.go
index 2b3f1493fb8..2656757ae9e 100644
--- a/libgo/go/image/image_test.go
+++ b/libgo/go/image/image_test.go
@@ -10,7 +10,7 @@ import (
"testing"
)
-type image interface {
+type timage interface {
Image
Opaque() bool
Set(int, int, color.Color)
@@ -24,7 +24,7 @@ func cmp(t *testing.T, cm color.Model, c0, c1 color.Color) bool {
}
func TestImage(t *testing.T) {
- testImage := []image{
+ testImage := []timage{
NewRGBA(Rect(0, 0, 10, 10)),
NewRGBA64(Rect(0, 0, 10, 10)),
NewNRGBA(Rect(0, 0, 10, 10)),
@@ -52,11 +52,11 @@ func TestImage(t *testing.T) {
t.Errorf("%T: at (6, 3), want a non-zero color, got %v", m, m.At(6, 3))
continue
}
- if !m.SubImage(Rect(6, 3, 7, 4)).(image).Opaque() {
+ if !m.SubImage(Rect(6, 3, 7, 4)).(timage).Opaque() {
t.Errorf("%T: at (6, 3) was not opaque", m)
continue
}
- m = m.SubImage(Rect(3, 2, 9, 8)).(image)
+ m = m.SubImage(Rect(3, 2, 9, 8)).(timage)
if !Rect(3, 2, 9, 8).Eq(m.Bounds()) {
t.Errorf("%T: sub-image want bounds %v, got %v", m, Rect(3, 2, 9, 8), m.Bounds())
continue
@@ -97,7 +97,7 @@ func Test16BitsPerColorChannel(t *testing.T) {
continue
}
}
- testImage := []image{
+ testImage := []timage{
NewRGBA64(Rect(0, 0, 10, 10)),
NewNRGBA64(Rect(0, 0, 10, 10)),
NewAlpha16(Rect(0, 0, 10, 10)),
diff --git a/libgo/go/io/io.go b/libgo/go/io/io.go
index bddb701786b..859adaf1b71 100644
--- a/libgo/go/io/io.go
+++ b/libgo/go/io/io.go
@@ -468,6 +468,11 @@ func (s *SectionReader) ReadAt(p []byte, off int64) (n int, err error) {
off += s.base
if max := s.limit - off; int64(len(p)) > max {
p = p[0:max]
+ n, err = s.r.ReadAt(p, off)
+ if err == nil {
+ err = EOF
+ }
+ return n, err
}
return s.r.ReadAt(p, off)
}
diff --git a/libgo/go/io/io_test.go b/libgo/go/io/io_test.go
index 1e671b59b33..f3ec050fad9 100644
--- a/libgo/go/io/io_test.go
+++ b/libgo/go/io/io_test.go
@@ -203,3 +203,35 @@ func TestTeeReader(t *testing.T) {
t.Errorf("closed tee: ReadFull(r, dst) = %d, %v; want 0, EPIPE", n, err)
}
}
+
+func TestSectionReader_ReadAt(tst *testing.T) {
+ dat := "a long sample data, 1234567890"
+ tests := []struct {
+ data string
+ off int
+ n int
+ bufLen int
+ at int
+ exp string
+ err error
+ }{
+ {data: "", off: 0, n: 10, bufLen: 2, at: 0, exp: "", err: EOF},
+ {data: dat, off: 0, n: len(dat), bufLen: 0, at: 0, exp: "", err: nil},
+ {data: dat, off: len(dat), n: 1, bufLen: 1, at: 0, exp: "", err: EOF},
+ {data: dat, off: 0, n: len(dat) + 2, bufLen: len(dat), at: 0, exp: dat, err: nil},
+ {data: dat, off: 0, n: len(dat), bufLen: len(dat) / 2, at: 0, exp: dat[:len(dat)/2], err: nil},
+ {data: dat, off: 0, n: len(dat), bufLen: len(dat), at: 0, exp: dat, err: nil},
+ {data: dat, off: 0, n: len(dat), bufLen: len(dat) / 2, at: 2, exp: dat[2 : 2+len(dat)/2], err: nil},
+ {data: dat, off: 3, n: len(dat), bufLen: len(dat) / 2, at: 2, exp: dat[5 : 5+len(dat)/2], err: nil},
+ {data: dat, off: 3, n: len(dat) / 2, bufLen: len(dat)/2 - 2, at: 2, exp: dat[5 : 5+len(dat)/2-2], err: nil},
+ {data: dat, off: 3, n: len(dat) / 2, bufLen: len(dat)/2 + 2, at: 2, exp: dat[5 : 5+len(dat)/2-2], err: EOF},
+ }
+ for i, t := range tests {
+ r := strings.NewReader(t.data)
+ s := NewSectionReader(r, int64(t.off), int64(t.n))
+ buf := make([]byte, t.bufLen)
+ if n, err := s.ReadAt(buf, int64(t.at)); n != len(t.exp) || string(buf[:n]) != t.exp || err != t.err {
+ tst.Fatalf("%d: ReadAt(%d) = %q, %v; expected %q, %v", i, t.at, buf[:n], err, t.exp, t.err)
+ }
+ }
+}
diff --git a/libgo/go/log/syslog/syslog_test.go b/libgo/go/log/syslog/syslog_test.go
index 4c0bf1f4e7c..67d7103ee44 100644
--- a/libgo/go/log/syslog/syslog_test.go
+++ b/libgo/go/log/syslog/syslog_test.go
@@ -20,13 +20,14 @@ var serverAddr string
func runSyslog(c net.PacketConn, done chan<- string) {
var buf [4096]byte
- var rcvd string = ""
+ var rcvd string
for {
- n, _, err := c.ReadFrom(buf[0:])
- if err != nil || n == 0 {
+ c.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
+ n, _, err := c.ReadFrom(buf[:])
+ rcvd += string(buf[:n])
+ if err != nil {
break
}
- rcvd += string(buf[0:n])
}
done <- rcvd
}
@@ -37,7 +38,6 @@ func startServer(done chan<- string) {
log.Fatalf("net.ListenPacket failed udp :0 %v", e)
}
serverAddr = c.LocalAddr().String()
- c.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
go runSyslog(c, done)
}
diff --git a/libgo/go/math/all_test.go b/libgo/go/math/all_test.go
index cdea8035f9a..0d8b10f67fa 100644
--- a/libgo/go/math/all_test.go
+++ b/libgo/go/math/all_test.go
@@ -2281,6 +2281,13 @@ func TestLog2(t *testing.T) {
t.Errorf("Log2(%g) = %g, want %g", vflogSC[i], f, logSC[i])
}
}
+ for i := -1074; i <= 1023; i++ {
+ f := Ldexp(1, i)
+ l := Log2(f)
+ if l != float64(i) {
+ t.Errorf("Log2(2**%d) = %g, want %d", i, l, i)
+ }
+ }
}
func TestModf(t *testing.T) {
diff --git a/libgo/go/math/big/int.go b/libgo/go/math/big/int.go
index 95c0d58ee97..63a4536e2a0 100644
--- a/libgo/go/math/big/int.go
+++ b/libgo/go/math/big/int.go
@@ -51,6 +51,13 @@ func (z *Int) SetInt64(x int64) *Int {
return z
}
+// SetUint64 sets z to x and returns z.
+func (z *Int) SetUint64(x uint64) *Int {
+ z.abs = z.abs.setUint64(uint64(x))
+ z.neg = false
+ return z
+}
+
// NewInt allocates and returns a new Int set to x.
func NewInt(x int64) *Int {
return new(Int).SetInt64(x)
@@ -519,6 +526,19 @@ func (x *Int) Int64() int64 {
return v
}
+// Uint64 returns the int64 representation of x.
+// If x cannot be represented in an uint64, the result is undefined.
+func (x *Int) Uint64() uint64 {
+ if len(x.abs) == 0 {
+ return 0
+ }
+ v := uint64(x.abs[0])
+ if _W == 32 && len(x.abs) > 1 {
+ v |= uint64(x.abs[1]) << 32
+ }
+ return v
+}
+
// SetString sets z to the value of s, interpreted in the given base,
// and returns z and a boolean indicating success. If SetString fails,
// the value of z is undefined but the returned value is nil.
diff --git a/libgo/go/math/big/int_test.go b/libgo/go/math/big/int_test.go
index d3c5a0e8bfe..fd6d152b39d 100644
--- a/libgo/go/math/big/int_test.go
+++ b/libgo/go/math/big/int_test.go
@@ -1135,6 +1135,36 @@ func TestInt64(t *testing.T) {
}
}
+var uint64Tests = []uint64{
+ 0,
+ 1,
+ 4294967295,
+ 4294967296,
+ 8589934591,
+ 8589934592,
+ 9223372036854775807,
+ 9223372036854775808,
+ 18446744073709551615, // 1<<64 - 1
+}
+
+func TestUint64(t *testing.T) {
+ in := new(Int)
+ for i, testVal := range uint64Tests {
+ in.SetUint64(testVal)
+ out := in.Uint64()
+
+ if out != testVal {
+ t.Errorf("#%d got %d want %d", i, out, testVal)
+ }
+
+ str := fmt.Sprint(testVal)
+ strOut := in.String()
+ if strOut != str {
+ t.Errorf("#%d.String got %s want %s", i, strOut, str)
+ }
+ }
+}
+
var bitwiseTests = []struct {
x, y string
and, or, xor, andNot string
diff --git a/libgo/go/math/big/nat.go b/libgo/go/math/big/nat.go
index 13a623a7032..9d09f97b77b 100644
--- a/libgo/go/math/big/nat.go
+++ b/libgo/go/math/big/nat.go
@@ -826,7 +826,7 @@ func (x nat) string(charset string) string {
// Convert words of q to base b digits in s. If q is large, it is recursively "split in half"
// by nat/nat division using tabulated divisors. Otherwise, it is converted iteratively using
-// repeated nat/Word divison.
+// repeated nat/Word division.
//
// The iterative method processes n Words by n divW() calls, each of which visits every Word in the
// incrementally shortened q for a total of n + (n-1) + (n-2) ... + 2 + 1, or n(n+1)/2 divW()'s.
diff --git a/libgo/go/math/log10.go b/libgo/go/math/log10.go
index 3d2cec6656c..d880ec2040d 100644
--- a/libgo/go/math/log10.go
+++ b/libgo/go/math/log10.go
@@ -26,5 +26,6 @@ func Log2(x float64) float64 {
}
func log2(x float64) float64 {
- return Log(x) * (1 / Ln2)
+ frac, exp := Frexp(x)
+ return Log(frac)*(1/Ln2) + float64(exp)
}
diff --git a/libgo/go/net/cgo_openbsd.go b/libgo/go/net/cgo_openbsd.go
new file mode 100644
index 00000000000..aeaf8e568ad
--- /dev/null
+++ b/libgo/go/net/cgo_openbsd.go
@@ -0,0 +1,14 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package net
+
+/*
+#include <netdb.h>
+*/
+import "C"
+
+func cgoAddrInfoFlags() C.int {
+ return C.AI_CANONNAME
+}
diff --git a/libgo/go/net/cgo_unix.go b/libgo/go/net/cgo_unix.go
index 69daedcdf85..a4d96a86d12 100644
--- a/libgo/go/net/cgo_unix.go
+++ b/libgo/go/net/cgo_unix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build darwin freebsd linux netbsd
+// +build darwin freebsd linux netbsd openbsd
package net
diff --git a/libgo/go/net/conn_test.go b/libgo/go/net/conn_test.go
index 037ce805055..f733a81a3b2 100644
--- a/libgo/go/net/conn_test.go
+++ b/libgo/go/net/conn_test.go
@@ -17,8 +17,8 @@ var connTests = []struct {
addr string
}{
{"tcp", "127.0.0.1:0"},
- {"unix", "/tmp/gotest.net"},
- {"unixpacket", "/tmp/gotest.net"},
+ {"unix", "/tmp/gotest.net1"},
+ {"unixpacket", "/tmp/gotest.net2"},
}
func TestConnAndListener(t *testing.T) {
@@ -41,7 +41,13 @@ func TestConnAndListener(t *testing.T) {
return
}
ln.Addr()
- defer ln.Close()
+ defer func(ln net.Listener, net, addr string) {
+ ln.Close()
+ switch net {
+ case "unix", "unixpacket":
+ os.Remove(addr)
+ }
+ }(ln, tt.net, tt.addr)
done := make(chan int)
go transponder(t, ln, done)
@@ -68,10 +74,6 @@ func TestConnAndListener(t *testing.T) {
}
<-done
- switch tt.net {
- case "unix", "unixpacket":
- os.Remove(tt.addr)
- }
}
}
diff --git a/libgo/go/net/dial.go b/libgo/go/net/dial.go
index 0c4608462e0..c1eb983cc0f 100644
--- a/libgo/go/net/dial.go
+++ b/libgo/go/net/dial.go
@@ -238,7 +238,7 @@ func ListenPacket(net, laddr string) (PacketConn, error) {
if a != nil {
la = a.(*UnixAddr)
}
- return DialUnix(net, la, nil)
+ return ListenUnixgram(net, la)
}
return nil, UnknownNetworkError(net)
}
diff --git a/libgo/go/net/dial_test.go b/libgo/go/net/dial_test.go
index 865dd627778..f30dee30164 100644
--- a/libgo/go/net/dial_test.go
+++ b/libgo/go/net/dial_test.go
@@ -240,7 +240,8 @@ func TestDialTimeoutFDLeak(t *testing.T) {
err error
}
dials := listenerBacklog + 100
- maxGoodConnect := listenerBacklog + 5 // empirically 131 good ones (of 128). who knows?
+ // used to be listenerBacklog + 5, but was found to be unreliable, issue 4384.
+ maxGoodConnect := listenerBacklog + runtime.NumCPU()*10
resc := make(chan connErr)
for i := 0; i < dials; i++ {
go func() {
diff --git a/libgo/go/net/http/client.go b/libgo/go/net/http/client.go
index 2f957d23dbe..5ee0804c7da 100644
--- a/libgo/go/net/http/client.go
+++ b/libgo/go/net/http/client.go
@@ -98,7 +98,9 @@ func (c *Client) send(req *Request) (*Response, error) {
return nil, err
}
if c.Jar != nil {
- c.Jar.SetCookies(req.URL, resp.Cookies())
+ if rc := resp.Cookies(); len(rc) > 0 {
+ c.Jar.SetCookies(req.URL, rc)
+ }
}
return resp, err
}
@@ -120,7 +122,10 @@ func (c *Client) send(req *Request) (*Response, error) {
// Generally Get, Post, or PostForm will be used instead of Do.
func (c *Client) Do(req *Request) (resp *Response, err error) {
if req.Method == "GET" || req.Method == "HEAD" {
- return c.doFollowingRedirects(req)
+ return c.doFollowingRedirects(req, shouldRedirectGet)
+ }
+ if req.Method == "POST" || req.Method == "PUT" {
+ return c.doFollowingRedirects(req, shouldRedirectPost)
}
return c.send(req)
}
@@ -166,7 +171,7 @@ func send(req *Request, t RoundTripper) (resp *Response, err error) {
// True if the specified HTTP status code is one for which the Get utility should
// automatically redirect.
-func shouldRedirect(statusCode int) bool {
+func shouldRedirectGet(statusCode int) bool {
switch statusCode {
case StatusMovedPermanently, StatusFound, StatusSeeOther, StatusTemporaryRedirect:
return true
@@ -174,6 +179,16 @@ func shouldRedirect(statusCode int) bool {
return false
}
+// True if the specified HTTP status code is one for which the Post utility should
+// automatically redirect.
+func shouldRedirectPost(statusCode int) bool {
+ switch statusCode {
+ case StatusFound, StatusSeeOther:
+ return true
+ }
+ return false
+}
+
// Get issues a GET to the specified URL. If the response is one of the following
// redirect codes, Get follows the redirect, up to a maximum of 10 redirects:
//
@@ -214,12 +229,10 @@ func (c *Client) Get(url string) (resp *Response, err error) {
if err != nil {
return nil, err
}
- return c.doFollowingRedirects(req)
+ return c.doFollowingRedirects(req, shouldRedirectGet)
}
-func (c *Client) doFollowingRedirects(ireq *Request) (resp *Response, err error) {
- // TODO: if/when we add cookie support, the redirected request shouldn't
- // necessarily supply the same cookies as the original.
+func (c *Client) doFollowingRedirects(ireq *Request, shouldRedirect func(int) bool) (resp *Response, err error) {
var base *url.URL
redirectChecker := c.CheckRedirect
if redirectChecker == nil {
@@ -238,6 +251,9 @@ func (c *Client) doFollowingRedirects(ireq *Request) (resp *Response, err error)
if redirect != 0 {
req = new(Request)
req.Method = ireq.Method
+ if ireq.Method == "POST" || ireq.Method == "PUT" {
+ req.Method = "GET"
+ }
req.Header = make(Header)
req.URL, err = base.Parse(urlStr)
if err != nil {
@@ -321,7 +337,7 @@ func (c *Client) Post(url string, bodyType string, body io.Reader) (resp *Respon
return nil, err
}
req.Header.Set("Content-Type", bodyType)
- return c.send(req)
+ return c.doFollowingRedirects(req, shouldRedirectPost)
}
// PostForm issues a POST to the specified URL, with data's keys and
@@ -371,5 +387,5 @@ func (c *Client) Head(url string) (resp *Response, err error) {
if err != nil {
return nil, err
}
- return c.doFollowingRedirects(req)
+ return c.doFollowingRedirects(req, shouldRedirectGet)
}
diff --git a/libgo/go/net/http/client_test.go b/libgo/go/net/http/client_test.go
index f4ba6a9e652..9514a4b9610 100644
--- a/libgo/go/net/http/client_test.go
+++ b/libgo/go/net/http/client_test.go
@@ -7,6 +7,7 @@
package http_test
import (
+ "bytes"
"crypto/tls"
"crypto/x509"
"errors"
@@ -246,6 +247,52 @@ func TestRedirects(t *testing.T) {
}
}
+func TestPostRedirects(t *testing.T) {
+ var log struct {
+ sync.Mutex
+ bytes.Buffer
+ }
+ var ts *httptest.Server
+ ts = httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
+ log.Lock()
+ fmt.Fprintf(&log.Buffer, "%s %s ", r.Method, r.RequestURI)
+ log.Unlock()
+ if v := r.URL.Query().Get("code"); v != "" {
+ code, _ := strconv.Atoi(v)
+ if code/100 == 3 {
+ w.Header().Set("Location", ts.URL)
+ }
+ w.WriteHeader(code)
+ }
+ }))
+ tests := []struct {
+ suffix string
+ want int // response code
+ }{
+ {"/", 200},
+ {"/?code=301", 301},
+ {"/?code=302", 200},
+ {"/?code=303", 200},
+ {"/?code=404", 404},
+ }
+ for _, tt := range tests {
+ res, err := Post(ts.URL+tt.suffix, "text/plain", strings.NewReader("Some content"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if res.StatusCode != tt.want {
+ t.Errorf("POST %s: status code = %d; want %d", tt.suffix, res.StatusCode, tt.want)
+ }
+ }
+ log.Lock()
+ got := log.String()
+ log.Unlock()
+ want := "POST / POST /?code=301 POST /?code=302 GET / POST /?code=303 GET / POST /?code=404 "
+ if got != want {
+ t.Errorf("Log differs.\n Got: %q\nWant: %q", got, want)
+ }
+}
+
var expectedCookies = []*Cookie{
{Name: "ChocolateChip", Value: "tasty"},
{Name: "First", Value: "Hit"},
@@ -304,6 +351,9 @@ type TestJar struct {
func (j *TestJar) SetCookies(u *url.URL, cookies []*Cookie) {
j.m.Lock()
defer j.m.Unlock()
+ if j.perURL == nil {
+ j.perURL = make(map[string][]*Cookie)
+ }
j.perURL[u.Host] = cookies
}
@@ -334,8 +384,9 @@ func TestRedirectCookiesJar(t *testing.T) {
var ts *httptest.Server
ts = httptest.NewServer(echoCookiesRedirectHandler)
defer ts.Close()
- c := &Client{}
- c.Jar = &TestJar{perURL: make(map[string][]*Cookie)}
+ c := &Client{
+ Jar: new(TestJar),
+ }
u, _ := url.Parse(ts.URL)
c.Jar.SetCookies(u, []*Cookie{expectedCookies[0]})
resp, err := c.Get(ts.URL)
@@ -364,6 +415,69 @@ func matchReturnedCookies(t *testing.T, expected, given []*Cookie) {
}
}
+func TestJarCalls(t *testing.T) {
+ ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
+ pathSuffix := r.RequestURI[1:]
+ if r.RequestURI == "/nosetcookie" {
+ return // dont set cookies for this path
+ }
+ SetCookie(w, &Cookie{Name: "name" + pathSuffix, Value: "val" + pathSuffix})
+ if r.RequestURI == "/" {
+ Redirect(w, r, "http://secondhost.fake/secondpath", 302)
+ }
+ }))
+ defer ts.Close()
+ jar := new(RecordingJar)
+ c := &Client{
+ Jar: jar,
+ Transport: &Transport{
+ Dial: func(_ string, _ string) (net.Conn, error) {
+ return net.Dial("tcp", ts.Listener.Addr().String())
+ },
+ },
+ }
+ _, err := c.Get("http://firsthost.fake/")
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, err = c.Get("http://firsthost.fake/nosetcookie")
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := jar.log.String()
+ want := `Cookies("http://firsthost.fake/")
+SetCookie("http://firsthost.fake/", [name=val])
+Cookies("http://secondhost.fake/secondpath")
+SetCookie("http://secondhost.fake/secondpath", [namesecondpath=valsecondpath])
+Cookies("http://firsthost.fake/nosetcookie")
+`
+ if got != want {
+ t.Errorf("Got Jar calls:\n%s\nWant:\n%s", got, want)
+ }
+}
+
+// RecordingJar keeps a log of calls made to it, without
+// tracking any cookies.
+type RecordingJar struct {
+ mu sync.Mutex
+ log bytes.Buffer
+}
+
+func (j *RecordingJar) SetCookies(u *url.URL, cookies []*Cookie) {
+ j.logf("SetCookie(%q, %v)\n", u, cookies)
+}
+
+func (j *RecordingJar) Cookies(u *url.URL) []*Cookie {
+ j.logf("Cookies(%q)\n", u)
+ return nil
+}
+
+func (j *RecordingJar) logf(format string, args ...interface{}) {
+ j.mu.Lock()
+ defer j.mu.Unlock()
+ fmt.Fprintf(&j.log, format, args...)
+}
+
func TestStreamingGet(t *testing.T) {
say := make(chan string)
ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
diff --git a/libgo/go/net/http/pprof/pprof.go b/libgo/go/net/http/pprof/pprof.go
index d70bf4ed9d3..0c03e5b2b75 100644
--- a/libgo/go/net/http/pprof/pprof.go
+++ b/libgo/go/net/http/pprof/pprof.go
@@ -34,9 +34,8 @@
//
// go tool pprof http://localhost:6060/debug/pprof/block
//
-// Or to view all available profiles:
-//
-// go tool pprof http://localhost:6060/debug/pprof/
+// To view all available profiles, open http://localhost:6060/debug/pprof/
+// in your browser.
//
// For a study of the facility in action, visit
//
diff --git a/libgo/go/net/http/readrequest_test.go b/libgo/go/net/http/readrequest_test.go
index 2e03c658aa9..ffdd6a892da 100644
--- a/libgo/go/net/http/readrequest_test.go
+++ b/libgo/go/net/http/readrequest_test.go
@@ -247,6 +247,54 @@ var reqTests = []reqTest{
noTrailer,
noError,
},
+
+ // SSDP Notify request. golang.org/issue/3692
+ {
+ "NOTIFY * HTTP/1.1\r\nServer: foo\r\n\r\n",
+ &Request{
+ Method: "NOTIFY",
+ URL: &url.URL{
+ Path: "*",
+ },
+ Proto: "HTTP/1.1",
+ ProtoMajor: 1,
+ ProtoMinor: 1,
+ Header: Header{
+ "Server": []string{"foo"},
+ },
+ Close: false,
+ ContentLength: 0,
+ RequestURI: "*",
+ },
+
+ noBody,
+ noTrailer,
+ noError,
+ },
+
+ // OPTIONS request. Similar to golang.org/issue/3692
+ {
+ "OPTIONS * HTTP/1.1\r\nServer: foo\r\n\r\n",
+ &Request{
+ Method: "OPTIONS",
+ URL: &url.URL{
+ Path: "*",
+ },
+ Proto: "HTTP/1.1",
+ ProtoMajor: 1,
+ ProtoMinor: 1,
+ Header: Header{
+ "Server": []string{"foo"},
+ },
+ Close: false,
+ ContentLength: 0,
+ RequestURI: "*",
+ },
+
+ noBody,
+ noTrailer,
+ noError,
+ },
}
func TestReadRequest(t *testing.T) {
diff --git a/libgo/go/net/http/serve_test.go b/libgo/go/net/http/serve_test.go
index 8ca227f9dec..1de4171239d 100644
--- a/libgo/go/net/http/serve_test.go
+++ b/libgo/go/net/http/serve_test.go
@@ -918,15 +918,19 @@ func TestZeroLengthPostAndResponse(t *testing.T) {
}
}
+func TestHandlerPanicNil(t *testing.T) {
+ testHandlerPanic(t, false, nil)
+}
+
func TestHandlerPanic(t *testing.T) {
- testHandlerPanic(t, false)
+ testHandlerPanic(t, false, "intentional death for testing")
}
func TestHandlerPanicWithHijack(t *testing.T) {
- testHandlerPanic(t, true)
+ testHandlerPanic(t, true, "intentional death for testing")
}
-func testHandlerPanic(t *testing.T, withHijack bool) {
+func testHandlerPanic(t *testing.T, withHijack bool, panicValue interface{}) {
// Unlike the other tests that set the log output to ioutil.Discard
// to quiet the output, this test uses a pipe. The pipe serves three
// purposes:
@@ -955,7 +959,7 @@ func testHandlerPanic(t *testing.T, withHijack bool) {
}
defer rwc.Close()
}
- panic("intentional death for testing")
+ panic(panicValue)
}))
defer ts.Close()
@@ -968,7 +972,7 @@ func testHandlerPanic(t *testing.T, withHijack bool) {
_, err := pr.Read(buf)
pr.Close()
if err != nil {
- t.Fatal(err)
+ t.Error(err)
}
done <- true
}()
@@ -978,6 +982,10 @@ func testHandlerPanic(t *testing.T, withHijack bool) {
t.Logf("expected an error")
}
+ if panicValue == nil {
+ return
+ }
+
select {
case <-done:
return
@@ -1288,6 +1296,58 @@ For:
ts.Close()
}
+func TestOptions(t *testing.T) {
+ uric := make(chan string, 2) // only expect 1, but leave space for 2
+ mux := NewServeMux()
+ mux.HandleFunc("/", func(w ResponseWriter, r *Request) {
+ uric <- r.RequestURI
+ })
+ ts := httptest.NewServer(mux)
+ defer ts.Close()
+
+ conn, err := net.Dial("tcp", ts.Listener.Addr().String())
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer conn.Close()
+
+ // An OPTIONS * request should succeed.
+ _, err = conn.Write([]byte("OPTIONS * HTTP/1.1\r\nHost: foo.com\r\n\r\n"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ br := bufio.NewReader(conn)
+ res, err := ReadResponse(br, &Request{Method: "OPTIONS"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if res.StatusCode != 200 {
+ t.Errorf("Got non-200 response to OPTIONS *: %#v", res)
+ }
+
+ // A GET * request on a ServeMux should fail.
+ _, err = conn.Write([]byte("GET * HTTP/1.1\r\nHost: foo.com\r\n\r\n"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ res, err = ReadResponse(br, &Request{Method: "GET"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if res.StatusCode != 400 {
+ t.Errorf("Got non-400 response to GET *: %#v", res)
+ }
+
+ res, err = Get(ts.URL + "/second")
+ if err != nil {
+ t.Fatal(err)
+ }
+ res.Body.Close()
+ if got := <-uric; got != "/second" {
+ t.Errorf("Handler saw request for %q; want /second", got)
+ }
+}
+
// goTimeout runs f, failing t if f takes more than ns to complete.
func goTimeout(t *testing.T, d time.Duration, f func()) {
ch := make(chan bool, 2)
diff --git a/libgo/go/net/http/server.go b/libgo/go/net/http/server.go
index c4ddbec54f1..89a46f06bb2 100644
--- a/libgo/go/net/http/server.go
+++ b/libgo/go/net/http/server.go
@@ -702,24 +702,19 @@ func (c *conn) closeWriteAndWait() {
// Serve a new connection.
func (c *conn) serve() {
defer func() {
- err := recover()
- if err == nil {
- return
+ if err := recover(); err != nil {
+ const size = 4096
+ buf := make([]byte, size)
+ buf = buf[:runtime.Stack(buf, false)]
+ log.Printf("http: panic serving %v: %v\n%s", c.remoteAddr, err, buf)
}
-
- const size = 4096
- buf := make([]byte, size)
- buf = buf[:runtime.Stack(buf, false)]
- log.Printf("http: panic serving %v: %v\n%s", c.remoteAddr, err, buf)
-
- if c.rwc != nil { // may be nil if connection hijacked
- c.rwc.Close()
+ if !c.hijacked() {
+ c.close()
}
}()
if tlsConn, ok := c.rwc.(*tls.Conn); ok {
if err := tlsConn.Handshake(); err != nil {
- c.close()
return
}
c.tlsState = new(tls.ConnectionState)
@@ -770,6 +765,9 @@ func (c *conn) serve() {
if handler == nil {
handler = DefaultServeMux
}
+ if req.RequestURI == "*" && req.Method == "OPTIONS" {
+ handler = globalOptionsHandler{}
+ }
// HTTP cannot have multiple simultaneous active requests.[*]
// Until the server replies to this request, it can't read another,
@@ -788,7 +786,6 @@ func (c *conn) serve() {
break
}
}
- c.close()
}
func (w *response) sendExpectationFailed() {
@@ -1085,6 +1082,11 @@ func (mux *ServeMux) handler(host, path string) (h Handler, pattern string) {
// ServeHTTP dispatches the request to the handler whose
// pattern most closely matches the request URL.
func (mux *ServeMux) ServeHTTP(w ResponseWriter, r *Request) {
+ if r.RequestURI == "*" {
+ w.Header().Set("Connection", "close")
+ w.WriteHeader(StatusBadRequest)
+ return
+ }
h, _ := mux.Handler(r)
h.ServeHTTP(w, r)
}
@@ -1408,6 +1410,22 @@ func (tw *timeoutWriter) WriteHeader(code int) {
tw.w.WriteHeader(code)
}
+// globalOptionsHandler responds to "OPTIONS *" requests.
+type globalOptionsHandler struct{}
+
+func (globalOptionsHandler) ServeHTTP(w ResponseWriter, r *Request) {
+ w.Header().Set("Content-Length", "0")
+ if r.ContentLength != 0 {
+ // Read up to 4KB of OPTIONS body (as mentioned in the
+ // spec as being reserved for future use), but anything
+ // over that is considered a waste of server resources
+ // (or an attack) and we abort and close the connection,
+ // courtesy of MaxBytesReader's EOF behavior.
+ mb := MaxBytesReader(w, r.Body, 4<<10)
+ io.Copy(ioutil.Discard, mb)
+ }
+}
+
// loggingConn is used for debugging.
type loggingConn struct {
name string
diff --git a/libgo/go/net/http/transport.go b/libgo/go/net/http/transport.go
index 7b4afeb8efc..d0505bf13f0 100644
--- a/libgo/go/net/http/transport.go
+++ b/libgo/go/net/http/transport.go
@@ -144,6 +144,9 @@ func (t *Transport) RoundTrip(req *Request) (resp *Response, err error) {
}
return rt.RoundTrip(req)
}
+ if req.URL.Host == "" {
+ return nil, errors.New("http: no Host in request URL")
+ }
treq := &transportRequest{Request: req}
cm, err := t.connectMethodForRequest(treq)
if err != nil {
@@ -739,6 +742,7 @@ WaitResponse:
case err := <-writeErrCh:
if err != nil {
re = responseAndError{nil, err}
+ pc.close()
break WaitResponse
}
case <-pconnDeadCh:
diff --git a/libgo/go/net/http/transport_test.go b/libgo/go/net/http/transport_test.go
index f1d415888ca..c37ef13a416 100644
--- a/libgo/go/net/http/transport_test.go
+++ b/libgo/go/net/http/transport_test.go
@@ -778,6 +778,45 @@ func TestTransportPersistConnLeak(t *testing.T) {
}
}
+// golang.org/issue/4531: Transport leaks goroutines when
+// request.ContentLength is explicitly short
+func TestTransportPersistConnLeakShortBody(t *testing.T) {
+ ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
+ }))
+ defer ts.Close()
+
+ tr := &Transport{}
+ c := &Client{Transport: tr}
+
+ n0 := runtime.NumGoroutine()
+ body := []byte("Hello")
+ for i := 0; i < 20; i++ {
+ req, err := NewRequest("POST", ts.URL, bytes.NewReader(body))
+ if err != nil {
+ t.Fatal(err)
+ }
+ req.ContentLength = int64(len(body) - 2) // explicitly short
+ _, err = c.Do(req)
+ if err == nil {
+ t.Fatal("Expect an error from writing too long of a body.")
+ }
+ }
+ nhigh := runtime.NumGoroutine()
+ tr.CloseIdleConnections()
+ time.Sleep(50 * time.Millisecond)
+ runtime.GC()
+ nfinal := runtime.NumGoroutine()
+
+ growth := nfinal - n0
+
+ // We expect 0 or 1 extra goroutine, empirically. Allow up to 5.
+ // Previously we were leaking one per numReq.
+ t.Logf("goroutine growth: %d -> %d -> %d (delta: %d)", n0, nhigh, nfinal, growth)
+ if int(growth) > 5 {
+ t.Error("too many new goroutines")
+ }
+}
+
// This used to crash; http://golang.org/issue/3266
func TestTransportIdleConnCrash(t *testing.T) {
tr := &Transport{}
@@ -1062,6 +1101,20 @@ func TestTransportAltProto(t *testing.T) {
}
}
+func TestTransportNoHost(t *testing.T) {
+ tr := &Transport{}
+ _, err := tr.RoundTrip(&Request{
+ Header: make(Header),
+ URL: &url.URL{
+ Scheme: "http",
+ },
+ })
+ want := "http: no Host in request URL"
+ if got := fmt.Sprint(err); got != want {
+ t.Errorf("error = %v; want %q", err, want)
+ }
+}
+
var proxyFromEnvTests = []struct {
env string
wanturl string
diff --git a/libgo/go/net/packetconn_test.go b/libgo/go/net/packetconn_test.go
index 5075baa609b..ff29e24a9a2 100644
--- a/libgo/go/net/packetconn_test.go
+++ b/libgo/go/net/packetconn_test.go
@@ -24,6 +24,15 @@ var packetConnTests = []struct {
}
func TestPacketConn(t *testing.T) {
+ closer := func(c net.PacketConn, net, addr1, addr2 string) {
+ c.Close()
+ switch net {
+ case "unixgram":
+ os.Remove(addr1)
+ os.Remove(addr2)
+ }
+ }
+
for _, tt := range packetConnTests {
var wb []byte
netstr := strings.Split(tt.net, ":")
@@ -39,7 +48,7 @@ func TestPacketConn(t *testing.T) {
continue
}
id := os.Getpid() & 0xffff
- wb = newICMPEchoRequest(id, 1, 128, []byte("IP PACKETCONN TEST "))
+ wb = newICMPEchoRequest(id, 1, 128, []byte("IP PACKETCONN TEST"))
case "unixgram":
switch runtime.GOOS {
case "plan9", "windows":
@@ -60,7 +69,7 @@ func TestPacketConn(t *testing.T) {
c1.SetDeadline(time.Now().Add(100 * time.Millisecond))
c1.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
c1.SetWriteDeadline(time.Now().Add(100 * time.Millisecond))
- defer c1.Close()
+ defer closer(c1, netstr[0], tt.addr1, tt.addr2)
c2, err := net.ListenPacket(tt.net, tt.addr2)
if err != nil {
@@ -70,7 +79,7 @@ func TestPacketConn(t *testing.T) {
c2.SetDeadline(time.Now().Add(100 * time.Millisecond))
c2.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
c2.SetWriteDeadline(time.Now().Add(100 * time.Millisecond))
- defer c2.Close()
+ defer closer(c2, netstr[0], tt.addr1, tt.addr2)
if _, err := c1.WriteTo(wb, c2.LocalAddr()); err != nil {
t.Fatalf("net.PacketConn.WriteTo failed: %v", err)
@@ -86,12 +95,6 @@ func TestPacketConn(t *testing.T) {
if _, _, err := c1.ReadFrom(rb1); err != nil {
t.Fatalf("net.PacketConn.ReadFrom failed: %v", err)
}
-
- switch netstr[0] {
- case "unixgram":
- os.Remove(tt.addr1)
- os.Remove(tt.addr2)
- }
}
}
diff --git a/libgo/go/net/protoconn_test.go b/libgo/go/net/protoconn_test.go
index f249372f392..d99de3f138c 100644
--- a/libgo/go/net/protoconn_test.go
+++ b/libgo/go/net/protoconn_test.go
@@ -263,9 +263,10 @@ func TestUnixConnSpecificMethods(t *testing.T) {
return
}
- p1, p2 := "/tmp/gotest.net1", "/tmp/gotest.net2"
+ p1, p2, p3 := "/tmp/gotest.net1", "/tmp/gotest.net2", "/tmp/gotest.net3"
os.Remove(p1)
os.Remove(p2)
+ os.Remove(p3)
a1, err := net.ResolveUnixAddr("unixgram", p1)
if err != nil {
@@ -305,9 +306,30 @@ func TestUnixConnSpecificMethods(t *testing.T) {
defer c2.Close()
defer os.Remove(p2)
+ a3, err := net.ResolveUnixAddr("unixgram", p3)
+ if err != nil {
+ t.Errorf("net.ResolveUnixAddr failed: %v", err)
+ return
+ }
+ c3, err := net.ListenUnixgram("unixgram", a3)
+ if err != nil {
+ t.Errorf("net.ListenUnixgram failed: %v", err)
+ return
+ }
+ c3.LocalAddr()
+ c3.RemoteAddr()
+ c3.SetDeadline(time.Now().Add(100 * time.Millisecond))
+ c3.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
+ c3.SetWriteDeadline(time.Now().Add(100 * time.Millisecond))
+ c3.SetReadBuffer(2048)
+ c3.SetWriteBuffer(2048)
+ defer c3.Close()
+ defer os.Remove(p3)
+
wb := []byte("UNIXCONN TEST")
rb1 := make([]byte, 128)
rb2 := make([]byte, 128)
+ rb3 := make([]byte, 128)
if _, _, err := c1.WriteMsgUnix(wb, nil, a2); err != nil {
t.Errorf("net.UnixConn.WriteMsgUnix failed: %v", err)
return
@@ -324,9 +346,22 @@ func TestUnixConnSpecificMethods(t *testing.T) {
t.Errorf("net.UnixConn.ReadFromUnix failed: %v", err)
return
}
-
- // TODO: http://golang.org/issue/3875
- net.ListenUnixgram("unixgram", nil)
+ if _, err := c3.WriteToUnix(wb, a1); err != nil {
+ t.Errorf("net.UnixConn.WriteToUnix failed: %v", err)
+ return
+ }
+ if _, _, err := c1.ReadFromUnix(rb1); err != nil {
+ t.Errorf("net.UnixConn.ReadFromUnix failed: %v", err)
+ return
+ }
+ if _, err := c2.WriteToUnix(wb, a3); err != nil {
+ t.Errorf("net.UnixConn.WriteToUnix failed: %v", err)
+ return
+ }
+ if _, _, err := c3.ReadFromUnix(rb3); err != nil {
+ t.Errorf("net.UnixConn.ReadFromUnix failed: %v", err)
+ return
+ }
if f, err := c1.File(); err != nil {
t.Errorf("net.UnixConn.File failed: %v", err)
diff --git a/libgo/go/net/smtp/smtp.go b/libgo/go/net/smtp/smtp.go
index 59f6449f0ab..4b917787701 100644
--- a/libgo/go/net/smtp/smtp.go
+++ b/libgo/go/net/smtp/smtp.go
@@ -13,6 +13,7 @@ package smtp
import (
"crypto/tls"
"encoding/base64"
+ "errors"
"io"
"net"
"net/textproto"
@@ -33,7 +34,10 @@ type Client struct {
// map of supported extensions
ext map[string]string
// supported auth mechanisms
- auth []string
+ auth []string
+ localName string // the name to use in HELO/EHLO
+ didHello bool // whether we've said HELO/EHLO
+ helloError error // the error from the hello
}
// Dial returns a new Client connected to an SMTP server at addr.
@@ -55,12 +59,33 @@ func NewClient(conn net.Conn, host string) (*Client, error) {
text.Close()
return nil, err
}
- c := &Client{Text: text, conn: conn, serverName: host}
- err = c.ehlo()
- if err != nil {
- err = c.helo()
+ c := &Client{Text: text, conn: conn, serverName: host, localName: "localhost"}
+ return c, nil
+}
+
+// hello runs a hello exchange if needed.
+func (c *Client) hello() error {
+ if !c.didHello {
+ c.didHello = true
+ err := c.ehlo()
+ if err != nil {
+ c.helloError = c.helo()
+ }
+ }
+ return c.helloError
+}
+
+// Hello sends a HELO or EHLO to the server as the given host name.
+// Calling this method is only necessary if the client needs control
+// over the host name used. The client will introduce itself as "localhost"
+// automatically otherwise. If Hello is called, it must be called before
+// any of the other methods.
+func (c *Client) Hello(localName string) error {
+ if c.didHello {
+ return errors.New("smtp: Hello called after other methods")
}
- return c, err
+ c.localName = localName
+ return c.hello()
}
// cmd is a convenience function that sends a command and returns the response
@@ -79,14 +104,14 @@ func (c *Client) cmd(expectCode int, format string, args ...interface{}) (int, s
// server does not support ehlo.
func (c *Client) helo() error {
c.ext = nil
- _, _, err := c.cmd(250, "HELO localhost")
+ _, _, err := c.cmd(250, "HELO %s", c.localName)
return err
}
// ehlo sends the EHLO (extended hello) greeting to the server. It
// should be the preferred greeting for servers that support it.
func (c *Client) ehlo() error {
- _, msg, err := c.cmd(250, "EHLO localhost")
+ _, msg, err := c.cmd(250, "EHLO %s", c.localName)
if err != nil {
return err
}
@@ -113,6 +138,9 @@ func (c *Client) ehlo() error {
// StartTLS sends the STARTTLS command and encrypts all further communication.
// Only servers that advertise the STARTTLS extension support this function.
func (c *Client) StartTLS(config *tls.Config) error {
+ if err := c.hello(); err != nil {
+ return err
+ }
_, _, err := c.cmd(220, "STARTTLS")
if err != nil {
return err
@@ -128,6 +156,9 @@ func (c *Client) StartTLS(config *tls.Config) error {
// does not necessarily indicate an invalid address. Many servers
// will not verify addresses for security reasons.
func (c *Client) Verify(addr string) error {
+ if err := c.hello(); err != nil {
+ return err
+ }
_, _, err := c.cmd(250, "VRFY %s", addr)
return err
}
@@ -136,6 +167,9 @@ func (c *Client) Verify(addr string) error {
// A failed authentication closes the connection.
// Only servers that advertise the AUTH extension support this function.
func (c *Client) Auth(a Auth) error {
+ if err := c.hello(); err != nil {
+ return err
+ }
encoding := base64.StdEncoding
mech, resp, err := a.Start(&ServerInfo{c.serverName, c.tls, c.auth})
if err != nil {
@@ -178,6 +212,9 @@ func (c *Client) Auth(a Auth) error {
// parameter.
// This initiates a mail transaction and is followed by one or more Rcpt calls.
func (c *Client) Mail(from string) error {
+ if err := c.hello(); err != nil {
+ return err
+ }
cmdStr := "MAIL FROM:<%s>"
if c.ext != nil {
if _, ok := c.ext["8BITMIME"]; ok {
@@ -227,6 +264,9 @@ func SendMail(addr string, a Auth, from string, to []string, msg []byte) error {
if err != nil {
return err
}
+ if err := c.hello(); err != nil {
+ return err
+ }
if ok, _ := c.Extension("STARTTLS"); ok {
if err = c.StartTLS(nil); err != nil {
return err
@@ -267,6 +307,9 @@ func SendMail(addr string, a Auth, from string, to []string, msg []byte) error {
// Extension also returns a string that contains any parameters the
// server specifies for the extension.
func (c *Client) Extension(ext string) (bool, string) {
+ if err := c.hello(); err != nil {
+ return false, ""
+ }
if c.ext == nil {
return false, ""
}
@@ -278,12 +321,18 @@ func (c *Client) Extension(ext string) (bool, string) {
// Reset sends the RSET command to the server, aborting the current mail
// transaction.
func (c *Client) Reset() error {
+ if err := c.hello(); err != nil {
+ return err
+ }
_, _, err := c.cmd(250, "RSET")
return err
}
// Quit sends the QUIT command and closes the connection to the server.
func (c *Client) Quit() error {
+ if err := c.hello(); err != nil {
+ return err
+ }
_, _, err := c.cmd(221, "QUIT")
if err != nil {
return err
diff --git a/libgo/go/net/smtp/smtp_test.go b/libgo/go/net/smtp/smtp_test.go
index c315d185c9d..8317428cb87 100644
--- a/libgo/go/net/smtp/smtp_test.go
+++ b/libgo/go/net/smtp/smtp_test.go
@@ -69,14 +69,14 @@ func (f faker) SetReadDeadline(time.Time) error { return nil }
func (f faker) SetWriteDeadline(time.Time) error { return nil }
func TestBasic(t *testing.T) {
- basicServer = strings.Join(strings.Split(basicServer, "\n"), "\r\n")
- basicClient = strings.Join(strings.Split(basicClient, "\n"), "\r\n")
+ server := strings.Join(strings.Split(basicServer, "\n"), "\r\n")
+ client := strings.Join(strings.Split(basicClient, "\n"), "\r\n")
var cmdbuf bytes.Buffer
bcmdbuf := bufio.NewWriter(&cmdbuf)
var fake faker
- fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(basicServer)), bcmdbuf)
- c := &Client{Text: textproto.NewConn(fake)}
+ fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
+ c := &Client{Text: textproto.NewConn(fake), localName: "localhost"}
if err := c.helo(); err != nil {
t.Fatalf("HELO failed: %s", err)
@@ -88,6 +88,7 @@ func TestBasic(t *testing.T) {
t.Fatalf("Second EHLO failed: %s", err)
}
+ c.didHello = true
if ok, args := c.Extension("aUtH"); !ok || args != "LOGIN PLAIN" {
t.Fatalf("Expected AUTH supported")
}
@@ -143,8 +144,8 @@ Goodbye.`
bcmdbuf.Flush()
actualcmds := cmdbuf.String()
- if basicClient != actualcmds {
- t.Fatalf("Got:\n%s\nExpected:\n%s", actualcmds, basicClient)
+ if client != actualcmds {
+ t.Fatalf("Got:\n%s\nExpected:\n%s", actualcmds, client)
}
}
@@ -187,8 +188,8 @@ QUIT
`
func TestNewClient(t *testing.T) {
- newClientServer = strings.Join(strings.Split(newClientServer, "\n"), "\r\n")
- newClientClient = strings.Join(strings.Split(newClientClient, "\n"), "\r\n")
+ server := strings.Join(strings.Split(newClientServer, "\n"), "\r\n")
+ client := strings.Join(strings.Split(newClientClient, "\n"), "\r\n")
var cmdbuf bytes.Buffer
bcmdbuf := bufio.NewWriter(&cmdbuf)
@@ -197,7 +198,7 @@ func TestNewClient(t *testing.T) {
return cmdbuf.String()
}
var fake faker
- fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(newClientServer)), bcmdbuf)
+ fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
c, err := NewClient(fake, "fake.host")
if err != nil {
t.Fatalf("NewClient: %v\n(after %v)", err, out())
@@ -213,8 +214,8 @@ func TestNewClient(t *testing.T) {
}
actualcmds := out()
- if newClientClient != actualcmds {
- t.Fatalf("Got:\n%s\nExpected:\n%s", actualcmds, newClientClient)
+ if client != actualcmds {
+ t.Fatalf("Got:\n%s\nExpected:\n%s", actualcmds, client)
}
}
@@ -231,13 +232,13 @@ QUIT
`
func TestNewClient2(t *testing.T) {
- newClient2Server = strings.Join(strings.Split(newClient2Server, "\n"), "\r\n")
- newClient2Client = strings.Join(strings.Split(newClient2Client, "\n"), "\r\n")
+ server := strings.Join(strings.Split(newClient2Server, "\n"), "\r\n")
+ client := strings.Join(strings.Split(newClient2Client, "\n"), "\r\n")
var cmdbuf bytes.Buffer
bcmdbuf := bufio.NewWriter(&cmdbuf)
var fake faker
- fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(newClient2Server)), bcmdbuf)
+ fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
c, err := NewClient(fake, "fake.host")
if err != nil {
t.Fatalf("NewClient: %v", err)
@@ -251,8 +252,8 @@ func TestNewClient2(t *testing.T) {
bcmdbuf.Flush()
actualcmds := cmdbuf.String()
- if newClient2Client != actualcmds {
- t.Fatalf("Got:\n%s\nExpected:\n%s", actualcmds, newClient2Client)
+ if client != actualcmds {
+ t.Fatalf("Got:\n%s\nExpected:\n%s", actualcmds, client)
}
}
@@ -269,3 +270,199 @@ var newClient2Client = `EHLO localhost
HELO localhost
QUIT
`
+
+func TestHello(t *testing.T) {
+
+ if len(helloServer) != len(helloClient) {
+ t.Fatalf("Hello server and client size mismatch")
+ }
+
+ for i := 0; i < len(helloServer); i++ {
+ server := strings.Join(strings.Split(baseHelloServer+helloServer[i], "\n"), "\r\n")
+ client := strings.Join(strings.Split(baseHelloClient+helloClient[i], "\n"), "\r\n")
+ var cmdbuf bytes.Buffer
+ bcmdbuf := bufio.NewWriter(&cmdbuf)
+ var fake faker
+ fake.ReadWriter = bufio.NewReadWriter(bufio.NewReader(strings.NewReader(server)), bcmdbuf)
+ c, err := NewClient(fake, "fake.host")
+ if err != nil {
+ t.Fatalf("NewClient: %v", err)
+ }
+ c.localName = "customhost"
+ err = nil
+
+ switch i {
+ case 0:
+ err = c.Hello("customhost")
+ case 1:
+ err = c.StartTLS(nil)
+ if err.Error() == "502 Not implemented" {
+ err = nil
+ }
+ case 2:
+ err = c.Verify("test@example.com")
+ case 3:
+ c.tls = true
+ c.serverName = "smtp.google.com"
+ err = c.Auth(PlainAuth("", "user", "pass", "smtp.google.com"))
+ case 4:
+ err = c.Mail("test@example.com")
+ case 5:
+ ok, _ := c.Extension("feature")
+ if ok {
+ t.Errorf("Expected FEATURE not to be supported")
+ }
+ case 6:
+ err = c.Reset()
+ case 7:
+ err = c.Quit()
+ case 8:
+ err = c.Verify("test@example.com")
+ if err != nil {
+ err = c.Hello("customhost")
+ if err != nil {
+ t.Errorf("Want error, got none")
+ }
+ }
+ default:
+ t.Fatalf("Unhandled command")
+ }
+
+ if err != nil {
+ t.Errorf("Command %d failed: %v", i, err)
+ }
+
+ bcmdbuf.Flush()
+ actualcmds := cmdbuf.String()
+ if client != actualcmds {
+ t.Errorf("Got:\n%s\nExpected:\n%s", actualcmds, client)
+ }
+ }
+}
+
+var baseHelloServer = `220 hello world
+502 EH?
+250-mx.google.com at your service
+250 FEATURE
+`
+
+var helloServer = []string{
+ "",
+ "502 Not implemented\n",
+ "250 User is valid\n",
+ "235 Accepted\n",
+ "250 Sender ok\n",
+ "",
+ "250 Reset ok\n",
+ "221 Goodbye\n",
+ "250 Sender ok\n",
+}
+
+var baseHelloClient = `EHLO customhost
+HELO customhost
+`
+
+var helloClient = []string{
+ "",
+ "STARTTLS\n",
+ "VRFY test@example.com\n",
+ "AUTH PLAIN AHVzZXIAcGFzcw==\n",
+ "MAIL FROM:<test@example.com>\n",
+ "",
+ "RSET\n",
+ "QUIT\n",
+ "VRFY test@example.com\n",
+}
+
+func TestSendMail(t *testing.T) {
+ server := strings.Join(strings.Split(sendMailServer, "\n"), "\r\n")
+ client := strings.Join(strings.Split(sendMailClient, "\n"), "\r\n")
+ var cmdbuf bytes.Buffer
+ bcmdbuf := bufio.NewWriter(&cmdbuf)
+ l, err := net.Listen("tcp", "127.0.0.1:0")
+ if err != nil {
+ t.Fatalf("Unable to to create listener: %v", err)
+ }
+ defer l.Close()
+
+ // prevent data race on bcmdbuf
+ var done = make(chan struct{})
+ go func(data []string) {
+
+ defer close(done)
+
+ conn, err := l.Accept()
+ if err != nil {
+ t.Errorf("Accept error: %v", err)
+ return
+ }
+ defer conn.Close()
+
+ tc := textproto.NewConn(conn)
+ for i := 0; i < len(data) && data[i] != ""; i++ {
+ tc.PrintfLine(data[i])
+ for len(data[i]) >= 4 && data[i][3] == '-' {
+ i++
+ tc.PrintfLine(data[i])
+ }
+ if data[i] == "221 Goodbye" {
+ return
+ }
+ read := false
+ for !read || data[i] == "354 Go ahead" {
+ msg, err := tc.ReadLine()
+ bcmdbuf.Write([]byte(msg + "\r\n"))
+ read = true
+ if err != nil {
+ t.Errorf("Read error: %v", err)
+ return
+ }
+ if data[i] == "354 Go ahead" && msg == "." {
+ break
+ }
+ }
+ }
+ }(strings.Split(server, "\r\n"))
+
+ err = SendMail(l.Addr().String(), nil, "test@example.com", []string{"other@example.com"}, []byte(strings.Replace(`From: test@example.com
+To: other@example.com
+Subject: SendMail test
+
+SendMail is working for me.
+`, "\n", "\r\n", -1)))
+
+ if err != nil {
+ t.Errorf("%v", err)
+ }
+
+ <-done
+ bcmdbuf.Flush()
+ actualcmds := cmdbuf.String()
+ if client != actualcmds {
+ t.Errorf("Got:\n%s\nExpected:\n%s", actualcmds, client)
+ }
+}
+
+var sendMailServer = `220 hello world
+502 EH?
+250 mx.google.com at your service
+250 Sender ok
+250 Receiver ok
+354 Go ahead
+250 Data ok
+221 Goodbye
+`
+
+var sendMailClient = `EHLO localhost
+HELO localhost
+MAIL FROM:<test@example.com>
+RCPT TO:<other@example.com>
+DATA
+From: test@example.com
+To: other@example.com
+Subject: SendMail test
+
+SendMail is working for me.
+.
+QUIT
+`
diff --git a/libgo/go/net/unixsock_plan9.go b/libgo/go/net/unixsock_plan9.go
index f7be5d2e9ae..713820c6659 100644
--- a/libgo/go/net/unixsock_plan9.go
+++ b/libgo/go/net/unixsock_plan9.go
@@ -64,21 +64,21 @@ func (c *UnixConn) WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err
return 0, 0, syscall.EPLAN9
}
-// CloseRead shuts down the reading side of the Unix domain
-// connection. Most callers should just use Close.
+// CloseRead shuts down the reading side of the Unix domain connection.
+// Most callers should just use Close.
func (c *UnixConn) CloseRead() error {
return syscall.EPLAN9
}
-// CloseWrite shuts down the writing side of the Unix domain
-// connection. Most callers should just use Close.
+// CloseWrite shuts down the writing side of the Unix domain connection.
+// Most callers should just use Close.
func (c *UnixConn) CloseWrite() error {
return syscall.EPLAN9
}
// DialUnix connects to the remote address raddr on the network net,
-// which must be "unix" or "unixgram". If laddr is not nil, it is
-// used as the local address for the connection.
+// which must be "unix", "unixgram" or "unixpacket". If laddr is not
+// nil, it is used as the local address for the connection.
func DialUnix(net string, laddr, raddr *UnixAddr) (*UnixConn, error) {
return dialUnix(net, laddr, raddr, noDeadline)
}
@@ -93,7 +93,8 @@ func dialUnix(net string, laddr, raddr *UnixAddr, deadline time.Time) (*UnixConn
type UnixListener struct{}
// ListenUnix announces on the Unix domain socket laddr and returns a
-// Unix listener. Net must be "unix" (stream sockets).
+// Unix listener. The network net must be "unix", "unixgram" or
+// "unixpacket".
func ListenUnix(net string, laddr *UnixAddr) (*UnixListener, error) {
return nil, syscall.EPLAN9
}
@@ -134,8 +135,8 @@ func (l *UnixListener) File() (*os.File, error) {
// ListenUnixgram listens for incoming Unix datagram packets addressed
// to the local address laddr. The returned connection c's ReadFrom
-// and WriteTo methods can be used to receive and send UDP packets
-// with per-packet addressing. The network net must be "unixgram".
-func ListenUnixgram(net string, laddr *UnixAddr) (*UDPConn, error) {
+// and WriteTo methods can be used to receive and send packets with
+// per-packet addressing. The network net must be "unixgram".
+func ListenUnixgram(net string, laddr *UnixAddr) (*UnixConn, error) {
return nil, syscall.EPLAN9
}
diff --git a/libgo/go/net/unixsock_posix.go b/libgo/go/net/unixsock_posix.go
index 16ebd58d6e8..653190c203c 100644
--- a/libgo/go/net/unixsock_posix.go
+++ b/libgo/go/net/unixsock_posix.go
@@ -9,29 +9,27 @@
package net
import (
+ "errors"
"os"
"syscall"
"time"
)
-func unixSocket(net string, laddr, raddr *UnixAddr, mode string, deadline time.Time) (fd *netFD, err error) {
+func unixSocket(net string, laddr, raddr *UnixAddr, mode string, deadline time.Time) (*netFD, error) {
var sotype int
switch net {
- default:
- return nil, UnknownNetworkError(net)
case "unix":
sotype = syscall.SOCK_STREAM
case "unixgram":
sotype = syscall.SOCK_DGRAM
case "unixpacket":
sotype = syscall.SOCK_SEQPACKET
+ default:
+ return nil, UnknownNetworkError(net)
}
var la, ra syscall.Sockaddr
switch mode {
- default:
- panic("unixSocket mode " + mode)
-
case "dial":
if laddr != nil {
la = &syscall.SockaddrUnix{Name: laddr.Name}
@@ -41,15 +39,10 @@ func unixSocket(net string, laddr, raddr *UnixAddr, mode string, deadline time.T
} else if sotype != syscall.SOCK_DGRAM || laddr == nil {
return nil, &OpError{Op: mode, Net: net, Err: errMissingAddress}
}
-
case "listen":
- if laddr == nil {
- return nil, &OpError{mode, net, nil, errMissingAddress}
- }
la = &syscall.SockaddrUnix{Name: laddr.Name}
- if raddr != nil {
- return nil, &OpError{Op: mode, Net: net, Addr: raddr, Err: &AddrError{Err: "unexpected remote address", Addr: raddr.String()}}
- }
+ default:
+ return nil, errors.New("unknown mode: " + mode)
}
f := sockaddrToUnix
@@ -59,15 +52,16 @@ func unixSocket(net string, laddr, raddr *UnixAddr, mode string, deadline time.T
f = sockaddrToUnixpacket
}
- fd, err = socket(net, syscall.AF_UNIX, sotype, 0, false, la, ra, deadline, f)
+ fd, err := socket(net, syscall.AF_UNIX, sotype, 0, false, la, ra, deadline, f)
if err != nil {
- goto Error
+ goto error
}
return fd, nil
-Error:
+error:
addr := raddr
- if mode == "listen" {
+ switch mode {
+ case "listen":
addr = laddr
}
return nil, &OpError{Op: mode, Net: net, Addr: addr, Err: err}
@@ -108,21 +102,21 @@ func sotypeToNet(sotype int) string {
return ""
}
-// UnixConn is an implementation of the Conn interface
-// for connections to Unix domain sockets.
+// UnixConn is an implementation of the Conn interface for connections
+// to Unix domain sockets.
type UnixConn struct {
conn
}
func newUnixConn(fd *netFD) *UnixConn { return &UnixConn{conn{fd}} }
-// ReadFromUnix reads a packet from c, copying the payload into b.
-// It returns the number of bytes copied into b and the source address
-// of the packet.
+// ReadFromUnix reads a packet from c, copying the payload into b. It
+// returns the number of bytes copied into b and the source address of
+// the packet.
//
-// ReadFromUnix can be made to time out and return
-// an error with Timeout() == true after a fixed time limit;
-// see SetDeadline and SetReadDeadline.
+// ReadFromUnix can be made to time out and return an error with
+// Timeout() == true after a fixed time limit; see SetDeadline and
+// SetReadDeadline.
func (c *UnixConn) ReadFromUnix(b []byte) (n int, addr *UnixAddr, err error) {
if !c.ok() {
return 0, nil, syscall.EINVAL
@@ -144,12 +138,28 @@ func (c *UnixConn) ReadFrom(b []byte) (n int, addr Addr, err error) {
return n, uaddr.toAddr(), err
}
+// ReadMsgUnix reads a packet from c, copying the payload into b and
+// the associated out-of-band data into oob. It returns the number of
+// bytes copied into b, the number of bytes copied into oob, the flags
+// that were set on the packet, and the source address of the packet.
+func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error) {
+ if !c.ok() {
+ return 0, 0, 0, nil, syscall.EINVAL
+ }
+ n, oobn, flags, sa, err := c.fd.ReadMsg(b, oob)
+ switch sa := sa.(type) {
+ case *syscall.SockaddrUnix:
+ addr = &UnixAddr{sa.Name, sotypeToNet(c.fd.sotype)}
+ }
+ return
+}
+
// WriteToUnix writes a packet to addr via c, copying the payload from b.
//
-// WriteToUnix can be made to time out and return
-// an error with Timeout() == true after a fixed time limit;
-// see SetDeadline and SetWriteDeadline.
-// On packet-oriented connections, write timeouts are rare.
+// WriteToUnix can be made to time out and return an error with
+// Timeout() == true after a fixed time limit; see SetDeadline and
+// SetWriteDeadline. On packet-oriented connections, write timeouts
+// are rare.
func (c *UnixConn) WriteToUnix(b []byte, addr *UnixAddr) (n int, err error) {
if !c.ok() {
return 0, syscall.EINVAL
@@ -173,26 +183,9 @@ func (c *UnixConn) WriteTo(b []byte, addr Addr) (n int, err error) {
return c.WriteToUnix(b, a)
}
-// ReadMsgUnix reads a packet from c, copying the payload into b
-// and the associated out-of-band data into oob.
-// It returns the number of bytes copied into b, the number of
-// bytes copied into oob, the flags that were set on the packet,
-// and the source address of the packet.
-func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error) {
- if !c.ok() {
- return 0, 0, 0, nil, syscall.EINVAL
- }
- n, oobn, flags, sa, err := c.fd.ReadMsg(b, oob)
- switch sa := sa.(type) {
- case *syscall.SockaddrUnix:
- addr = &UnixAddr{sa.Name, sotypeToNet(c.fd.sotype)}
- }
- return
-}
-
-// WriteMsgUnix writes a packet to addr via c, copying the payload from b
-// and the associated out-of-band data from oob. It returns the number
-// of payload and out-of-band bytes written.
+// WriteMsgUnix writes a packet to addr via c, copying the payload
+// from b and the associated out-of-band data from oob. It returns
+// the number of payload and out-of-band bytes written.
func (c *UnixConn) WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err error) {
if !c.ok() {
return 0, 0, syscall.EINVAL
@@ -226,13 +219,18 @@ func (c *UnixConn) CloseWrite() error {
}
// DialUnix connects to the remote address raddr on the network net,
-// which must be "unix" or "unixgram". If laddr is not nil, it is used
-// as the local address for the connection.
+// which must be "unix", "unixgram" or "unixpacket". If laddr is not
+// nil, it is used as the local address for the connection.
func DialUnix(net string, laddr, raddr *UnixAddr) (*UnixConn, error) {
return dialUnix(net, laddr, raddr, noDeadline)
}
func dialUnix(net string, laddr, raddr *UnixAddr, deadline time.Time) (*UnixConn, error) {
+ switch net {
+ case "unix", "unixgram", "unixpacket":
+ default:
+ return nil, UnknownNetworkError(net)
+ }
fd, err := unixSocket(net, laddr, raddr, "dial", deadline)
if err != nil {
return nil, err
@@ -240,22 +238,25 @@ func dialUnix(net string, laddr, raddr *UnixAddr, deadline time.Time) (*UnixConn
return newUnixConn(fd), nil
}
-// UnixListener is a Unix domain socket listener.
-// Clients should typically use variables of type Listener
-// instead of assuming Unix domain sockets.
+// UnixListener is a Unix domain socket listener. Clients should
+// typically use variables of type Listener instead of assuming Unix
+// domain sockets.
type UnixListener struct {
fd *netFD
path string
}
-// ListenUnix announces on the Unix domain socket laddr and returns a Unix listener.
-// Net must be "unix" (stream sockets).
+// ListenUnix announces on the Unix domain socket laddr and returns a
+// Unix listener. The network net must be "unix", "unixgram" or
+// "unixpacket".
func ListenUnix(net string, laddr *UnixAddr) (*UnixListener, error) {
- if net != "unix" && net != "unixgram" && net != "unixpacket" {
+ switch net {
+ case "unix", "unixgram", "unixpacket":
+ default:
return nil, UnknownNetworkError(net)
}
- if laddr != nil {
- laddr = &UnixAddr{laddr.Name, net} // make our own copy
+ if laddr == nil {
+ return nil, &OpError{"listen", net, nil, errMissingAddress}
}
fd, err := unixSocket(net, laddr, nil, "listen", noDeadline)
if err != nil {
@@ -269,8 +270,8 @@ func ListenUnix(net string, laddr *UnixAddr) (*UnixListener, error) {
return &UnixListener{fd, laddr.Name}, nil
}
-// AcceptUnix accepts the next incoming call and returns the new connection
-// and the remote address.
+// AcceptUnix accepts the next incoming call and returns the new
+// connection and the remote address.
func (l *UnixListener) AcceptUnix() (*UnixConn, error) {
if l == nil || l.fd == nil {
return nil, syscall.EINVAL
@@ -283,8 +284,8 @@ func (l *UnixListener) AcceptUnix() (*UnixConn, error) {
return c, nil
}
-// Accept implements the Accept method in the Listener interface;
-// it waits for the next call and returns a generic Conn.
+// Accept implements the Accept method in the Listener interface; it
+// waits for the next call and returns a generic Conn.
func (l *UnixListener) Accept() (c Conn, err error) {
c1, err := l.AcceptUnix()
if err != nil {
@@ -293,8 +294,8 @@ func (l *UnixListener) Accept() (c Conn, err error) {
return c1, nil
}
-// Close stops listening on the Unix address.
-// Already accepted connections are not closed.
+// Close stops listening on the Unix address. Already accepted
+// connections are not closed.
func (l *UnixListener) Close() error {
if l == nil || l.fd == nil {
return syscall.EINVAL
@@ -328,16 +329,16 @@ func (l *UnixListener) SetDeadline(t time.Time) (err error) {
return setDeadline(l.fd, t)
}
-// File returns a copy of the underlying os.File, set to blocking mode.
-// It is the caller's responsibility to close f when finished.
+// File returns a copy of the underlying os.File, set to blocking
+// mode. It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
func (l *UnixListener) File() (f *os.File, err error) { return l.fd.dup() }
-// ListenUnixgram listens for incoming Unix datagram packets addressed to the
-// local address laddr. The returned connection c's ReadFrom
-// and WriteTo methods can be used to receive and send UDP
-// packets with per-packet addressing. The network net must be "unixgram".
-func ListenUnixgram(net string, laddr *UnixAddr) (*UDPConn, error) {
+// ListenUnixgram listens for incoming Unix datagram packets addressed
+// to the local address laddr. The returned connection c's ReadFrom
+// and WriteTo methods can be used to receive and send packets with
+// per-packet addressing. The network net must be "unixgram".
+func ListenUnixgram(net string, laddr *UnixAddr) (*UnixConn, error) {
switch net {
case "unixgram":
default:
@@ -350,5 +351,5 @@ func ListenUnixgram(net string, laddr *UnixAddr) (*UDPConn, error) {
if err != nil {
return nil, err
}
- return newUDPConn(fd), nil
+ return newUnixConn(fd), nil
}
diff --git a/libgo/go/net/url/url.go b/libgo/go/net/url/url.go
index 692a7fdc048..71758fe49e0 100644
--- a/libgo/go/net/url/url.go
+++ b/libgo/go/net/url/url.go
@@ -361,6 +361,11 @@ func parse(rawurl string, viaRequest bool) (url *URL, err error) {
}
url = new(URL)
+ if rawurl == "*" {
+ url.Path = "*"
+ return
+ }
+
// Split off possible leading "http:", "mailto:", etc.
// Cannot contain escaped characters.
if url.Scheme, rest, err = getscheme(rawurl); err != nil {
@@ -572,23 +577,33 @@ func resolvePath(basepath string, refpath string) string {
if len(base) == 0 {
base = []string{""}
}
+
+ rm := true
for idx, ref := range refs {
switch {
case ref == ".":
- base[len(base)-1] = ""
+ if idx == 0 {
+ base[len(base)-1] = ""
+ rm = true
+ } else {
+ rm = false
+ }
case ref == "..":
newLen := len(base) - 1
if newLen < 1 {
newLen = 1
}
base = base[0:newLen]
- base[len(base)-1] = ""
+ if rm {
+ base[len(base)-1] = ""
+ }
default:
if idx == 0 || base[len(base)-1] == "" {
base[len(base)-1] = ref
} else {
base = append(base, ref)
}
+ rm = false
}
}
return strings.Join(base, "/")
diff --git a/libgo/go/net/url/url_test.go b/libgo/go/net/url/url_test.go
index 64f11700278..4d3545dadb7 100644
--- a/libgo/go/net/url/url_test.go
+++ b/libgo/go/net/url/url_test.go
@@ -277,7 +277,7 @@ func TestParse(t *testing.T) {
const pathThatLooksSchemeRelative = "//not.a.user@not.a.host/just/a/path"
-var parseRequestUrlTests = []struct {
+var parseRequestURLTests = []struct {
url string
expectedValid bool
}{
@@ -289,10 +289,11 @@ var parseRequestUrlTests = []struct {
{"//not.a.user@%66%6f%6f.com/just/a/path/also", true},
{"foo.html", false},
{"../dir/", false},
+ {"*", true},
}
func TestParseRequestURI(t *testing.T) {
- for _, test := range parseRequestUrlTests {
+ for _, test := range parseRequestURLTests {
_, err := ParseRequestURI(test.url)
valid := err == nil
if valid != test.expectedValid {
@@ -536,6 +537,15 @@ var resolveReferenceTests = []struct {
{"http://foo.com/bar/baz", "../../../../../quux", "http://foo.com/quux"},
{"http://foo.com/bar", "..", "http://foo.com/"},
{"http://foo.com/bar/baz", "./..", "http://foo.com/"},
+ // ".." in the middle (issue 3560)
+ {"http://foo.com/bar/baz", "quux/dotdot/../tail", "http://foo.com/bar/quux/tail"},
+ {"http://foo.com/bar/baz", "quux/./dotdot/../tail", "http://foo.com/bar/quux/tail"},
+ {"http://foo.com/bar/baz", "quux/./dotdot/.././tail", "http://foo.com/bar/quux/tail"},
+ {"http://foo.com/bar/baz", "quux/./dotdot/./../tail", "http://foo.com/bar/quux/tail"},
+ {"http://foo.com/bar/baz", "quux/./dotdot/dotdot/././../../tail", "http://foo.com/bar/quux/tail"},
+ {"http://foo.com/bar/baz", "quux/./dotdot/dotdot/./.././../tail", "http://foo.com/bar/quux/tail"},
+ {"http://foo.com/bar/baz", "quux/./dotdot/dotdot/dotdot/./../../.././././tail", "http://foo.com/bar/quux/tail"},
+ {"http://foo.com/bar/baz", "quux/./dotdot/../dotdot/../dot/./tail/..", "http://foo.com/bar/quux/dot"},
// "." and ".." in the base aren't special
{"http://foo.com/dot/./dotdot/../foo/bar", "../baz", "http://foo.com/dot/./dotdot/../baz"},
diff --git a/libgo/go/os/env.go b/libgo/go/os/env.go
index eb265f24138..db7fc72b8a4 100644
--- a/libgo/go/os/env.go
+++ b/libgo/go/os/env.go
@@ -9,7 +9,7 @@ package os
import "syscall"
// Expand replaces ${var} or $var in the string based on the mapping function.
-// Invocations of undefined variables are replaced with the empty string.
+// For example, os.ExpandEnv(s) is equivalent to os.Expand(s, os.Getenv).
func Expand(s string, mapping func(string) string) string {
buf := make([]byte, 0, 2*len(s))
// ${} is all ASCII, so bytes are fine for this operation.
diff --git a/libgo/go/os/file_posix.go b/libgo/go/os/file_posix.go
index 1ba32931541..b979fed97f7 100644
--- a/libgo/go/os/file_posix.go
+++ b/libgo/go/os/file_posix.go
@@ -153,12 +153,10 @@ func (f *File) Sync() (err error) {
// less precise time unit.
// If there is an error, it will be of type *PathError.
func Chtimes(name string, atime time.Time, mtime time.Time) error {
- var utimes [2]syscall.Timeval
- atime_ns := atime.Unix()*1e9 + int64(atime.Nanosecond())
- mtime_ns := mtime.Unix()*1e9 + int64(mtime.Nanosecond())
- utimes[0] = syscall.NsecToTimeval(atime_ns)
- utimes[1] = syscall.NsecToTimeval(mtime_ns)
- if e := syscall.Utimes(name, utimes[0:]); e != nil {
+ var utimes [2]syscall.Timespec
+ utimes[0] = syscall.NsecToTimespec(atime.UnixNano())
+ utimes[1] = syscall.NsecToTimespec(mtime.UnixNano())
+ if e := syscall.UtimesNano(name, utimes[0:]); e != nil {
return &PathError{"chtimes", name, e}
}
return nil
diff --git a/libgo/go/os/user/lookup_unix.go b/libgo/go/os/user/lookup_unix.go
index 7e67495f1b7..e1e2777ff06 100644
--- a/libgo/go/os/user/lookup_unix.go
+++ b/libgo/go/os/user/lookup_unix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build darwin freebsd linux netbsd
+// +build darwin freebsd linux netbsd openbsd
// +build cgo
package user
diff --git a/libgo/go/regexp/all_test.go b/libgo/go/regexp/all_test.go
index b7e4f044a57..a6a659c4031 100644
--- a/libgo/go/regexp/all_test.go
+++ b/libgo/go/regexp/all_test.go
@@ -31,53 +31,52 @@ var good_re = []string{
`\!\\`,
}
-/*
type stringError struct {
re string
- err error
+ err string
}
var bad_re = []stringError{
- {`*`, ErrBareClosure},
- {`+`, ErrBareClosure},
- {`?`, ErrBareClosure},
- {`(abc`, ErrUnmatchedLpar},
- {`abc)`, ErrUnmatchedRpar},
- {`x[a-z`, ErrUnmatchedLbkt},
- {`abc]`, ErrUnmatchedRbkt},
- {`[z-a]`, ErrBadRange},
- {`abc\`, ErrExtraneousBackslash},
- {`a**`, ErrBadClosure},
- {`a*+`, ErrBadClosure},
- {`a??`, ErrBadClosure},
- {`\x`, ErrBadBackslash},
-}
-*/
-
-func compileTest(t *testing.T, expr string, error error) *Regexp {
+ {`*`, "missing argument to repetition operator: `*`"},
+ {`+`, "missing argument to repetition operator: `+`"},
+ {`?`, "missing argument to repetition operator: `?`"},
+ {`(abc`, "missing closing ): `(abc`"},
+ {`abc)`, "unexpected ): `abc)`"},
+ {`x[a-z`, "missing closing ]: `[a-z`"},
+ {`[z-a]`, "invalid character class range: `z-a`"},
+ {`abc\`, "trailing backslash at end of expression"},
+ {`a**`, "invalid nested repetition operator: `**`"},
+ {`a*+`, "invalid nested repetition operator: `*+`"},
+ {`\x`, "invalid escape sequence: `\\x`"},
+}
+
+func compileTest(t *testing.T, expr string, error string) *Regexp {
re, err := Compile(expr)
- if err != error {
+ if error == "" && err != nil {
t.Error("compiling `", expr, "`; unexpected error: ", err.Error())
}
+ if error != "" && err == nil {
+ t.Error("compiling `", expr, "`; missing error")
+ } else if error != "" && !strings.Contains(err.Error(), error) {
+ t.Error("compiling `", expr, "`; wrong error: ", err.Error(), "; want ", error)
+ }
return re
}
func TestGoodCompile(t *testing.T) {
for i := 0; i < len(good_re); i++ {
- compileTest(t, good_re[i], nil)
+ compileTest(t, good_re[i], "")
}
}
-/*
func TestBadCompile(t *testing.T) {
for i := 0; i < len(bad_re); i++ {
compileTest(t, bad_re[i].re, bad_re[i].err)
}
}
-*/
func matchTest(t *testing.T, test *FindTest) {
- re := compileTest(t, test.pat, nil)
+ re := compileTest(t, test.pat, "")
if re == nil {
return
}
diff --git a/libgo/go/regexp/syntax/parse.go b/libgo/go/regexp/syntax/parse.go
index 0bf5799b001..335f7395d93 100644
--- a/libgo/go/regexp/syntax/parse.go
+++ b/libgo/go/regexp/syntax/parse.go
@@ -42,11 +42,9 @@ const (
ErrMissingParen ErrorCode = "missing closing )"
ErrMissingRepeatArgument ErrorCode = "missing argument to repetition operator"
ErrTrailingBackslash ErrorCode = "trailing backslash at end of expression"
+ ErrUnexpectedParen ErrorCode = "unexpected )"
)
-// TODO: Export for Go 1.1.
-const errUnexpectedParen ErrorCode = "unexpected )"
-
func (e ErrorCode) String() string {
return string(e)
}
@@ -1167,13 +1165,13 @@ func (p *parser) parseRightParen() error {
n := len(p.stack)
if n < 2 {
- return &Error{errUnexpectedParen, p.wholeRegexp}
+ return &Error{ErrUnexpectedParen, p.wholeRegexp}
}
re1 := p.stack[n-1]
re2 := p.stack[n-2]
p.stack = p.stack[:n-2]
if re2.Op != opLeftParen {
- return &Error{errUnexpectedParen, p.wholeRegexp}
+ return &Error{ErrUnexpectedParen, p.wholeRegexp}
}
// Restore flags at time of paren.
p.flags = re2.Flags
diff --git a/libgo/go/strconv/ftoa.go b/libgo/go/strconv/ftoa.go
index 8067881e0d1..1a9c41b85a8 100644
--- a/libgo/go/strconv/ftoa.go
+++ b/libgo/go/strconv/ftoa.go
@@ -255,7 +255,7 @@ func roundShortest(d *decimal, mant uint64, exp int, flt *floatInfo) {
// d = mant << (exp - mantbits)
// Next highest floating point number is mant+1 << exp-mantbits.
- // Our upper bound is halfway inbetween, mant*2+1 << exp-mantbits-1.
+ // Our upper bound is halfway between, mant*2+1 << exp-mantbits-1.
upper := new(decimal)
upper.Assign(mant*2 + 1)
upper.Shift(exp - int(flt.mantbits) - 1)
@@ -265,7 +265,7 @@ func roundShortest(d *decimal, mant uint64, exp int, flt *floatInfo) {
// unless mant-1 drops the significant bit and exp is not the minimum exp,
// in which case the next lowest is mant*2-1 << exp-mantbits-1.
// Either way, call it mantlo << explo-mantbits.
- // Our lower bound is halfway inbetween, mantlo*2+1 << explo-mantbits-1.
+ // Our lower bound is halfway between, mantlo*2+1 << explo-mantbits-1.
var mantlo uint64
var explo int
if mant > 1<<flt.mantbits || exp == minexp {
diff --git a/libgo/go/syscall/env_plan9.go b/libgo/go/syscall/env_plan9.go
index 2848d9b32b8..0f89aa9ee38 100644
--- a/libgo/go/syscall/env_plan9.go
+++ b/libgo/go/syscall/env_plan9.go
@@ -12,14 +12,17 @@ import (
)
var (
- // envOnce guards initialization by copyenv, which populates env.
+ // envOnce guards copyenv, which populates env.
envOnce sync.Once
// envLock guards env.
envLock sync.RWMutex
// env maps from an environment variable to its value.
- env map[string]string
+ env = make(map[string]string)
+
+ errZeroLengthKey = errors.New("zero length key")
+ errShortWrite = errors.New("i/o count too small")
)
func readenv(key string) (string, error) {
@@ -47,12 +50,18 @@ func writeenv(key, value string) error {
return err
}
defer Close(fd)
- _, err = Write(fd, []byte(value))
- return err
+ b := []byte(value)
+ n, err := Write(fd, b)
+ if err != nil {
+ return err
+ }
+ if n != len(b) {
+ return errShortWrite
+ }
+ return nil
}
func copyenv() {
- env = make(map[string]string)
fd, err := Open("/env", O_RDONLY)
if err != nil {
return
@@ -72,7 +81,6 @@ func copyenv() {
}
func Getenv(key string) (value string, found bool) {
- envOnce.Do(copyenv)
if len(key) == 0 {
return "", false
}
@@ -80,17 +88,20 @@ func Getenv(key string) (value string, found bool) {
envLock.RLock()
defer envLock.RUnlock()
- v, ok := env[key]
- if !ok {
+ if v, ok := env[key]; ok {
+ return v, true
+ }
+ v, err := readenv(key)
+ if err != nil {
return "", false
}
+ env[key] = v
return v, true
}
func Setenv(key, value string) error {
- envOnce.Do(copyenv)
if len(key) == 0 {
- return errors.New("zero length key")
+ return errZeroLengthKey
}
envLock.Lock()
@@ -105,8 +116,6 @@ func Setenv(key, value string) error {
}
func Clearenv() {
- envOnce.Do(copyenv) // prevent copyenv in Getenv/Setenv
-
envLock.Lock()
defer envLock.Unlock()
@@ -115,9 +124,10 @@ func Clearenv() {
}
func Environ() []string {
- envOnce.Do(copyenv)
envLock.RLock()
defer envLock.RUnlock()
+
+ envOnce.Do(copyenv)
a := make([]string, len(env))
i := 0
for k, v := range env {
diff --git a/libgo/go/syscall/libcall_linux_utimesnano.go b/libgo/go/syscall/libcall_linux_utimesnano.go
new file mode 100644
index 00000000000..043ab0d7135
--- /dev/null
+++ b/libgo/go/syscall/libcall_linux_utimesnano.go
@@ -0,0 +1,29 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// GNU/Linux version of UtimesNano.
+
+package syscall
+
+import "unsafe"
+
+//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
+//utimensat(dirfd int, path *byte, times *[2]Timespec, flags int) int
+func UtimesNano(path string, ts []Timespec) (err error) {
+ if len(ts) != 2 {
+ return EINVAL
+ }
+ err = utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
+ if err != ENOSYS {
+ return err
+ }
+ // If the utimensat syscall isn't available (utimensat was added to Linux
+ // in 2.6.22, Released, 8 July 2007) then fall back to utimes
+ var tv [2]Timeval
+ for i := 0; i < 2; i++ {
+ tv[i].Sec = Timeval_sec_t(ts[i].Sec)
+ tv[i].Usec = Timeval_usec_t(ts[i].Nsec / 1000)
+ }
+ return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
+}
diff --git a/libgo/go/syscall/libcall_posix_utimesnano.go b/libgo/go/syscall/libcall_posix_utimesnano.go
new file mode 100644
index 00000000000..e0751f5467d
--- /dev/null
+++ b/libgo/go/syscall/libcall_posix_utimesnano.go
@@ -0,0 +1,24 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// General POSIX version of UtimesNano.
+
+package syscall
+
+import "unsafe"
+
+func UtimesNano(path string, ts []Timespec) error {
+ // TODO: The BSDs can do utimensat with SYS_UTIMENSAT but it
+ // isn't supported by darwin so this uses utimes instead
+ if len(ts) != 2 {
+ return EINVAL
+ }
+ // Not as efficient as it could be because Timespec and
+ // Timeval have different types in the different OSes
+ tv := [2]Timeval{
+ NsecToTimeval(TimespecToNsec(ts[0])),
+ NsecToTimeval(TimespecToNsec(ts[1])),
+ }
+ return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
+}
diff --git a/libgo/go/syscall/syscall.go b/libgo/go/syscall/syscall.go
index 56296c84bf6..c4f2125140e 100644
--- a/libgo/go/syscall/syscall.go
+++ b/libgo/go/syscall/syscall.go
@@ -3,10 +3,15 @@
// license that can be found in the LICENSE file.
// Package syscall contains an interface to the low-level operating system
-// primitives. The details vary depending on the underlying system.
-// Its primary use is inside other packages that provide a more portable
-// interface to the system, such as "os", "time" and "net". Use those
-// packages rather than this one if you can.
+// primitives. The details vary depending on the underlying system, and
+// by default, godoc will display the syscall documentation for the current
+// system. If you want godoc to display syscall documentation for another
+// system, set $GOOS and $GOARCH to the desired system. For example, if
+// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
+// to freebsd and $GOARCH to arm.
+// The primary use of syscall is inside other packages that provide a more
+// portable interface to the system, such as "os", "time" and "net". Use
+// those packages rather than this one if you can.
// For details of the functions and data types in this package consult
// the manuals for the appropriate operating system.
// These calls return err == nil to indicate success; otherwise
diff --git a/libgo/go/testing/example.go b/libgo/go/testing/example.go
index 671c798760b..dc97255965e 100644
--- a/libgo/go/testing/example.go
+++ b/libgo/go/testing/example.go
@@ -24,7 +24,7 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int
var eg InternalExample
- stdout, stderr := os.Stdout, os.Stderr
+ stdout := os.Stdout
for _, eg = range examples {
matched, err := matchString(*match, eg.Name)
@@ -39,19 +39,19 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int
fmt.Printf("=== RUN: %s\n", eg.Name)
}
- // capture stdout and stderr
+ // capture stdout
r, w, err := os.Pipe()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
- os.Stdout, os.Stderr = w, w
+ os.Stdout = w
outC := make(chan string)
go func() {
buf := new(bytes.Buffer)
_, err := io.Copy(buf, r)
if err != nil {
- fmt.Fprintf(stderr, "testing: copying pipe: %v\n", err)
+ fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err)
os.Exit(1)
}
outC <- buf.String()
@@ -62,9 +62,9 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int
eg.F()
dt := time.Now().Sub(t0)
- // close pipe, restore stdout/stderr, get output
+ // close pipe, restore stdout, get output
w.Close()
- os.Stdout, os.Stderr = stdout, stderr
+ os.Stdout = stdout
out := <-outC
// report any errors
diff --git a/libgo/go/time/format.go b/libgo/go/time/format.go
index aab4a4d6b60..417e8f8d7a8 100644
--- a/libgo/go/time/format.go
+++ b/libgo/go/time/format.go
@@ -854,9 +854,15 @@ func Parse(layout, value string) (Time, error) {
zoneName = p
case stdFracSecond0:
- ndigit := std >> stdArgShift
- nsec, rangeErrString, err = parseNanoseconds(value, 1+ndigit)
- value = value[1+ndigit:]
+ // stdFracSecond0 requires the exact number of digits as specified in
+ // the layout.
+ ndigit := 1 + (std >> stdArgShift)
+ if len(value) < ndigit {
+ err = errBad
+ break
+ }
+ nsec, rangeErrString, err = parseNanoseconds(value, ndigit)
+ value = value[ndigit:]
case stdFracSecond9:
if len(value) < 2 || value[0] != '.' || value[1] < '0' || '9' < value[1] {
@@ -934,8 +940,7 @@ func parseNanoseconds(value string, nbytes int) (ns int, rangeErrString string,
err = errBad
return
}
- ns, err = atoi(value[1:nbytes])
- if err != nil {
+ if ns, err = atoi(value[1:nbytes]); err != nil {
return
}
if ns < 0 || 1e9 <= ns {
diff --git a/libgo/go/time/time_test.go b/libgo/go/time/time_test.go
index 1fd575b0956..0224fed4bdf 100644
--- a/libgo/go/time/time_test.go
+++ b/libgo/go/time/time_test.go
@@ -469,7 +469,7 @@ type ParseTest struct {
value string
hasTZ bool // contains a time zone
hasWD bool // contains a weekday
- yearSign int // sign of year
+ yearSign int // sign of year, -1 indicates the year is not present in the format
fracDigits int // number of digits of fractional second
}
@@ -514,6 +514,13 @@ var parseTests = []ParseTest{
{"", "2006-01-02 15:04:05.999999999 -0700 MST", "2010-02-04 21:00:57.0123 -0800 PST", true, false, 1, 4},
{"", "2006-01-02 15:04:05.9999 -0700 MST", "2010-02-04 21:00:57.012345678 -0800 PST", true, false, 1, 9},
{"", "2006-01-02 15:04:05.999999999 -0700 MST", "2010-02-04 21:00:57.012345678 -0800 PST", true, false, 1, 9},
+
+ // issue 4502.
+ {"", StampNano, "Feb 4 21:00:57.012345678", false, false, -1, 9},
+ {"", "Jan _2 15:04:05.999", "Feb 4 21:00:57.012300000", false, false, -1, 4},
+ {"", "Jan _2 15:04:05.999", "Feb 4 21:00:57.012345678", false, false, -1, 9},
+ {"", "Jan _2 15:04:05.999999999", "Feb 4 21:00:57.0123", false, false, -1, 4},
+ {"", "Jan _2 15:04:05.999999999", "Feb 4 21:00:57.012345678", false, false, -1, 9},
}
func TestParse(t *testing.T) {
@@ -549,7 +556,7 @@ func TestRubyParse(t *testing.T) {
func checkTime(time Time, test *ParseTest, t *testing.T) {
// The time should be Thu Feb 4 21:00:57 PST 2010
- if test.yearSign*time.Year() != 2010 {
+ if test.yearSign >= 0 && test.yearSign*time.Year() != 2010 {
t.Errorf("%s: bad year: %d not %d", test.name, time.Year(), 2010)
}
if time.Month() != February {
@@ -630,6 +637,9 @@ var parseErrorTests = []ParseErrorTest{
{"Mon Jan _2 15:04:05.000 2006", "Thu Feb 4 23:00:59x01 2010", "cannot parse"},
{"Mon Jan _2 15:04:05.000 2006", "Thu Feb 4 23:00:59.xxx 2010", "cannot parse"},
{"Mon Jan _2 15:04:05.000 2006", "Thu Feb 4 23:00:59.-123 2010", "fractional second out of range"},
+ // issue 4502. StampNano requires exactly 9 digits of precision.
+ {StampNano, "Dec 7 11:22:01.000000", `cannot parse ".000000" as ".000000000"`},
+ {StampNano, "Dec 7 11:22:01.0000000000", "extra text: 0"},
}
func TestParseErrors(t *testing.T) {
diff --git a/libgo/go/time/zoneinfo_read.go b/libgo/go/time/zoneinfo_read.go
index 0eb20c7637c..a5a2de218ef 100644
--- a/libgo/go/time/zoneinfo_read.go
+++ b/libgo/go/time/zoneinfo_read.go
@@ -174,7 +174,7 @@ func loadZoneData(bytes []byte) (l *Location, err error) {
}
}
- // Commited to succeed.
+ // Committed to succeed.
l = &Location{zone: zone, tx: tx}
// Fill in the cache with information about right now,
diff --git a/libgo/merge.sh b/libgo/merge.sh
index 79ece626d1a..ca358ac12a7 100755
--- a/libgo/merge.sh
+++ b/libgo/merge.sh
@@ -163,7 +163,7 @@ done
done
done
-runtime="chan.c cpuprof.c lock_futex.c lock_sema.c mcache.c mcentral.c mfinal.c mfixalloc.c mgc0.c mheap.c msize.c panic.c print.c proc.c race.h runtime.c runtime.h signal_unix.c malloc.h malloc.goc mprof.goc parfor.c runtime1.goc sema.goc sigqueue.goc string.goc time.goc"
+runtime="chan.c cpuprof.c env_posix.c lock_futex.c lock_sema.c mcache.c mcentral.c mfinal.c mfixalloc.c mgc0.c mgc0.h mheap.c msize.c panic.c print.c proc.c race.h runtime.c runtime.h signal_unix.c malloc.h malloc.goc mprof.goc parfor.c runtime1.goc sema.goc sigqueue.goc string.goc time.goc"
for f in $runtime; do
merge_c $f $f
done
diff --git a/libgo/runtime/env_posix.c b/libgo/runtime/env_posix.c
new file mode 100644
index 00000000000..31f41793530
--- /dev/null
+++ b/libgo/runtime/env_posix.c
@@ -0,0 +1,37 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build darwin freebsd linux netbsd openbsd windows
+
+#include "runtime.h"
+#include "array.h"
+
+extern Slice syscall_Envs asm ("syscall.Envs");
+
+const byte*
+runtime_getenv(const char *s)
+{
+ int32 i, j, len;
+ const byte *v, *bs;
+ String* envv;
+ int32 envc;
+
+ bs = (const byte*)s;
+ len = runtime_findnull(bs);
+ envv = (String*)syscall_Envs.__values;
+ envc = syscall_Envs.__count;
+ for(i=0; i<envc; i++){
+ if(envv[i].len <= len)
+ continue;
+ v = (const byte*)envv[i].str;
+ for(j=0; j<len; j++)
+ if(bs[j] != v[j])
+ goto nomatch;
+ if(v[len] != '=')
+ goto nomatch;
+ return v+len+1;
+ nomatch:;
+ }
+ return nil;
+}
diff --git a/libgo/runtime/go-trampoline.c b/libgo/runtime/go-trampoline.c
index 2d8d9e627e6..17f73d4f569 100644
--- a/libgo/runtime/go-trampoline.c
+++ b/libgo/runtime/go-trampoline.c
@@ -106,8 +106,8 @@ __go_allocate_trampoline (uintptr_t size, void *closure)
no other references to it. */
void
-runtime_trampoline_scan (void (*addroot) (byte *, uintptr))
+runtime_trampoline_scan (void (*addroot) (Obj))
{
if (trampoline_page != NULL)
- addroot ((byte *) &trampoline_page, sizeof trampoline_page);
+ addroot ((Obj){(byte *) &trampoline_page, sizeof trampoline_page, 0});
}
diff --git a/libgo/runtime/malloc.goc b/libgo/runtime/malloc.goc
index f1f3fcd7522..2a614e5a186 100644
--- a/libgo/runtime/malloc.goc
+++ b/libgo/runtime/malloc.goc
@@ -491,7 +491,7 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n)
static Lock settype_lock;
void
-runtime_settype_flush(M *m, bool sysalloc)
+runtime_settype_flush(M *mp, bool sysalloc)
{
uintptr *buf, *endbuf;
uintptr size, ofs, j, t;
@@ -503,8 +503,8 @@ runtime_settype_flush(M *m, bool sysalloc)
uintptr typ, p;
MSpan *s;
- buf = m->settype_buf;
- endbuf = buf + m->settype_bufsize;
+ buf = mp->settype_buf;
+ endbuf = buf + mp->settype_bufsize;
runtime_lock(&settype_lock);
while(buf < endbuf) {
@@ -602,7 +602,7 @@ runtime_settype_flush(M *m, bool sysalloc)
}
runtime_unlock(&settype_lock);
- m->settype_bufsize = 0;
+ mp->settype_bufsize = 0;
}
// It is forbidden to use this function if it is possible that
@@ -610,7 +610,7 @@ runtime_settype_flush(M *m, bool sysalloc)
void
runtime_settype(void *v, uintptr t)
{
- M *m1;
+ M *mp;
uintptr *buf;
uintptr i;
MSpan *s;
@@ -618,16 +618,16 @@ runtime_settype(void *v, uintptr t)
if(t == 0)
runtime_throw("settype: zero type");
- m1 = runtime_m();
- buf = m1->settype_buf;
- i = m1->settype_bufsize;
+ mp = runtime_m();
+ buf = mp->settype_buf;
+ i = mp->settype_bufsize;
buf[i+0] = (uintptr)v;
buf[i+1] = t;
i += 2;
- m1->settype_bufsize = i;
+ mp->settype_bufsize = i;
- if(i == nelem(m1->settype_buf)) {
- runtime_settype_flush(m1, false);
+ if(i == nelem(mp->settype_buf)) {
+ runtime_settype_flush(mp, false);
}
if(DebugTypeAtBlockEnd) {
diff --git a/libgo/runtime/malloc.h b/libgo/runtime/malloc.h
index b3baaec0fcd..710484edecf 100644
--- a/libgo/runtime/malloc.h
+++ b/libgo/runtime/malloc.h
@@ -468,17 +468,25 @@ enum
FlagNoGC = 1<<2, // must not free or scan for pointers
};
+typedef struct Obj Obj;
+struct Obj
+{
+ byte *p; // data pointer
+ uintptr n; // size of data in bytes
+ uintptr ti; // type info
+};
+
void runtime_MProf_Malloc(void*, uintptr);
void runtime_MProf_Free(void*, uintptr);
void runtime_MProf_GC(void);
-void runtime_MProf_Mark(void (*addroot)(byte *, uintptr));
+void runtime_MProf_Mark(void (*addroot)(Obj));
int32 runtime_gcprocs(void);
void runtime_helpgc(int32 nproc);
void runtime_gchelper(void);
struct __go_func_type;
bool runtime_getfinalizer(void *p, bool del, void (**fn)(void*), const struct __go_func_type **ft);
-void runtime_walkfintab(void (*fn)(void*), void (*scan)(byte *, uintptr));
+void runtime_walkfintab(void (*fn)(void*), void (*scan)(Obj));
enum
{
@@ -494,3 +502,6 @@ enum
void runtime_gc_m_ptr(Eface*);
void runtime_memorydump(void);
+
+void runtime_time_scan(void (*)(Obj));
+void runtime_trampoline_scan(void (*)(Obj));
diff --git a/libgo/runtime/mfinal.c b/libgo/runtime/mfinal.c
index f2f640ad2fb..7c906daf347 100644
--- a/libgo/runtime/mfinal.c
+++ b/libgo/runtime/mfinal.c
@@ -193,7 +193,7 @@ runtime_getfinalizer(void *p, bool del, void (**fn)(void*), const struct __go_fu
}
void
-runtime_walkfintab(void (*fn)(void*), void (*addroot)(byte *, uintptr))
+runtime_walkfintab(void (*fn)(void*), void (*addroot)(Obj))
{
void **key;
void **ekey;
@@ -206,8 +206,8 @@ runtime_walkfintab(void (*fn)(void*), void (*addroot)(byte *, uintptr))
for(; key < ekey; key++)
if(*key != nil && *key != ((void*)-1))
fn(*key);
- addroot((byte*)&fintab[i].fkey, sizeof(void*));
- addroot((byte*)&fintab[i].val, sizeof(void*));
+ addroot((Obj){(byte*)&fintab[i].fkey, sizeof(void*), 0});
+ addroot((Obj){(byte*)&fintab[i].val, sizeof(void*), 0});
runtime_unlock(&fintab[i]);
}
}
diff --git a/libgo/runtime/mgc0.c b/libgo/runtime/mgc0.c
index 45f8a56ca75..698400b0c50 100644
--- a/libgo/runtime/mgc0.c
+++ b/libgo/runtime/mgc0.c
@@ -9,6 +9,7 @@
#include "runtime.h"
#include "arch.h"
#include "malloc.h"
+#include "mgc0.h"
#include "race.h"
#ifdef USING_SPLIT_STACK
@@ -24,11 +25,13 @@ extern void * __splitstack_find_context (void *context[10], size_t *, void **,
enum {
Debug = 0,
DebugMark = 0, // run second pass to check mark
- DataBlock = 8*1024,
// Four bits per word (see #defines below).
wordsPerBitmapWord = sizeof(void*)*8/4,
bitShift = sizeof(void*)*8/4,
+
+ handoffThreshold = 4,
+ IntermediateBufferCapacity = 64,
};
// Bits in per-word bitmap.
@@ -81,12 +84,16 @@ uint32 runtime_worldsema = 1;
static int32 gctrace;
+// The size of Workbuf is N*PageSize.
typedef struct Workbuf Workbuf;
struct Workbuf
{
- LFNode node; // must be first
+#define SIZE (2*PageSize-sizeof(LFNode)-sizeof(uintptr))
+ LFNode node; // must be first
uintptr nobj;
- byte *obj[512-(sizeof(LFNode)+sizeof(uintptr))/sizeof(byte*)];
+ Obj obj[SIZE/sizeof(Obj) - 1];
+ uint8 _padding[SIZE%sizeof(Obj) + sizeof(Obj)];
+#undef SIZE
};
typedef struct Finalizer Finalizer;
@@ -120,13 +127,6 @@ static Workbuf* getfull(Workbuf*);
static void putempty(Workbuf*);
static Workbuf* handoff(Workbuf*);
-typedef struct GcRoot GcRoot;
-struct GcRoot
-{
- byte *p;
- uintptr n;
-};
-
static struct {
uint64 full; // lock-free list of full blocks
uint64 empty; // lock-free list of empty blocks
@@ -143,77 +143,122 @@ static struct {
byte *chunk;
uintptr nchunk;
- GcRoot *roots;
+ Obj *roots;
uint32 nroot;
uint32 rootcap;
} work;
-// scanblock scans a block of n bytes starting at pointer b for references
-// to other objects, scanning any it finds recursively until there are no
-// unscanned objects left. Instead of using an explicit recursion, it keeps
-// a work list in the Workbuf* structures and loops in the main function
-// body. Keeping an explicit work list is easier on the stack allocator and
-// more efficient.
+enum {
+ // TODO(atom): to be expanded in a next CL
+ GC_DEFAULT_PTR = GC_NUM_INSTR,
+};
+
+// PtrTarget and BitTarget are structures used by intermediate buffers.
+// The intermediate buffers hold GC data before it
+// is moved/flushed to the work buffer (Workbuf).
+// The size of an intermediate buffer is very small,
+// such as 32 or 64 elements.
+struct PtrTarget
+{
+ void *p;
+ uintptr ti;
+};
+
+struct BitTarget
+{
+ void *p;
+ uintptr ti;
+ uintptr *bitp, shift;
+};
+
+struct BufferList
+{
+ struct PtrTarget ptrtarget[IntermediateBufferCapacity];
+ struct BitTarget bittarget[IntermediateBufferCapacity];
+ struct BufferList *next;
+};
+static struct BufferList *bufferList;
+
+static Lock lock;
+
+// flushptrbuf moves data from the PtrTarget buffer to the work buffer.
+// The PtrTarget buffer contains blocks irrespective of whether the blocks have been marked or scanned,
+// while the work buffer contains blocks which have been marked
+// and are prepared to be scanned by the garbage collector.
+//
+// _wp, _wbuf, _nobj are input/output parameters and are specifying the work buffer.
+// bitbuf holds temporary data generated by this function.
+//
+// A simplified drawing explaining how the todo-list moves from a structure to another:
+//
+// scanblock
+// (find pointers)
+// Obj ------> PtrTarget (pointer targets)
+// ↑ |
+// | | flushptrbuf (1st part,
+// | | find block start)
+// | ↓
+// `--------- BitTarget (pointer targets and the corresponding locations in bitmap)
+// flushptrbuf
+// (2nd part, mark and enqueue)
static void
-scanblock(byte *b, uintptr n)
+flushptrbuf(struct PtrTarget *ptrbuf, uintptr n, Obj **_wp, Workbuf **_wbuf, uintptr *_nobj, struct BitTarget *bitbuf)
{
- byte *obj, *arena_start, *arena_used, *p;
- void **vp;
- uintptr size, *bitp, bits, shift, i, j, x, xbits, off, nobj, nproc;
+ byte *p, *arena_start, *obj;
+ uintptr size, *bitp, bits, shift, j, x, xbits, off, nobj, ti;
MSpan *s;
PageID k;
- void **wp;
+ Obj *wp;
Workbuf *wbuf;
- bool keepworking;
-
- if((intptr)n < 0) {
- runtime_printf("scanblock %p %D\n", b, (int64)n);
- runtime_throw("scanblock");
- }
+ struct PtrTarget *ptrbuf_end;
+ struct BitTarget *bitbufpos, *bt;
- // Memory arena parameters.
arena_start = runtime_mheap.arena_start;
- arena_used = runtime_mheap.arena_used;
- nproc = work.nproc;
- wbuf = nil; // current work buffer
- wp = nil; // storage for next queued pointer (write pointer)
- nobj = 0; // number of queued objects
+ wp = *_wp;
+ wbuf = *_wbuf;
+ nobj = *_nobj;
- // Scanblock helpers pass b==nil.
- // Procs needs to return to make more
- // calls to scanblock. But if work.nproc==1 then
- // might as well process blocks as soon as we
- // have them.
- keepworking = b == nil || work.nproc == 1;
+ ptrbuf_end = ptrbuf + n;
- // Align b to a word boundary.
- off = (uintptr)b & (PtrSize-1);
- if(off != 0) {
- b += PtrSize - off;
- n -= PtrSize - off;
+ // If buffer is nearly full, get a new one.
+ if(wbuf == nil || nobj+n >= nelem(wbuf->obj)) {
+ if(wbuf != nil)
+ wbuf->nobj = nobj;
+ wbuf = getempty(wbuf);
+ wp = wbuf->obj;
+ nobj = 0;
+
+ if(n >= nelem(wbuf->obj))
+ runtime_throw("ptrbuf has to be smaller than WorkBuf");
}
- for(;;) {
- // Each iteration scans the block b of length n, queueing pointers in
- // the work buffer.
- if(Debug > 1)
- runtime_printf("scanblock %p %D\n", b, (int64)n);
+ // TODO(atom): This block is a branch of an if-then-else statement.
+ // The single-threaded branch may be added in a next CL.
+ {
+ // Multi-threaded version.
- vp = (void**)b;
- n >>= (2+PtrSize/8); /* n /= PtrSize (4 or 8) */
- for(i=0; i<(uintptr)n; i++) {
- obj = (byte*)vp[i];
+ bitbufpos = bitbuf;
- // Words outside the arena cannot be pointers.
- if((byte*)obj < arena_start || (byte*)obj >= arena_used)
- continue;
+ while(ptrbuf < ptrbuf_end) {
+ obj = ptrbuf->p;
+ ti = ptrbuf->ti;
+ ptrbuf++;
+
+ // obj belongs to interval [mheap.arena_start, mheap.arena_used).
+ if(Debug > 1) {
+ if(obj < runtime_mheap.arena_start || obj >= runtime_mheap.arena_used)
+ runtime_throw("object is outside of mheap");
+ }
// obj may be a pointer to a live object.
// Try to find the beginning of the object.
// Round down to word boundary.
- obj = (void*)((uintptr)obj & ~((uintptr)PtrSize-1));
+ if(((uintptr)obj & ((uintptr)PtrSize-1)) != 0) {
+ obj = (void*)((uintptr)obj & ~((uintptr)PtrSize-1));
+ ti = 0;
+ }
// Find bits for this word.
off = (uintptr*)obj - (uintptr*)arena_start;
@@ -226,6 +271,8 @@ scanblock(byte *b, uintptr n)
if((bits & (bitAllocated|bitBlockBoundary)) != 0)
goto found;
+ ti = 0;
+
// Pointing just past the beginning?
// Scan backward a little to find a block boundary.
for(j=shift; j-->0; ) {
@@ -246,13 +293,13 @@ scanblock(byte *b, uintptr n)
s = runtime_mheap.map[x];
if(s == nil || k < s->start || k - s->start >= s->npages || s->state != MSpanInUse)
continue;
- p = (byte*)((uintptr)s->start<<PageShift);
+ p = (byte*)((uintptr)s->start<<PageShift);
if(s->sizeclass == 0) {
obj = p;
} else {
if((byte*)obj >= (byte*)s->limit)
continue;
- size = runtime_class_to_size[s->sizeclass];
+ size = s->elemsize;
int32 i = ((byte*)obj - p)/size;
obj = p+i*size;
}
@@ -265,81 +312,203 @@ scanblock(byte *b, uintptr n)
bits = xbits >> shift;
found:
- // If another proc wants a pointer, give it some.
- if(work.nwait > 0 && nobj > 4 && work.full == 0) {
- wbuf->nobj = nobj;
- wbuf = handoff(wbuf);
- nobj = wbuf->nobj;
- wp = (void**)(wbuf->obj + nobj);
- }
-
// Now we have bits, bitp, and shift correct for
// obj pointing at the base of the object.
// Only care about allocated and not marked.
if((bits & (bitAllocated|bitMarked)) != bitAllocated)
continue;
- if(nproc == 1)
- *bitp |= bitMarked<<shift;
- else {
- for(;;) {
- x = *bitp;
- if(x & (bitMarked<<shift))
- goto continue_obj;
- if(runtime_casp((void**)bitp, (void*)x, (void*)(x|(bitMarked<<shift))))
- break;
- }
- }
+
+ *bitbufpos = (struct BitTarget){obj, ti, bitp, shift};
+ bitbufpos++;
+ }
+
+ runtime_lock(&lock);
+ for(bt=bitbuf; bt<bitbufpos; bt++){
+ xbits = *bt->bitp;
+ bits = xbits >> bt->shift;
+ if((bits & bitMarked) != 0)
+ continue;
+
+ // Mark the block
+ *bt->bitp = xbits | (bitMarked << bt->shift);
// If object has no pointers, don't need to scan further.
if((bits & bitNoPointers) != 0)
continue;
+ obj = bt->p;
+
+ // Ask span about size class.
+ // (Manually inlined copy of MHeap_Lookup.)
+ x = (uintptr)obj >> PageShift;
+ if(sizeof(void*) == 8)
+ x -= (uintptr)arena_start>>PageShift;
+ s = runtime_mheap.map[x];
+
PREFETCH(obj);
- // If buffer is full, get a new one.
- if(wbuf == nil || nobj >= nelem(wbuf->obj)) {
- if(wbuf != nil)
- wbuf->nobj = nobj;
- wbuf = getempty(wbuf);
- wp = (void**)(wbuf->obj);
- nobj = 0;
- }
- *wp++ = obj;
+ *wp = (Obj){obj, s->elemsize, bt->ti};
+ wp++;
nobj++;
- continue_obj:;
}
+ runtime_unlock(&lock);
+
+ // If another proc wants a pointer, give it some.
+ if(work.nwait > 0 && nobj > handoffThreshold && work.full == 0) {
+ wbuf->nobj = nobj;
+ wbuf = handoff(wbuf);
+ nobj = wbuf->nobj;
+ wp = wbuf->obj + nobj;
+ }
+ }
+
+ *_wp = wp;
+ *_wbuf = wbuf;
+ *_nobj = nobj;
+}
+
+// Program that scans the whole block and treats every block element as a potential pointer
+static uintptr defaultProg[2] = {PtrSize, GC_DEFAULT_PTR};
+
+// scanblock scans a block of n bytes starting at pointer b for references
+// to other objects, scanning any it finds recursively until there are no
+// unscanned objects left. Instead of using an explicit recursion, it keeps
+// a work list in the Workbuf* structures and loops in the main function
+// body. Keeping an explicit work list is easier on the stack allocator and
+// more efficient.
+//
+// wbuf: current work buffer
+// wp: storage for next queued pointer (write pointer)
+// nobj: number of queued objects
+static void
+scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
+{
+ byte *b, *arena_start, *arena_used;
+ uintptr n, i, end_b;
+ void *obj;
+
+ // TODO(atom): to be expanded in a next CL
+ struct Frame {uintptr count, b; uintptr *loop_or_ret;};
+ struct Frame stack_top;
+
+ uintptr *pc;
+
+ struct BufferList *scanbuffers;
+ struct PtrTarget *ptrbuf, *ptrbuf_end;
+ struct BitTarget *bitbuf;
+
+ struct PtrTarget *ptrbufpos;
+
+ // End of local variable declarations.
+
+ if(sizeof(Workbuf) % PageSize != 0)
+ runtime_throw("scanblock: size of Workbuf is suboptimal");
+
+ // Memory arena parameters.
+ arena_start = runtime_mheap.arena_start;
+ arena_used = runtime_mheap.arena_used;
+
+ // Allocate ptrbuf, bitbuf
+ {
+ runtime_lock(&lock);
+
+ if(bufferList == nil) {
+ bufferList = runtime_SysAlloc(sizeof(*bufferList));
+ bufferList->next = nil;
+ }
+ scanbuffers = bufferList;
+ bufferList = bufferList->next;
+
+ ptrbuf = &scanbuffers->ptrtarget[0];
+ ptrbuf_end = &scanbuffers->ptrtarget[0] + nelem(scanbuffers->ptrtarget);
+ bitbuf = &scanbuffers->bittarget[0];
+
+ runtime_unlock(&lock);
+ }
+
+ ptrbufpos = ptrbuf;
+
+ goto next_block;
+ for(;;) {
+ // Each iteration scans the block b of length n, queueing pointers in
+ // the work buffer.
+ if(Debug > 1) {
+ runtime_printf("scanblock %p %D\n", b, (int64)n);
+ }
+
+ // TODO(atom): to be replaced in a next CL
+ pc = defaultProg;
+
+ pc++;
+ stack_top.b = (uintptr)b;
+
+ end_b = (uintptr)b + n - PtrSize;
+
+ next_instr:
+ // TODO(atom): to be expanded in a next CL
+ switch(pc[0]) {
+ case GC_DEFAULT_PTR:
+ while(true) {
+ i = stack_top.b;
+ if(i > end_b)
+ goto next_block;
+ stack_top.b += PtrSize;
+
+ obj = *(byte**)i;
+ if((byte*)obj >= arena_start && (byte*)obj < arena_used) {
+ *ptrbufpos = (struct PtrTarget){obj, 0};
+ ptrbufpos++;
+ if(ptrbufpos == ptrbuf_end)
+ goto flush_buffers;
+ }
+ }
+
+ default:
+ runtime_throw("scanblock: invalid GC instruction");
+ return;
+ }
+
+ flush_buffers:
+ flushptrbuf(ptrbuf, ptrbufpos-ptrbuf, &wp, &wbuf, &nobj, bitbuf);
+ ptrbufpos = ptrbuf;
+ goto next_instr;
+
+ next_block:
// Done scanning [b, b+n). Prepare for the next iteration of
- // the loop by setting b and n to the parameters for the next block.
+ // the loop by setting b, n to the parameters for the next block.
- // Fetch b from the work buffer.
if(nobj == 0) {
- if(!keepworking) {
- if(wbuf)
- putempty(wbuf);
- return;
+ flushptrbuf(ptrbuf, ptrbufpos-ptrbuf, &wp, &wbuf, &nobj, bitbuf);
+ ptrbufpos = ptrbuf;
+
+ if(nobj == 0) {
+ if(!keepworking) {
+ if(wbuf)
+ putempty(wbuf);
+ goto endscan;
+ }
+ // Emptied our buffer: refill.
+ wbuf = getfull(wbuf);
+ if(wbuf == nil)
+ goto endscan;
+ nobj = wbuf->nobj;
+ wp = wbuf->obj + wbuf->nobj;
}
- // Emptied our buffer: refill.
- wbuf = getfull(wbuf);
- if(wbuf == nil)
- return;
- nobj = wbuf->nobj;
- wp = (void**)(wbuf->obj + wbuf->nobj);
}
- b = *--wp;
- nobj--;
- // Ask span about size class.
- // (Manually inlined copy of MHeap_Lookup.)
- x = (uintptr)b>>PageShift;
- if(sizeof(void*) == 8)
- x -= (uintptr)arena_start>>PageShift;
- s = runtime_mheap.map[x];
- if(s->sizeclass == 0)
- n = s->npages<<PageShift;
- else
- n = runtime_class_to_size[s->sizeclass];
+ // Fetch b from the work buffer.
+ --wp;
+ b = wp->p;
+ n = wp->n;
+ nobj--;
}
+
+endscan:
+ runtime_lock(&lock);
+ scanbuffers->next = bufferList;
+ bufferList = scanbuffers;
+ runtime_unlock(&lock);
}
// debug_scanblock is the debug copy of scanblock.
@@ -386,13 +555,12 @@ debug_scanblock(byte *b, uintptr n)
continue;
p = (byte*)((uintptr)s->start<<PageShift);
+ size = s->elemsize;
if(s->sizeclass == 0) {
obj = p;
- size = (uintptr)s->npages<<PageShift;
} else {
if((byte*)obj >= (byte*)s->limit)
continue;
- size = runtime_class_to_size[s->sizeclass];
int32 i = ((byte*)obj - p)/size;
obj = p+i*size;
}
@@ -421,11 +589,74 @@ debug_scanblock(byte *b, uintptr n)
}
}
+// Append obj to the work buffer.
+// _wbuf, _wp, _nobj are input/output parameters and are specifying the work buffer.
+static void
+enqueue(Obj obj, Workbuf **_wbuf, Obj **_wp, uintptr *_nobj)
+{
+ uintptr nobj, off;
+ Obj *wp;
+ Workbuf *wbuf;
+
+ if(Debug > 1)
+ runtime_printf("append obj(%p %D %p)\n", obj.p, (int64)obj.n, obj.ti);
+
+ // Align obj.b to a word boundary.
+ off = (uintptr)obj.p & (PtrSize-1);
+ if(off != 0) {
+ obj.p += PtrSize - off;
+ obj.n -= PtrSize - off;
+ obj.ti = 0;
+ }
+
+ if(obj.p == nil || obj.n == 0)
+ return;
+
+ // Load work buffer state
+ wp = *_wp;
+ wbuf = *_wbuf;
+ nobj = *_nobj;
+
+ // If another proc wants a pointer, give it some.
+ if(work.nwait > 0 && nobj > handoffThreshold && work.full == 0) {
+ wbuf->nobj = nobj;
+ wbuf = handoff(wbuf);
+ nobj = wbuf->nobj;
+ wp = wbuf->obj + nobj;
+ }
+
+ // If buffer is full, get a new one.
+ if(wbuf == nil || nobj >= nelem(wbuf->obj)) {
+ if(wbuf != nil)
+ wbuf->nobj = nobj;
+ wbuf = getempty(wbuf);
+ wp = wbuf->obj;
+ nobj = 0;
+ }
+
+ *wp = obj;
+ wp++;
+ nobj++;
+
+ // Save work buffer state
+ *_wp = wp;
+ *_wbuf = wbuf;
+ *_nobj = nobj;
+}
+
static void
markroot(ParFor *desc, uint32 i)
{
+ Obj *wp;
+ Workbuf *wbuf;
+ uintptr nobj;
+
USED(&desc);
- scanblock(work.roots[i].p, work.roots[i].n);
+ wp = nil;
+ wbuf = nil;
+ nobj = 0;
+ enqueue(work.roots[i], &wbuf, &wp, &nobj);
+ scanblock(wbuf, wp, nobj, false);
}
// Get an empty work buffer off the work.empty list,
@@ -520,25 +751,24 @@ handoff(Workbuf *b)
}
static void
-addroot(byte *p, uintptr n)
+addroot(Obj obj)
{
uint32 cap;
- GcRoot *new;
+ Obj *new;
if(work.nroot >= work.rootcap) {
- cap = PageSize/sizeof(GcRoot);
+ cap = PageSize/sizeof(Obj);
if(cap < 2*work.rootcap)
cap = 2*work.rootcap;
- new = (GcRoot*)runtime_SysAlloc(cap*sizeof(GcRoot));
+ new = (Obj*)runtime_SysAlloc(cap*sizeof(Obj));
if(work.roots != nil) {
- runtime_memmove(new, work.roots, work.rootcap*sizeof(GcRoot));
- runtime_SysFree(work.roots, work.rootcap*sizeof(GcRoot));
+ runtime_memmove(new, work.roots, work.rootcap*sizeof(Obj));
+ runtime_SysFree(work.roots, work.rootcap*sizeof(Obj));
}
work.roots = new;
work.rootcap = cap;
}
- work.roots[work.nroot].p = p;
- work.roots[work.nroot].n = n;
+ work.roots[work.nroot] = obj;
work.nroot++;
}
@@ -582,11 +812,11 @@ addstackroots(G *gp)
}
}
if(sp != nil) {
- addroot(sp, spsize);
+ addroot((Obj){sp, spsize, 0});
while((sp = __splitstack_find(next_segment, next_sp,
&spsize, &next_segment,
&next_sp, &initial_sp)) != nil)
- addroot(sp, spsize);
+ addroot((Obj){sp, spsize, 0});
}
#else
M *mp;
@@ -608,9 +838,9 @@ addstackroots(G *gp)
}
top = (byte*)gp->gcinitial_sp + gp->gcstack_size;
if(top > bottom)
- addroot(bottom, top - bottom);
+ addroot((Obj){bottom, top - bottom, 0});
else
- addroot(top, bottom - top);
+ addroot((Obj){top, bottom - top, 0});
#endif
}
@@ -624,7 +854,7 @@ addfinroots(void *v)
runtime_throw("mark - finalizer inconsistency");
// do not mark the finalizer block itself. just mark the things it points at.
- addroot(v, size);
+ addroot((Obj){v, size, 0});
}
static struct root_list* roots;
@@ -656,15 +886,15 @@ addroots(void)
void *decl = pr->decl;
if(decl == nil)
break;
- addroot(decl, pr->size);
+ addroot((Obj){decl, pr->size, 0});
pr++;
}
}
- addroot((byte*)&runtime_m0, sizeof runtime_m0);
- addroot((byte*)&runtime_g0, sizeof runtime_g0);
- addroot((byte*)&runtime_allg, sizeof runtime_allg);
- addroot((byte*)&runtime_allm, sizeof runtime_allm);
+ addroot((Obj){(byte*)&runtime_m0, sizeof runtime_m0, 0});
+ addroot((Obj){(byte*)&runtime_g0, sizeof runtime_g0, 0});
+ addroot((Obj){(byte*)&runtime_allg, sizeof runtime_allg, 0});
+ addroot((Obj){(byte*)&runtime_allm, sizeof runtime_allm, 0});
runtime_MProf_Mark(addroot);
runtime_time_scan(addroot);
runtime_trampoline_scan(addroot);
@@ -680,12 +910,14 @@ addroots(void)
break;
case MTypes_Words:
case MTypes_Bytes:
- addroot((byte*)&s->types.data, sizeof(void*));
+ // TODO(atom): consider using defaultProg instead of 0
+ addroot((Obj){(byte*)&s->types.data, sizeof(void*), 0});
break;
}
}
}
+ // stacks
for(gp=runtime_allg; gp!=nil; gp=gp->alllink) {
switch(gp->status){
default:
@@ -709,9 +941,9 @@ addroots(void)
runtime_walkfintab(addfinroots, addroot);
for(fb=allfin; fb; fb=fb->alllink)
- addroot((byte*)fb->fin, fb->cnt*sizeof(fb->fin[0]));
+ addroot((Obj){(byte*)fb->fin, fb->cnt*sizeof(fb->fin[0]), 0});
- addroot((byte*)&work, sizeof work);
+ addroot((Obj){(byte*)&work, sizeof work, 0});
}
static bool
@@ -955,8 +1187,9 @@ runtime_gchelper(void)
{
// parallel mark for over gc roots
runtime_parfordo(work.markfor);
+
// help other threads scan secondary blocks
- scanblock(nil, 0);
+ scanblock(nil, nil, 0, true);
if(DebugMark) {
// wait while the main thread executes mark(debug_scanblock)
@@ -983,16 +1216,16 @@ static int32 gcpercent = -2;
static void
stealcache(void)
{
- M *m;
+ M *mp;
- for(m=runtime_allm; m; m=m->alllink)
- runtime_MCache_ReleaseAll(m->mcache);
+ for(mp=runtime_allm; mp; mp=mp->alllink)
+ runtime_MCache_ReleaseAll(mp->mcache);
}
static void
cachestats(GCStats *stats)
{
- M *m;
+ M *mp;
MCache *c;
uint32 i;
uint64 stacks_inuse;
@@ -1003,17 +1236,17 @@ cachestats(GCStats *stats)
runtime_memclr((byte*)stats, sizeof(*stats));
stacks_inuse = 0;
stacks_sys = runtime_stacks_sys;
- for(m=runtime_allm; m; m=m->alllink) {
- c = m->mcache;
+ for(mp=runtime_allm; mp; mp=mp->alllink) {
+ c = mp->mcache;
runtime_purgecachedstats(c);
- // stacks_inuse += m->stackalloc->inuse;
- // stacks_sys += m->stackalloc->sys;
+ // stacks_inuse += mp->stackalloc->inuse;
+ // stacks_sys += mp->stackalloc->sys;
if(stats) {
- src = (uint64*)&m->gcstats;
+ src = (uint64*)&mp->gcstats;
dst = (uint64*)stats;
for(i=0; i<sizeof(*stats)/sizeof(uint64); i++)
dst[i] += src[i];
- runtime_memclr((byte*)&m->gcstats, sizeof(m->gcstats));
+ runtime_memclr((byte*)&mp->gcstats, sizeof(mp->gcstats));
}
for(i=0; i<nelem(c->local_by_size); i++) {
mstats.by_size[i].nmalloc += c->local_by_size[i].nmalloc;
@@ -1100,7 +1333,7 @@ gc(struct gc_args *args)
int64 t0, t1, t2, t3;
uint64 heap0, heap1, obj0, obj1;
GCStats stats;
- M *m1;
+ M *mp;
uint32 i;
runtime_semacquire(&runtime_worldsema);
@@ -1116,8 +1349,8 @@ gc(struct gc_args *args)
m->gcing = 1;
runtime_stoptheworld();
- for(m1=runtime_allm; m1; m1=m1->alllink)
- runtime_settype_flush(m1, false);
+ for(mp=runtime_allm; mp; mp=mp->alllink)
+ runtime_settype_flush(mp, false);
heap0 = 0;
obj0 = 0;
@@ -1127,26 +1360,27 @@ gc(struct gc_args *args)
obj0 = mstats.nmalloc - mstats.nfree;
}
+ m->locks++; // disable gc during mallocs in parforalloc
+ if(work.markfor == nil)
+ work.markfor = runtime_parforalloc(MaxGcproc);
+ if(work.sweepfor == nil)
+ work.sweepfor = runtime_parforalloc(MaxGcproc);
+ m->locks--;
+
work.nwait = 0;
work.ndone = 0;
work.debugmarkdone = 0;
work.nproc = runtime_gcprocs();
addroots();
- m->locks++; // disable gc during mallocs in parforalloc
- if(work.markfor == nil)
- work.markfor = runtime_parforalloc(MaxGcproc);
runtime_parforsetup(work.markfor, work.nproc, work.nroot, nil, false, markroot);
- if(work.sweepfor == nil)
- work.sweepfor = runtime_parforalloc(MaxGcproc);
runtime_parforsetup(work.sweepfor, work.nproc, runtime_mheap.nspan, nil, true, sweepspan);
- m->locks--;
if(work.nproc > 1) {
runtime_noteclear(&work.alldone);
runtime_helpgc(work.nproc);
}
runtime_parfordo(work.markfor);
- scanblock(nil, 0);
+ scanblock(nil, nil, 0, true);
if(DebugMark) {
for(i=0; i<work.nroot; i++)
diff --git a/libgo/runtime/mgc0.h b/libgo/runtime/mgc0.h
new file mode 100644
index 00000000000..a2798ef34e2
--- /dev/null
+++ b/libgo/runtime/mgc0.h
@@ -0,0 +1,42 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Garbage collector (GC)
+
+// GC instruction opcodes.
+//
+// The opcode of an instruction is followed by zero or more
+// arguments to the instruction.
+//
+// Meaning of arguments:
+// off Offset (in bytes) from the start of the current object
+// objgc Pointer to GC info of an object
+// len Length of an array
+// elemsize Size (in bytes) of an element
+// size Size (in bytes)
+enum {
+ GC_END, // End of object, loop or subroutine. Args: none
+ GC_PTR, // A typed pointer. Args: (off, objgc)
+ GC_APTR, // Pointer to an arbitrary object. Args: (off)
+ GC_ARRAY_START, // Start an array with a fixed length. Args: (off, len, elemsize)
+ GC_ARRAY_NEXT, // The next element of an array. Args: none
+ GC_CALL, // Call a subroutine. Args: (off, objgc)
+ GC_MAP_PTR, // Go map. Args: (off, MapType*)
+ GC_STRING, // Go string. Args: (off)
+ GC_EFACE, // interface{}. Args: (off)
+ GC_IFACE, // interface{...}. Args: (off)
+ GC_SLICE, // Go slice. Args: (off, objgc)
+ GC_REGION, // A region/part of the current object. Args: (off, size, objgc)
+
+ GC_NUM_INSTR, // Number of instruction opcodes
+};
+
+enum {
+ // Size of GC's fixed stack.
+ //
+ // The current GC implementation permits:
+ // - at most 1 stack allocation because of GC_CALL
+ // - at most GC_STACK_CAPACITY allocations because of GC_ARRAY_START
+ GC_STACK_CAPACITY = 8,
+};
diff --git a/libgo/runtime/mprof.goc b/libgo/runtime/mprof.goc
index a92ef40b03b..8b3a195b890 100644
--- a/libgo/runtime/mprof.goc
+++ b/libgo/runtime/mprof.goc
@@ -362,13 +362,13 @@ func MemProfile(p Slice, include_inuse_zero bool) (n int, ok bool) {
}
void
-runtime_MProf_Mark(void (*addroot)(byte *, uintptr))
+runtime_MProf_Mark(void (*addroot)(Obj))
{
// buckhash is not allocated via mallocgc.
- addroot((byte*)&mbuckets, sizeof mbuckets);
- addroot((byte*)&bbuckets, sizeof bbuckets);
- addroot((byte*)&addrhash, sizeof addrhash);
- addroot((byte*)&addrfree, sizeof addrfree);
+ addroot((Obj){(byte*)&mbuckets, sizeof mbuckets, 0});
+ addroot((Obj){(byte*)&bbuckets, sizeof bbuckets, 0});
+ addroot((Obj){(byte*)&addrhash, sizeof addrhash, 0});
+ addroot((Obj){(byte*)&addrfree, sizeof addrfree, 0});
}
// Must match BlockProfileRecord in debug.go.
@@ -412,18 +412,18 @@ struct TRecord {
func ThreadCreateProfile(p Slice) (n int, ok bool) {
TRecord *r;
- M *first, *m;
+ M *first, *mp;
first = runtime_atomicloadp(&runtime_allm);
n = 0;
- for(m=first; m; m=m->alllink)
+ for(mp=first; mp; mp=mp->alllink)
n++;
ok = false;
if(n <= p.__count) {
ok = true;
r = (TRecord*)p.__values;
- for(m=first; m; m=m->alllink) {
- runtime_memmove(r->stk, m->createstack, sizeof r->stk);
+ for(mp=first; mp; mp=mp->alllink) {
+ runtime_memmove(r->stk, mp->createstack, sizeof r->stk);
r++;
}
}
@@ -471,11 +471,11 @@ func Stack(b Slice, all bool) (n int) {
}
static void
-saveg(G *g, TRecord *r)
+saveg(G *gp, TRecord *r)
{
int32 n;
- if(g == runtime_g())
+ if(gp == runtime_g())
n = runtime_callers(0, r->stk, nelem(r->stk));
else {
// FIXME: Not implemented.
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index d90bb2c9104..9b229d6bf46 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -555,13 +555,13 @@ schedlock(void)
static void
schedunlock(void)
{
- M *m;
+ M *mp;
- m = mwakeup;
+ mp = mwakeup;
mwakeup = nil;
runtime_unlock(&runtime_sched);
- if(m != nil)
- runtime_notewakeup(&m->havenextg);
+ if(mp != nil)
+ runtime_notewakeup(&mp->havenextg);
}
void
diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c
index 211edc0f4c2..ecd804de686 100644
--- a/libgo/runtime/runtime.c
+++ b/libgo/runtime/runtime.c
@@ -79,33 +79,6 @@ runtime_goenvs_unix(void)
syscall_Envs.__capacity = n;
}
-const byte*
-runtime_getenv(const char *s)
-{
- int32 i, j, len;
- const byte *v, *bs;
- String* envv;
- int32 envc;
-
- bs = (const byte*)s;
- len = runtime_findnull(bs);
- envv = (String*)syscall_Envs.__values;
- envc = syscall_Envs.__count;
- for(i=0; i<envc; i++){
- if(envv[i].len <= len)
- continue;
- v = (const byte*)envv[i].str;
- for(j=0; j<len; j++)
- if(bs[j] != v[j])
- goto nomatch;
- if(v[len] != '=')
- goto nomatch;
- return v+len+1;
- nomatch:;
- }
- return nil;
-}
-
int32
runtime_atoi(const byte *p)
{
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 977ae4906f4..c5cd3a08f45 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -599,9 +599,6 @@ enum
UseSpanType = 1,
};
-void runtime_time_scan(void (*)(byte*, uintptr));
-void runtime_trampoline_scan(void (*)(byte *, uintptr));
-
void runtime_setsig(int32, bool, bool);
#define runtime_setitimer setitimer
diff --git a/libgo/runtime/time.goc b/libgo/runtime/time.goc
index 5077b719fcf..d4973611d4e 100644
--- a/libgo/runtime/time.goc
+++ b/libgo/runtime/time.goc
@@ -255,7 +255,7 @@ siftdown(int32 i)
}
void
-runtime_time_scan(void (*addroot)(byte*, uintptr))
+runtime_time_scan(void (*addroot)(Obj))
{
- addroot((byte*)&timers, sizeof timers);
+ addroot((Obj){(byte*)&timers, sizeof timers, 0});
}
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 7ecd6da140e..0875603bc75 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,11 @@
+2013-01-01 David Edelsohn <dje.gcc@gmail.com>
+
+ * simple-object-xcoff.c: New file.
+ * Makefile.in: Add it to build machinery.
+ * simple-object-common.h (simple_object_xcoff_functions): Declare.
+ * simple-object.c (format_functions): Add
+ simple_object_xcoff_functions.
+
2012-11-10 Jason Merrill <jason@redhat.com>
* cp-demangle.c (d_unqualified_name): Handle abi tags here.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 1ba8cf1ccb2..f6a3ebd6d3d 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -146,7 +146,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \
random.c regex.c rename.c rindex.c \
safe-ctype.c setenv.c setproctitle.c sha1.c sigsetmask.c \
simple-object.c simple-object-coff.c simple-object-elf.c \
- simple-object-mach-o.c \
+ simple-object-mach-o.c simple-object-xcoff.c \
snprintf.c sort.c \
spaces.c splay-tree.c stack-limit.c stpcpy.c stpncpy.c \
strcasecmp.c strchr.c strdup.c strerror.c strncasecmp.c \
@@ -183,6 +183,7 @@ REQUIRED_OFILES = \
./safe-ctype.$(objext) \
./simple-object.$(objext) ./simple-object-coff.$(objext) \
./simple-object-elf.$(objext) ./simple-object-mach-o.$(objext) \
+ ./simple-object-xcoff.$(objext) \
./sort.$(objext) ./spaces.$(objext) \
./splay-tree.$(objext) ./stack-limit.$(objext) \
./strerror.$(objext) ./strsignal.$(objext) \
@@ -1009,6 +1010,14 @@ $(CONFIGURED_OFILES): stamp-picdir
else true; fi
$(COMPILE.c) $(srcdir)/simple-object-mach-o.c $(OUTPUT_OPTION)
+./simple-object-xcoff.$(objext): $(srcdir)/simple-object-xcoff.c config.h \
+ $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ $(srcdir)/simple-object-common.h $(INCDIR)/simple-object.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/simple-object-xcoff.c -o pic/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/simple-object-xcoff.c $(OUTPUT_OPTION)
+
./simple-object.$(objext): $(srcdir)/simple-object.c config.h \
$(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(srcdir)/simple-object-common.h $(INCDIR)/simple-object.h
diff --git a/libiberty/simple-object-common.h b/libiberty/simple-object-common.h
index 264b179955e..bef9b08cef8 100644
--- a/libiberty/simple-object-common.h
+++ b/libiberty/simple-object-common.h
@@ -148,6 +148,7 @@ struct simple_object_functions
extern const struct simple_object_functions simple_object_coff_functions;
extern const struct simple_object_functions simple_object_elf_functions;
extern const struct simple_object_functions simple_object_mach_o_functions;
+extern const struct simple_object_functions simple_object_xcoff_functions;
/* Read SIZE bytes from DESCRIPTOR at file offset OFFSET into BUFFER.
Return non-zero on success. On failure return 0 and set *ERRMSG
diff --git a/libiberty/simple-object-xcoff.c b/libiberty/simple-object-xcoff.c
new file mode 100644
index 00000000000..ff1dc18079e
--- /dev/null
+++ b/libiberty/simple-object-xcoff.c
@@ -0,0 +1,898 @@
+/* simple-object-coff.c -- routines to manipulate XCOFF object files.
+ Copyright 2013 Free Software Foundation, Inc.
+ Written by Ian Lance Taylor, Google and David Edelsohn, IBM.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "config.h"
+#include "libiberty.h"
+#include "simple-object.h"
+
+#include <errno.h>
+#include <stddef.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
+#include "simple-object-common.h"
+
+/* XCOFF structures and constants. */
+
+/* XCOFF file header. */
+
+struct external_filehdr
+{
+ unsigned char f_magic[2]; /* magic number */
+ unsigned char f_nscns[2]; /* number of sections */
+ unsigned char f_timdat[4]; /* time & date stamp */
+ union
+ {
+ struct
+ {
+ unsigned char f_symptr[4]; /* file pointer to symtab */
+ unsigned char f_nsyms[4]; /* number of symtab entries */
+ unsigned char f_opthdr[2]; /* sizeof(optional hdr) */
+ unsigned char f_flags[2]; /* flags */
+ } xcoff32;
+ struct
+ {
+ unsigned char f_symptr[8]; /* file pointer to symtab */
+ unsigned char f_opthdr[2]; /* sizeof(optional hdr) */
+ unsigned char f_flags[2]; /* flags */
+ unsigned char f_nsyms[4]; /* number of symtab entries */
+ } xcoff64;
+ } u;
+};
+
+/* Bits for filehdr f_flags field. */
+
+#define F_EXEC (0x0002)
+
+/* The known values of f_magic in an XCOFF file header. */
+
+#define U802WRMAGIC 0730 /* Writeable text segments. */
+#define U802ROMAGIC 0735 /* Readonly sharable text segments. */
+#define U802TOCMAGIC 0737 /* Readonly text segments and TOC. */
+#define U803XTOCMAGIC 0757 /* Aix 4.3 64-bit XCOFF. */
+#define U64_TOCMAGIC 0767 /* AIX 5+ 64-bit XCOFF. */
+
+/* XCOFF section header. */
+
+struct external_scnhdr
+{
+ unsigned char s_name[8]; /* section name */
+ union
+ {
+ struct
+ {
+ unsigned char s_paddr[4]; /* physical address, aliased s_nlib */
+ unsigned char s_vaddr[4]; /* virtual address */
+ unsigned char s_size[4]; /* section size */
+ unsigned char s_scnptr[4]; /* file ptr to raw data for section */
+ unsigned char s_relptr[4]; /* file ptr to relocation */
+ unsigned char s_lnnoptr[4]; /* file ptr to line numbers */
+ unsigned char s_nreloc[2]; /* number of relocation entries */
+ unsigned char s_nlnno[2]; /* number of line number entries */
+ unsigned char s_flags[4]; /* flags */
+ } xcoff32;
+ struct
+ {
+ unsigned char s_paddr[8]; /* physical address, aliased s_nlib */
+ unsigned char s_vaddr[8]; /* virtual address */
+ unsigned char s_size[8]; /* section size */
+ unsigned char s_scnptr[8]; /* file ptr to raw data for section */
+ unsigned char s_relptr[8]; /* file ptr to relocation */
+ unsigned char s_lnnoptr[8]; /* file ptr to line numbers */
+ unsigned char s_nreloc[4]; /* number of relocation entries */
+ unsigned char s_nlnno[4]; /* number of line number entries */
+ unsigned char s_flags[4]; /* flags */
+ } xcoff64;
+ } u;
+};
+
+#define SCNHSZ32 (40)
+#define SCNHSZ64 (68)
+
+/* The length of the s_name field in struct external_scnhdr. */
+
+#define SCNNMLEN (8)
+
+/* Bits for scnhdr s_flags field. */
+
+#define STYP_DATA 0x40
+
+/* XCOFF symbol table entry. */
+
+
+#define N_SYMNMLEN (8) /* # characters in a symbol name */
+
+/* The format of an XCOFF symbol-table entry. */
+struct external_syment
+{
+ union {
+ struct {
+ union {
+ /* The name of the symbol. There is an implicit null character
+ after the end of the array. */
+ char n_name[N_SYMNMLEN];
+ struct {
+ /* If n_zeroes is zero, n_offset is the offset the name from
+ the start of the string table. */
+ unsigned char n_zeroes[4];
+ unsigned char n_offset[4];
+ } n;
+ } n;
+
+ /* The symbol's value. */
+ unsigned char n_value[4];
+ } xcoff32;
+ struct {
+ /* The symbol's value. */
+ unsigned char n_value[8];
+
+ /* The offset of the symbol from the start of the string table. */
+ unsigned char n_offset[4];
+ } xcoff64;
+ } u;
+
+ /* The number of the section to which this symbol belongs. */
+ unsigned char n_scnum[2];
+
+ /* The type of symbol. (It can be interpreted as an n_lang
+ and an n_cpu byte, but we don't care about that here.) */
+ unsigned char n_type[2];
+
+ /* The class of symbol (a C_* value). */
+ unsigned char n_sclass[1];
+
+ /* The number of auxiliary symbols attached to this entry. */
+ unsigned char n_numaux[1];
+};
+
+#define SYMESZ (18)
+
+/* Length allowed for filename in aux sym format 4. */
+
+#define FILNMLEN (14)
+
+/* Omits x_sym and other unused variants. */
+
+union external_auxent
+{
+ /* Aux sym format 4: file. */
+ union
+ {
+ char x_fname[FILNMLEN];
+ struct
+ {
+ unsigned char x_zeroes[4];
+ unsigned char x_offset[4];
+ unsigned char x_pad[FILNMLEN-8];
+ unsigned char x_ftype;
+ } _x;
+ } x_file;
+ /* Aux sym format 5: section. */
+ struct
+ {
+ unsigned char x_scnlen[4]; /* section length */
+ unsigned char x_nreloc[2]; /* # relocation entries */
+ unsigned char x_nlinno[2]; /* # line numbers */
+ } x_scn;
+ /* CSECT auxiliary entry. */
+ union
+ {
+ struct
+ {
+ struct
+ {
+ unsigned char x_scnlen[4]; /* csect length */
+ unsigned char x_parmhash[4]; /* parm type hash index */
+ unsigned char x_snhash[2]; /* sect num with parm hash */
+ unsigned char x_smtyp; /* symbol align and type */
+ unsigned char x_smclas; /* storage mapping class */
+ unsigned char x_stab; /* dbx stab info index */
+ unsigned char x_snstab[2]; /* sect num with dbx stab */
+ } x_csect;
+ } xcoff32;
+ struct
+ {
+ struct
+ {
+ unsigned char x_scnlen_lo[4]; /* csect length */
+ unsigned char x_parmhash[4]; /* parm type hash index */
+ unsigned char x_snhash[2]; /* sect num with parm hash */
+ unsigned char x_smtyp; /* symbol align and type */
+ unsigned char x_smclas; /* storage mapping class */
+ unsigned char x_scnlen_hi[4];
+ unsigned char pad;
+ unsigned char x_auxtype;
+ } x_csect;
+ } xcoff64;
+ } u;
+ /* SECTION/DWARF auxiliary entry. */
+ struct
+ {
+ unsigned char x_scnlen[4]; /* section length */
+ unsigned char pad1[4];
+ unsigned char x_nreloc[4]; /* number RLDs */
+ } x_sect;
+};
+
+/* Symbol-related constants. */
+
+#define N_DEBUG (-2)
+#define IMAGE_SYM_TYPE_NULL (0)
+#define IMAGE_SYM_DTYPE_NULL (0)
+#define IMAGE_SYM_CLASS_STATIC (3)
+#define IMAGE_SYM_CLASS_FILE (103)
+
+#define IMAGE_SYM_TYPE \
+ ((IMAGE_SYM_DTYPE_NULL << 4) | IMAGE_SYM_TYPE_NULL)
+
+#define C_STAT (3)
+#define C_FILE (103)
+
+/* Private data for an simple_object_read. */
+
+struct simple_object_xcoff_read
+{
+ /* Magic number. */
+ unsigned short magic;
+ /* Number of sections. */
+ unsigned short nscns;
+ /* File offset of symbol table. */
+ off_t symptr;
+ /* Number of symbol table entries. */
+ unsigned int nsyms;
+ /* Flags. */
+ unsigned short flags;
+ /* Offset of section headers in file. */
+ off_t scnhdr_offset;
+};
+
+/* Private data for an simple_object_attributes. */
+
+struct simple_object_xcoff_attributes
+{
+ /* Magic number. */
+ unsigned short magic;
+ /* Flags. */
+ unsigned short flags;
+};
+
+/* See if we have a XCOFF file. */
+
+static void *
+simple_object_xcoff_match (unsigned char header[SIMPLE_OBJECT_MATCH_HEADER_LEN],
+ int descriptor, off_t offset,
+ const char *segment_name ATTRIBUTE_UNUSED,
+ const char **errmsg, int *err)
+{
+ unsigned short magic;
+ unsigned short (*fetch_16) (const unsigned char *);
+ unsigned int (*fetch_32) (const unsigned char *);
+ ulong_type (*fetch_64) (const unsigned char *);
+ unsigned char hdrbuf[sizeof (struct external_filehdr)];
+ struct simple_object_xcoff_read *ocr;
+ int u64;
+
+ magic = simple_object_fetch_big_16 (header);
+
+ if (magic != U802TOCMAGIC && magic != U64_TOCMAGIC)
+ {
+ *errmsg = NULL;
+ *err = 0;
+ return NULL;
+ }
+
+ fetch_16 = simple_object_fetch_big_16;
+ fetch_32 = simple_object_fetch_big_32;
+ fetch_64 = simple_object_fetch_big_64;
+
+ if (!simple_object_internal_read (descriptor, offset, hdrbuf, sizeof hdrbuf,
+ errmsg, err))
+ return NULL;
+
+ u64 = magic == U64_TOCMAGIC;
+
+ ocr = XNEW (struct simple_object_xcoff_read);
+ ocr->magic = magic;
+ ocr->nscns = fetch_16 (hdrbuf + offsetof (struct external_filehdr, f_nscns));
+ if (u64)
+ {
+ ocr->symptr = fetch_64 (hdrbuf
+ + offsetof (struct external_filehdr,
+ u.xcoff64.f_symptr));
+ ocr->nsyms = fetch_32 (hdrbuf + offsetof (struct external_filehdr,
+ u.xcoff64.f_nsyms));
+ ocr->scnhdr_offset = (sizeof (struct external_filehdr)
+ + fetch_16 (hdrbuf + offsetof (struct external_filehdr,
+ u.xcoff64.f_opthdr)));
+
+ }
+ else
+ {
+ ocr->symptr = fetch_32 (hdrbuf
+ + offsetof (struct external_filehdr,
+ u.xcoff32.f_symptr));
+ ocr->nsyms = fetch_32 (hdrbuf + offsetof (struct external_filehdr,
+ u.xcoff32.f_nsyms));
+ ocr->scnhdr_offset = (sizeof (struct external_filehdr) - 4
+ + fetch_16 (hdrbuf + offsetof (struct external_filehdr,
+ u.xcoff32.f_opthdr)));
+
+ }
+
+ return (void *) ocr;
+}
+
+/* Read the string table in a XCOFF file. */
+
+static char *
+simple_object_xcoff_read_strtab (simple_object_read *sobj, size_t *strtab_size,
+ const char **errmsg, int *err)
+{
+ struct simple_object_xcoff_read *ocr =
+ (struct simple_object_xcoff_read *) sobj->data;
+ off_t strtab_offset;
+ unsigned char strsizebuf[4];
+ size_t strsize;
+ char *strtab;
+
+ strtab_offset = sobj->offset + ocr->symptr
+ + ocr->nsyms * SYMESZ;
+ if (!simple_object_internal_read (sobj->descriptor, strtab_offset,
+ strsizebuf, 4, errmsg, err))
+ return NULL;
+ strsize = simple_object_fetch_big_32 (strsizebuf);
+ strtab = XNEWVEC (char, strsize);
+ if (!simple_object_internal_read (sobj->descriptor, strtab_offset,
+ (unsigned char *) strtab, strsize, errmsg,
+ err))
+ {
+ XDELETEVEC (strtab);
+ return NULL;
+ }
+ *strtab_size = strsize;
+ return strtab;
+}
+
+/* Find all sections in a XCOFF file. */
+
+static const char *
+simple_object_xcoff_find_sections (simple_object_read *sobj,
+ int (*pfn) (void *, const char *,
+ off_t offset, off_t length),
+ void *data,
+ int *err)
+{
+ struct simple_object_xcoff_read *ocr =
+ (struct simple_object_xcoff_read *) sobj->data;
+ int u64 = ocr->magic == U64_TOCMAGIC;
+ size_t scnhdr_size;
+ unsigned char *scnbuf;
+ const char *errmsg;
+ unsigned int (*fetch_32) (const unsigned char *);
+ ulong_type (*fetch_64) (const unsigned char *);
+ unsigned int nscns;
+ char *strtab;
+ size_t strtab_size;
+ unsigned int i;
+
+ scnhdr_size = u64 ? SCNHSZ64 : SCNHSZ32;
+ scnbuf = XNEWVEC (unsigned char, scnhdr_size * ocr->nscns);
+ if (!simple_object_internal_read (sobj->descriptor,
+ sobj->offset + ocr->scnhdr_offset,
+ scnbuf, scnhdr_size * ocr->nscns, &errmsg,
+ err))
+ {
+ XDELETEVEC (scnbuf);
+ return errmsg;
+ }
+
+ fetch_32 = simple_object_fetch_big_32;
+ fetch_64 = simple_object_fetch_big_64;
+
+ nscns = ocr->nscns;
+ strtab = NULL;
+ strtab_size = 0;
+ for (i = 0; i < nscns; ++i)
+ {
+ unsigned char *scnhdr;
+ unsigned char *scnname;
+ char namebuf[SCNNMLEN + 1];
+ char *name;
+ off_t scnptr;
+ unsigned int size;
+
+ scnhdr = scnbuf + i * scnhdr_size;
+ scnname = scnhdr + offsetof (struct external_scnhdr, s_name);
+ memcpy (namebuf, scnname, SCNNMLEN);
+ namebuf[SCNNMLEN] = '\0';
+ name = &namebuf[0];
+ if (namebuf[0] == '/')
+ {
+ size_t strindex;
+ char *end;
+
+ strindex = strtol (namebuf + 1, &end, 10);
+ if (*end == '\0')
+ {
+ /* The real section name is found in the string
+ table. */
+ if (strtab == NULL)
+ {
+ strtab = simple_object_xcoff_read_strtab (sobj,
+ &strtab_size,
+ &errmsg, err);
+ if (strtab == NULL)
+ {
+ XDELETEVEC (scnbuf);
+ return errmsg;
+ }
+ }
+
+ if (strindex < 4 || strindex >= strtab_size)
+ {
+ XDELETEVEC (strtab);
+ XDELETEVEC (scnbuf);
+ *err = 0;
+ return "section string index out of range";
+ }
+
+ name = strtab + strindex;
+ }
+ }
+
+ if (u64)
+ {
+ scnptr = fetch_64 (scnhdr + offsetof (struct external_scnhdr,
+ u.xcoff64.s_scnptr));
+ size = fetch_64 (scnhdr + offsetof (struct external_scnhdr,
+ u.xcoff64.s_size));
+ }
+ else
+ {
+ scnptr = fetch_32 (scnhdr + offsetof (struct external_scnhdr,
+ u.xcoff32.s_scnptr));
+ size = fetch_32 (scnhdr + offsetof (struct external_scnhdr,
+ u.xcoff32.s_size));
+ }
+
+ if (!(*pfn) (data, name, scnptr, size))
+ break;
+ }
+
+ if (strtab != NULL)
+ XDELETEVEC (strtab);
+ XDELETEVEC (scnbuf);
+
+ return NULL;
+}
+
+/* Fetch the attributes for an simple_object_read. */
+
+static void *
+simple_object_xcoff_fetch_attributes (simple_object_read *sobj,
+ const char **errmsg ATTRIBUTE_UNUSED,
+ int *err ATTRIBUTE_UNUSED)
+{
+ struct simple_object_xcoff_read *ocr =
+ (struct simple_object_xcoff_read *) sobj->data;
+ struct simple_object_xcoff_attributes *ret;
+
+ ret = XNEW (struct simple_object_xcoff_attributes);
+ ret->magic = ocr->magic;
+ ret->flags = ocr->flags;
+ return ret;
+}
+
+/* Release the private data for an simple_object_read. */
+
+static void
+simple_object_xcoff_release_read (void *data)
+{
+ XDELETE (data);
+}
+
+/* Compare two attributes structures. */
+
+static const char *
+simple_object_xcoff_attributes_merge (void *todata, void *fromdata, int *err)
+{
+ struct simple_object_xcoff_attributes *to =
+ (struct simple_object_xcoff_attributes *) todata;
+ struct simple_object_xcoff_attributes *from =
+ (struct simple_object_xcoff_attributes *) fromdata;
+
+ if (to->magic != from->magic)
+ {
+ *err = 0;
+ return "XCOFF object format mismatch";
+ }
+ return NULL;
+}
+
+/* Release the private data for an attributes structure. */
+
+static void
+simple_object_xcoff_release_attributes (void *data)
+{
+ XDELETE (data);
+}
+
+/* Prepare to write out a file. */
+
+static void *
+simple_object_xcoff_start_write (void *attributes_data,
+ const char **errmsg ATTRIBUTE_UNUSED,
+ int *err ATTRIBUTE_UNUSED)
+{
+ struct simple_object_xcoff_attributes *attrs =
+ (struct simple_object_xcoff_attributes *) attributes_data;
+ struct simple_object_xcoff_attributes *ret;
+
+ /* We're just going to record the attributes, but we need to make a
+ copy because the user may delete them. */
+ ret = XNEW (struct simple_object_xcoff_attributes);
+ *ret = *attrs;
+ return ret;
+}
+
+/* Write out a XCOFF filehdr. */
+
+static int
+simple_object_xcoff_write_filehdr (simple_object_write *sobj, int descriptor,
+ unsigned int nscns, size_t symtab_offset,
+ unsigned int nsyms, const char **errmsg,
+ int *err)
+{
+ struct simple_object_xcoff_attributes *attrs =
+ (struct simple_object_xcoff_attributes *) sobj->data;
+ int u64 = attrs->magic == U64_TOCMAGIC;
+ unsigned char hdrbuf[sizeof (struct external_filehdr)];
+ unsigned char *hdr;
+ void (*set_16) (unsigned char *, unsigned short);
+ void (*set_32) (unsigned char *, unsigned int);
+ void (*set_64) (unsigned char *, ulong_type);
+
+ hdr = &hdrbuf[0];
+
+ set_16 = simple_object_set_big_16;
+ set_32 = simple_object_set_big_32;
+ set_64 = simple_object_set_big_64;
+
+ memset (hdr, 0, sizeof (struct external_filehdr));
+
+ set_16 (hdr + offsetof (struct external_filehdr, f_magic), attrs->magic);
+ set_16 (hdr + offsetof (struct external_filehdr, f_nscns), nscns);
+ /* f_timdat left as zero. */
+ if (u64)
+ {
+ set_64 (hdr + offsetof (struct external_filehdr, u.xcoff64.f_symptr),
+ symtab_offset);
+ set_32 (hdr + offsetof (struct external_filehdr, u.xcoff64.f_nsyms),
+ nsyms);
+ /* f_opthdr left as zero. */
+ set_16 (hdr + offsetof (struct external_filehdr, u.xcoff64.f_flags),
+ attrs->flags);
+ }
+ else
+ {
+ set_32 (hdr + offsetof (struct external_filehdr, u.xcoff64.f_symptr),
+ symtab_offset);
+ set_32 (hdr + offsetof (struct external_filehdr, u.xcoff64.f_nsyms),
+ nsyms);
+ /* f_opthdr left as zero. */
+ set_16 (hdr + offsetof (struct external_filehdr, u.xcoff64.f_flags),
+ attrs->flags);
+ }
+
+ return simple_object_internal_write (descriptor, 0, hdrbuf,
+ sizeof (struct external_filehdr),
+ errmsg, err);
+}
+
+/* Write out a XCOFF section header. */
+
+static int
+simple_object_xcoff_write_scnhdr (simple_object_write *sobj,
+ int descriptor,
+ const char *name, size_t *name_offset,
+ off_t scnhdr_offset, size_t scnsize,
+ off_t offset, unsigned int align,
+ const char **errmsg, int *err)
+{
+ struct simple_object_xcoff_read *ocr =
+ (struct simple_object_xcoff_read *) sobj->data;
+ int u64 = ocr->magic == U64_TOCMAGIC;
+ void (*set_32) (unsigned char *, unsigned int);
+ void (*set_64) (unsigned char *, unsigned int);
+ unsigned char hdrbuf[sizeof (struct external_scnhdr)];
+ unsigned char *hdr;
+ size_t namelen;
+ unsigned int flags;
+
+ set_32 = simple_object_set_big_32;
+ set_64 = simple_object_set_big_32;
+
+ memset (hdrbuf, 0, sizeof hdrbuf);
+ hdr = &hdrbuf[0];
+
+ namelen = strlen (name);
+ if (namelen <= SCNNMLEN)
+ strncpy ((char *) hdr + offsetof (struct external_scnhdr, s_name),
+ name, SCNNMLEN);
+ else
+ {
+ snprintf ((char *) hdr + offsetof (struct external_scnhdr, s_name),
+ SCNNMLEN, "/%lu", (unsigned long) *name_offset);
+ *name_offset += namelen + 1;
+ }
+
+ /* s_paddr left as zero. */
+ /* s_vaddr left as zero. */
+ if (u64)
+ {
+ set_64 (hdr + offsetof (struct external_scnhdr, u.xcoff64.s_size),
+ scnsize);
+ set_64 (hdr + offsetof (struct external_scnhdr, u.xcoff64.s_scnptr),
+ offset);
+ }
+ else
+ {
+ set_32 (hdr + offsetof (struct external_scnhdr, u.xcoff32.s_size),
+ scnsize);
+ set_32 (hdr + offsetof (struct external_scnhdr, u.xcoff32.s_scnptr),
+ offset);
+ }
+ /* s_relptr left as zero. */
+ /* s_lnnoptr left as zero. */
+ /* s_nreloc left as zero. */
+ /* s_nlnno left as zero. */
+ flags = STYP_DATA;
+ if (align > 13)
+ align = 13;
+ if (u64)
+ set_32 (hdr + offsetof (struct external_scnhdr, u.xcoff64.s_flags), flags);
+ else
+ set_32 (hdr + offsetof (struct external_scnhdr, u.xcoff32.s_flags), flags);
+
+ return simple_object_internal_write (descriptor, scnhdr_offset, hdrbuf,
+ u64 ? SCNHSZ64 : SCNHSZ32,
+ errmsg, err);
+}
+
+/* Write out a complete XCOFF file. */
+
+static const char *
+simple_object_xcoff_write_to_file (simple_object_write *sobj, int descriptor,
+ int *err)
+{
+ struct simple_object_xcoff_read *ocr =
+ (struct simple_object_xcoff_read *) sobj->data;
+ int u64 = ocr->magic == U64_TOCMAGIC;
+ unsigned int nscns, secnum;
+ simple_object_write_section *section;
+ off_t scnhdr_offset;
+ size_t symtab_offset;
+ off_t secsym_offset;
+ unsigned int nsyms;
+ size_t offset;
+ size_t name_offset;
+ const char *errmsg;
+ unsigned char strsizebuf[4];
+ /* The interface doesn't give us access to the name of the input file
+ yet. We want to use its basename for the FILE symbol. This is
+ what 'gas' uses when told to assemble from stdin. */
+ const char *source_filename = "fake";
+ size_t sflen;
+ union
+ {
+ struct external_syment sym;
+ union external_auxent aux;
+ } syms[2];
+ void (*set_16) (unsigned char *, unsigned short);
+ void (*set_32) (unsigned char *, unsigned int);
+
+ set_16 = simple_object_set_big_16;
+ set_32 = simple_object_set_big_32;
+
+ nscns = 0;
+ for (section = sobj->sections; section != NULL; section = section->next)
+ ++nscns;
+
+ scnhdr_offset = sizeof (struct external_filehdr) - (u64 ? 4 : 0);
+ offset = scnhdr_offset + nscns * (u64 ? SCNHSZ64 : SCNHSZ32);
+ name_offset = 4;
+ for (section = sobj->sections; section != NULL; section = section->next)
+ {
+ size_t mask;
+ size_t new_offset;
+ size_t scnsize;
+ struct simple_object_write_section_buffer *buffer;
+
+ mask = (1U << section->align) - 1;
+ new_offset = offset & mask;
+ new_offset &= ~ mask;
+ while (new_offset > offset)
+ {
+ unsigned char zeroes[16];
+ size_t write;
+
+ memset (zeroes, 0, sizeof zeroes);
+ write = new_offset - offset;
+ if (write > sizeof zeroes)
+ write = sizeof zeroes;
+ if (!simple_object_internal_write (descriptor, offset, zeroes, write,
+ &errmsg, err))
+ return errmsg;
+ }
+
+ scnsize = 0;
+ for (buffer = section->buffers; buffer != NULL; buffer = buffer->next)
+ {
+ if (!simple_object_internal_write (descriptor, offset + scnsize,
+ ((const unsigned char *)
+ buffer->buffer),
+ buffer->size, &errmsg, err))
+ return errmsg;
+ scnsize += buffer->size;
+ }
+
+ if (!simple_object_xcoff_write_scnhdr (sobj, descriptor, section->name,
+ &name_offset, scnhdr_offset,
+ scnsize, offset, section->align,
+ &errmsg, err))
+ return errmsg;
+
+ scnhdr_offset += u64 ? SCNHSZ64 : SCNHSZ32;
+ offset += scnsize;
+ }
+
+ /* Symbol table is always half-word aligned. */
+ offset += (offset & 1);
+ /* There is a file symbol and a section symbol per section,
+ and each of these has a single auxiliary symbol following. */
+ nsyms = 2 * (nscns + 1);
+ symtab_offset = offset;
+ /* Advance across space reserved for symbol table to locate
+ start of string table. */
+ offset += nsyms * SYMESZ;
+
+ /* Write out file symbol. */
+ memset (&syms[0], 0, sizeof (syms));
+ if (!u64)
+ strcpy ((char *)&syms[0].sym.u.xcoff32.n.n_name[0], ".file");
+ set_16 (&syms[0].sym.n_scnum[0], N_DEBUG);
+ set_16 (&syms[0].sym.n_type[0], IMAGE_SYM_TYPE);
+ syms[0].sym.n_sclass[0] = C_FILE;
+ syms[0].sym.n_numaux[0] = 1;
+ /* The name need not be nul-terminated if it fits into the x_fname field
+ directly, but must be if it has to be placed into the string table. */
+ sflen = strlen (source_filename);
+ if (sflen <= FILNMLEN)
+ memcpy (&syms[1].aux.x_file.x_fname[0], source_filename, sflen);
+ else
+ {
+ set_32 (&syms[1].aux.x_file._x.x_offset[0], name_offset);
+ if (!simple_object_internal_write (descriptor, offset + name_offset,
+ ((const unsigned char *)
+ source_filename),
+ sflen + 1, &errmsg, err))
+ return errmsg;
+ name_offset += strlen (source_filename) + 1;
+ }
+ if (!simple_object_internal_write (descriptor, symtab_offset,
+ (const unsigned char *) &syms[0],
+ sizeof (syms), &errmsg, err))
+ return errmsg;
+
+ /* Write the string table length, followed by the strings and section
+ symbols in step with each other. */
+ set_32 (strsizebuf, name_offset);
+ if (!simple_object_internal_write (descriptor, offset, strsizebuf, 4,
+ &errmsg, err))
+ return errmsg;
+
+ name_offset = 4;
+ secsym_offset = symtab_offset + sizeof (syms);
+ memset (&syms[0], 0, sizeof (syms));
+ set_16 (&syms[0].sym.n_type[0], IMAGE_SYM_TYPE);
+ syms[0].sym.n_sclass[0] = C_STAT;
+ syms[0].sym.n_numaux[0] = 1;
+ secnum = 1;
+
+ for (section = sobj->sections; section != NULL; section = section->next)
+ {
+ size_t namelen;
+ size_t scnsize;
+ struct simple_object_write_section_buffer *buffer;
+
+ namelen = strlen (section->name);
+ set_16 (&syms[0].sym.n_scnum[0], secnum++);
+ scnsize = 0;
+ for (buffer = section->buffers; buffer != NULL; buffer = buffer->next)
+ scnsize += buffer->size;
+ set_32 (&syms[1].aux.x_scn.x_scnlen[0], scnsize);
+ if (namelen > SCNNMLEN)
+ {
+ set_32 (&syms[0].sym.u.xcoff32.n.n.n_zeroes[0], 0);
+ set_32 (&syms[0].sym.u.xcoff32.n.n.n_offset[0], name_offset);
+ if (!simple_object_internal_write (descriptor, offset + name_offset,
+ ((const unsigned char *)
+ section->name),
+ namelen + 1, &errmsg, err))
+ return errmsg;
+ name_offset += namelen + 1;
+ }
+ else
+ {
+ memcpy (&syms[0].sym.u.xcoff32.n.n_name[0], section->name,
+ strlen (section->name));
+ memset (&syms[0].sym.u.xcoff32.n.n_name[strlen (section->name)], 0,
+ N_SYMNMLEN - strlen (section->name));
+ }
+
+ if (!simple_object_internal_write (descriptor, secsym_offset,
+ (const unsigned char *) &syms[0],
+ sizeof (syms), &errmsg, err))
+ return errmsg;
+ secsym_offset += sizeof (syms);
+ }
+
+ if (!simple_object_xcoff_write_filehdr (sobj, descriptor, nscns,
+ symtab_offset, nsyms, &errmsg, err))
+ return errmsg;
+
+ return NULL;
+}
+
+/* Release the private data for an simple_object_write structure. */
+
+static void
+simple_object_xcoff_release_write (void *data)
+{
+ XDELETE (data);
+}
+
+/* The XCOFF functions. */
+
+const struct simple_object_functions simple_object_xcoff_functions =
+{
+ simple_object_xcoff_match,
+ simple_object_xcoff_find_sections,
+ simple_object_xcoff_fetch_attributes,
+ simple_object_xcoff_release_read,
+ simple_object_xcoff_attributes_merge,
+ simple_object_xcoff_release_attributes,
+ simple_object_xcoff_start_write,
+ simple_object_xcoff_write_to_file,
+ simple_object_xcoff_release_write
+};
diff --git a/libiberty/simple-object.c b/libiberty/simple-object.c
index d000cfc0806..fde3454dd42 100644
--- a/libiberty/simple-object.c
+++ b/libiberty/simple-object.c
@@ -51,7 +51,8 @@ static const struct simple_object_functions * const format_functions[] =
{
&simple_object_elf_functions,
&simple_object_mach_o_functions,
- &simple_object_coff_functions
+ &simple_object_coff_functions,
+ &simple_object_xcoff_functions
};
/* Read data from a file using the simple_object error reporting